686 lines
28 KiB
Objective-C
686 lines
28 KiB
Objective-C
//
|
||
// MineInfoViewController.m
|
||
// xplan-ios
|
||
//
|
||
// Created by 冯硕 on 2021/9/22.
|
||
//
|
||
|
||
#import "XPMineUserInfoViewController.h"
|
||
///Third
|
||
#import <NIMSDK/NIMSDK.h>
|
||
#import <Masonry/Masonry.h>
|
||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||
#import <JXPagingView/JXPagerView.h>
|
||
#import <JXPagingView/JXPagerListRefreshView.h>
|
||
#import <JXCategoryView/JXCategoryView.h>
|
||
#import <AFNetworking.h>
|
||
#import <ReactiveObjC/ReactiveObjC.h>
|
||
///Tool
|
||
#import "AccountInfoStorage.h"
|
||
#import "TTPopup.h"
|
||
#import "XPSkillCardPlayerManager.h"
|
||
#import "UIImage+Utils.h"
|
||
#import "CountDownHelper.h"
|
||
///Model
|
||
#import "MineSkillCardListInfoModel.h"
|
||
#import "UserInfoModel.h"
|
||
#import "XPSoundCardModel.h"
|
||
#import "XPMineUserInfoTagModel.h"
|
||
#import "UploadFile.h"
|
||
///View
|
||
#import "XPMineUserInfoHeaderView.h"
|
||
#import "XPMineUserInfoCustomNavView.h"
|
||
#import "XPMineUserInfoVoiceCardView.h"
|
||
#import "XPMineUserInfoIndividualTagView.h"
|
||
///P
|
||
#import "XPMineUserInfoPresenter.h"
|
||
#import "XPMineUserInfoProtocol.h"
|
||
#import "RoomHostDelegate.h"
|
||
///VC
|
||
#import "XPMineUserInfoEditViewController.h"
|
||
#import "XPWebViewController.h"
|
||
#import "SessionViewController.h"
|
||
#import "XPRoomViewController.h"
|
||
#import "XPMineUserDataViewController.h"
|
||
#import "XPMonentsMineViewController.h"
|
||
#import "XPGiftUserDataViewController.h"
|
||
#import "XPMineUserInfoRecordedSoundVC.h"
|
||
#import "XPRoomMiniManager.h"
|
||
#import "XPMineUserInfoTagVC.h"
|
||
|
||
UIKIT_EXTERN NSString * kUpdateSoundInfo;
|
||
|
||
@interface XPMineUserInfoViewController ()<CountDownHelperDelegate,XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDelegate, JXCategoryViewDelegate,JXPagerViewDelegate, XPMineUserDataViewControllerDelegate, JXPagerMainTableViewGestureDelegate,XPMineUserInfoEditViewControllerDelegate,XPMineUserInfoTagVCDelegate,XPMineUserInfoIndividualTagViewDelegate>
|
||
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
||
@property (nonatomic, strong) JXCategoryIndicatorImageView *lineView;
|
||
@property (nonatomic, strong) JXPagerView *pagingView;
|
||
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
||
///头部视图
|
||
@property (nonatomic,strong) XPMineUserInfoHeaderView *headView;
|
||
///自定义的导航栏
|
||
@property (nonatomic,strong) XPMineUserInfoCustomNavView *navView;
|
||
///用户信息
|
||
@property (nonatomic,strong) UserInfoModel *userInfo;
|
||
///底部的容器
|
||
@property (nonatomic,strong) UIStackView *bottomStackView;
|
||
///私聊
|
||
@property (nonatomic,strong) UIButton *chatButton;
|
||
///关注
|
||
@property (nonatomic,strong) UIButton *attentionButton;
|
||
///资料
|
||
@property (nonatomic,strong) XPMineUserDataViewController *userDataVC;
|
||
///动态
|
||
//@property (nonatomic,strong) XPMonentsMineViewController *monentsVC;
|
||
///禮物牆
|
||
@property (nonatomic,strong) XPGiftUserDataViewController *giftVC;
|
||
///编辑资料
|
||
@property (nonatomic,strong) XPMineUserInfoEditViewController * editVC ;
|
||
///声音秀
|
||
@property (nonatomic,strong) XPMineUserInfoVoiceCardView *voiceView;
|
||
///倒计时
|
||
@property (nonatomic,strong) CountDownHelper *countDownHelper;
|
||
///标签
|
||
@property (nonatomic,strong) XPMineUserInfoTagModel *tagModel;
|
||
|
||
@end
|
||
|
||
@implementation XPMineUserInfoViewController
|
||
- (void)dealloc{
|
||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||
}
|
||
- (XPMineUserInfoPresenter *)createPresenter {
|
||
return [[XPMineUserInfoPresenter alloc] init];
|
||
}
|
||
|
||
- (BOOL)isHiddenNavBar {
|
||
return YES;
|
||
}
|
||
|
||
|
||
-(void)viewDidAppear:(BOOL)animated{
|
||
[super viewDidAppear:animated];
|
||
self.countDownHelper .delegate = self;
|
||
|
||
}
|
||
|
||
|
||
-(void)viewDidDisappear:(BOOL)animated{
|
||
[super viewDidAppear:animated];
|
||
[self.countDownHelper stopCountDown];
|
||
self.countDownHelper .delegate = nil;
|
||
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
||
[self.headView setPlaySoundStatus:NO];
|
||
|
||
|
||
}
|
||
- (void)viewWillAppear:(BOOL)animated {
|
||
[super viewWillAppear:animated];
|
||
if (self.uid > 0) {
|
||
[self initHttpRequest];
|
||
}
|
||
if([XPSkillCardPlayerManager shareInstance].isInRoom == YES && [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == NO){
|
||
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
|
||
}
|
||
}
|
||
|
||
|
||
- (void)viewDidLoad {
|
||
[super viewDidLoad];
|
||
[self initSubViews];
|
||
[self initSubViewConstraints];
|
||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(updateSoundInfo:) name:kUpdateSoundInfo object:nil];
|
||
}
|
||
-(void)updateSoundInfo:(NSNotification *)not{
|
||
if(not.object != nil){
|
||
self.headView.soundModel = not.object;
|
||
NSString *fileName = [[ self.headView.soundModel.audioUrl componentsSeparatedByString:@"/"] lastObject];
|
||
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"kMineSoundCard"];
|
||
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
|
||
if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
||
NSFileManager *fileMgr = [[NSFileManager alloc] init];
|
||
[fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
|
||
[UploadFile downloadAudioWithFileName:fileName musicUrl:self.headView.soundModel.audioUrl mainFileName:@"kMineSoundCard" completion:^(BOOL isSuccess, NSString *editAudioPath) {
|
||
}];
|
||
}
|
||
}else{
|
||
self.headView.soundModel = nil;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
- (void)viewDidLayoutSubviews {
|
||
[super viewDidLayoutSubviews];
|
||
self.pagingView.frame = self.view.bounds;
|
||
}
|
||
|
||
#pragma mark - Private Method
|
||
- (void)initSubViews {
|
||
[self.view addSubview:self.pagingView];
|
||
[self.view addSubview:self.navView];
|
||
[self.view addSubview:self.voiceView];
|
||
if (self.uid != [AccountInfoStorage instance].getUid.integerValue) {
|
||
[self.view addSubview:self.bottomStackView];
|
||
[self.bottomStackView addArrangedSubview:self.chatButton];
|
||
[self.bottomStackView addArrangedSubview:self.attentionButton];
|
||
|
||
[self.bottomStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.mas_equalTo(self.view).inset(15);
|
||
make.height.mas_equalTo(45);
|
||
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 15);
|
||
}];
|
||
}
|
||
|
||
}
|
||
|
||
- (void)initSubViewConstraints {
|
||
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.top.mas_equalTo(self.view);
|
||
make.height.mas_equalTo(kNavigationHeight);
|
||
}];
|
||
|
||
[self.voiceView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.right.mas_equalTo(self.view);
|
||
make.top.mas_equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(176);
|
||
make.size.mas_equalTo(CGSizeMake(65, 25));
|
||
}];
|
||
}
|
||
|
||
- (void)initHttpRequest {
|
||
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
|
||
[self.presenter getUserInfoWithUid:uid];
|
||
|
||
[self.presenter getUserAttentionState:uid];
|
||
|
||
//获取用户详细信息 跟随进房目前使用的这个接口
|
||
[self.presenter getUserDetailInfoWithUid:uid];
|
||
|
||
///上传访问记录
|
||
if (![uid isEqualToString:[[AccountInfoStorage instance] getUid]]) {
|
||
[self.presenter visitUser:uid];
|
||
}
|
||
}
|
||
|
||
#pragma mark - 拉黑 移除黑名单
|
||
- (BOOL)isSystemAccount {
|
||
return [KeyWithType(KeyType_SecretaryUidKey) isEqualToString:[NSString stringWithFormat:@"%ld", self.uid]] || [KeyWithType(KeyType_SystemNotifiUidKey) isEqualToString:[NSString stringWithFormat:@"%ld", self.uid]] || [KeyWithType(KeyType_GuildUidKey) isEqualToString:[NSString stringWithFormat:@"%ld", self.uid]];
|
||
}
|
||
|
||
|
||
- (void)showRightNavHandle {
|
||
NSMutableArray<TTActionSheetConfig *> *array = [NSMutableArray array];
|
||
NSString *uid = [NSString stringWithFormat:@"%ld",self.uid];
|
||
TTActionSheetConfig *report = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoViewController0") clickAction:^{
|
||
XPWebViewController *vc = [[XPWebViewController alloc]init];
|
||
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%@&source=PERSONAL",URLWithType(kReportRoomURL),uid];
|
||
vc.url = urlstr;
|
||
[self.navigationController pushViewController:vc animated:YES];
|
||
}];
|
||
|
||
TTActionSheetConfig *black = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMineUserInfoViewController1") clickAction:^{
|
||
[self addOrRemoveBlack:NO uid:uid];
|
||
}];
|
||
|
||
[array addObjectsFromArray:@[report, black]];
|
||
|
||
BOOL isInBlackList = [[NIMSDK sharedSDK].userManager isUserInBlackList:uid] || [self isSystemAccount];
|
||
if (isInBlackList) {
|
||
[array removeObject:black];
|
||
}
|
||
[TTPopup actionSheetWithItems:array];
|
||
}
|
||
|
||
|
||
//加入黑名单
|
||
- (void)addOrRemoveBlack:(BOOL)isRemove uid:(NSString *)uid {
|
||
NSString *title;
|
||
NSString *message;
|
||
if (isRemove) {
|
||
title = YMLocalizedString(@"XPMineUserInfoViewController2");
|
||
message = YMLocalizedString(@"XPMineUserInfoViewController3");
|
||
}else{
|
||
title = YMLocalizedString(@"XPMineUserInfoViewController4");
|
||
message = YMLocalizedString(@"XPMineUserInfoViewController5");
|
||
}
|
||
|
||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||
config.title = title;
|
||
config.message = message;
|
||
|
||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||
if (isRemove) {
|
||
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:uid completion:^(NSError * _Nullable error) {
|
||
if (error == nil) {
|
||
[self showSuccessToast:YMLocalizedString(@"XPMineUserInfoViewController6")];
|
||
}
|
||
}];
|
||
} else {
|
||
[[NIMSDK sharedSDK].userManager addToBlackList:uid completion:^(NSError * _Nullable error) {
|
||
if (error == nil) {
|
||
[self showSuccessToast:YMLocalizedString(@"XPMineUserInfoViewController7")];
|
||
}
|
||
}];
|
||
}
|
||
} cancelHandler:^{
|
||
}];
|
||
}
|
||
|
||
#pragma mark - JXCategoryViewDelegate
|
||
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
|
||
return 358;
|
||
}
|
||
|
||
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
|
||
return self.headView;
|
||
}
|
||
|
||
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||
return 50;
|
||
}
|
||
|
||
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||
return self.titleView;
|
||
}
|
||
|
||
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
||
return self.titles.count;
|
||
}
|
||
|
||
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
||
UIViewController *viewController;
|
||
if (index == 0) {
|
||
return self.userDataVC;
|
||
}
|
||
else{
|
||
return self.giftVC;
|
||
}
|
||
return (id <JXPagerViewListViewDelegate>)viewController;
|
||
}
|
||
|
||
#pragma mark - JXPagerMainTableViewGestureDelegate
|
||
- (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
|
||
///1000是外部的scrollView 1001是人气主播中的collectionView
|
||
if (otherGestureRecognizer.view.tag == 1005 || otherGestureRecognizer.view.tag == 1009) {
|
||
return NO;
|
||
}
|
||
return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
|
||
}
|
||
|
||
#pragma mark - XPMineCustomNavViewDelegate
|
||
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickEditButton:(UIButton *)sender {
|
||
if (sender.isSelected) {///自己看自己的 去修改资料
|
||
self.editVC.area = self.userInfo.region;
|
||
[self.navigationController pushViewController:self.editVC animated:YES];
|
||
} else {
|
||
[self showRightNavHandle];
|
||
}
|
||
}
|
||
|
||
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickBackButton:(UIButton *)sender {
|
||
[self.navigationController popViewControllerAnimated:YES];
|
||
}
|
||
|
||
#pragma mark - XPMineUserInfoHeaderViewDelegate
|
||
- (void)xPMineUserInfoHeaderView:(XPMineUserInfoHeaderView *)view didClickGotoEditVC:(nonnull NSMutableArray *)itemList{
|
||
|
||
XPMineUserInfoTagVC *tagVC =[XPMineUserInfoTagVC new];
|
||
tagVC.tagModel = self.tagModel;
|
||
tagVC.delegate = self;
|
||
[self.navigationController pushViewController:tagVC animated:YES];
|
||
}
|
||
- (void)xPMineUserInfoHeaderView:(XPMineUserInfoHeaderView *)view didClickGotoEditView:(NSMutableArray *)itemList{
|
||
XPMineUserInfoIndividualTagView *tagView = [[XPMineUserInfoIndividualTagView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||
tagView.uid = @(self.uid).stringValue;
|
||
tagView.itemList = itemList;
|
||
tagView.delegate = self;
|
||
[TTPopup popupView:tagView style:TTPopupStyleAlert];
|
||
}
|
||
|
||
-(void)didClickGoToPlaySound{
|
||
XPMineUserInfoRecordedSoundVC *soundVC = [[XPMineUserInfoRecordedSoundVC alloc]init];
|
||
soundVC.soundModel = self.headView.soundModel;
|
||
[self.navigationController pushViewController:soundVC animated:YES];
|
||
}
|
||
- (void)xPMineUserInfoHeaderView:(XPMineUserInfoHeaderView *)view didClickPlaySound:(BOOL)isPlay{
|
||
|
||
if(isPlay == YES){
|
||
NSString *fileName = [[self.headView.soundModel.audioUrl componentsSeparatedByString:@"/"] lastObject];
|
||
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"kMineSoundCard"];
|
||
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
|
||
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
||
[self playAudioWithUrl:fullPath isDelay:[XPSkillCardPlayerManager shareInstance].isMineInMic];
|
||
}else{
|
||
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
|
||
NSFileManager *fileMgr = [[NSFileManager alloc] init];
|
||
[fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
|
||
}
|
||
[UploadFile downloadAudioWithFileName:fileName musicUrl:self.headView.soundModel.audioUrl mainFileName:@"kMineSoundCard" completion:^(BOOL isSuccess, NSString *editAudioPath) {
|
||
if(isSuccess){
|
||
[self playAudioWithUrl:editAudioPath isDelay:[XPSkillCardPlayerManager shareInstance].isMineInMic];
|
||
|
||
}else{
|
||
[self.headView setPlaySoundStatus:NO];
|
||
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
||
}
|
||
}];
|
||
}
|
||
}else{
|
||
[self.countDownHelper stopCountDown];
|
||
[self.headView setPlaySoundStatus:NO];
|
||
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
||
}
|
||
|
||
|
||
}
|
||
|
||
/// 播放录音
|
||
/// - Parameters:
|
||
/// - url: 录音链接
|
||
/// - isDelay: 是否延时0.5秒播放录音,因为如果在麦上的话,需要先关麦再播放,所以要延时0.5秒来关麦后再播放,不然会没声音
|
||
-(void)playAudioWithUrl:(NSString*)url isDelay:(BOOL)isDelay{
|
||
if(isDelay == YES){
|
||
[[XPSkillCardPlayerManager shareInstance] playerNewVoiceWithPath:url completionBlock:^{
|
||
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
||
}];
|
||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
|
||
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
||
NSInteger getCurrentTime = ceil(self.headView.soundModel.second);
|
||
[self.countDownHelper openCountdownWithTime:(int)getCurrentTime];
|
||
});
|
||
return;
|
||
}
|
||
NSInteger getCurrentTime = ceil(self.headView.soundModel.second);
|
||
[self.countDownHelper openCountdownWithTime:(int)getCurrentTime];
|
||
[[XPSkillCardPlayerManager shareInstance] playerVoiceWithPath:url completionBlock:^{
|
||
|
||
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
||
}];
|
||
}
|
||
- (void)xPMineUserInfoHeaderView:(XPMineUserInfoHeaderView *)view didClickGoToRoom:(NSString *)roomUid {
|
||
if (roomUid.length > 0 ) {
|
||
if(roomUid.integerValue == [XPSkillCardPlayerManager shareInstance].roomUid.integerValue && [XPRoomMiniManager shareManager].getRoomInfo == nil){
|
||
[self.navigationController popViewControllerAnimated:YES];
|
||
return;
|
||
}
|
||
//退出原来的房间 如果有的话 TODO 总感觉这种处理不太优雅 进房入口多了 怎么办 进房需要整合
|
||
[self.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||
if ([obj isKindOfClass:[XPRoomViewController class]]) {
|
||
[self.navigationController popToRootViewControllerAnimated:NO];
|
||
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
|
||
[rooomVC exitRoom];
|
||
*stop = YES;
|
||
}
|
||
}];
|
||
[XPRoomViewController openRoom:roomUid viewController:self];
|
||
}
|
||
}
|
||
#pragma mark - CountDownHelperDelegate
|
||
///倒计时结束
|
||
- (void)onCountdownFinish{
|
||
[self.headView setPlaySoundTime:0];
|
||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC));
|
||
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
||
[self.headView setPlaySoundStatus:NO];
|
||
});
|
||
|
||
}
|
||
///倒计时进行
|
||
- (void)onCountdownOpen:(int)time{
|
||
[self.headView setPlaySoundTime:(int)time + 1];
|
||
}
|
||
#pragma mark - XPMineUserInfoIndividualTagView
|
||
- (void)didClickGotoEditVC{
|
||
|
||
XPMineUserInfoTagVC *tagVC =[XPMineUserInfoTagVC new];
|
||
tagVC.tagModel = self.tagModel;
|
||
tagVC.delegate = self;
|
||
[self.navigationController pushViewController:tagVC animated:YES];
|
||
|
||
}
|
||
|
||
#pragma mark- XPMineUserInfoTagVCDelegate
|
||
- (void)xPMineUserInfoTagVC:(XPMineUserInfoTagVC *)vc didClickComplete:(NSArray *)meLabels{
|
||
self.headView.tagModel = self.tagModel;
|
||
}
|
||
#pragma mark - XPMineUserDataViewControllerDelegate
|
||
- (void)xPMineUserDataViewController:(XPMineUserDataViewController *)viewController didGetVoiceSuccess:(MineSkillCardListInfoModel *)voiceCard {
|
||
if (voiceCard && [voiceCard.cardId isEqualToString:@"8"]) {
|
||
self.voiceView.hidden = NO;
|
||
self.voiceView.voiceInfo = voiceCard;
|
||
} else {
|
||
self.voiceView.hidden = YES;
|
||
}
|
||
}
|
||
|
||
#pragma mark - XPMineUserInfoProtocol
|
||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
||
self.userInfo = userInfo;
|
||
self.headView.userInfo = userInfo;
|
||
self.headView.soundModel = self.userInfo.audioCard;
|
||
self.editVC.soundModel = self.headView.soundModel;
|
||
XPMineUserInfoTagModel *tagModel = [XPMineUserInfoTagModel new];
|
||
tagModel.meLabels = userInfo.labels;
|
||
self.tagModel = tagModel;
|
||
self.editVC.tagModel = tagModel;
|
||
self.headView.tagModel = tagModel;
|
||
self.userDataVC.userInfo = userInfo;
|
||
|
||
|
||
NSString *fileName = [[self.headView.soundModel.audioUrl componentsSeparatedByString:@"/"] lastObject];
|
||
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"kMineSoundCard"];
|
||
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
|
||
if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
||
NSFileManager *fileMgr = [[NSFileManager alloc] init];
|
||
[fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
|
||
[UploadFile downloadAudioWithFileName:fileName musicUrl:self.headView.soundModel.audioUrl mainFileName:@"kMineSoundCard" completion:^(BOOL isSuccess, NSString *editAudioPath) {
|
||
}];
|
||
}
|
||
}
|
||
|
||
|
||
|
||
- (void)ongetDetailInfoSuccess:(UserInfoModel *)userInfo {
|
||
self.userDataVC.dynamicInfo = userInfo.dynamicInfo;
|
||
self.headView.roomUid = userInfo.roomUid;
|
||
self.giftVC.userInfo = userInfo;
|
||
}
|
||
|
||
- (void)getAttentionStateSuccess:(BOOL)status {
|
||
self.attentionButton.selected = status;
|
||
}
|
||
|
||
- (void)attentionUserSuccess:(BOOL)status {
|
||
self.attentionButton.selected = status;
|
||
}
|
||
|
||
#pragma mark -XPMineUserInfoEditViewController
|
||
|
||
- (void)xPMineUserInfoEditViewControllerC:(XPMineUserInfoEditViewController *)vc didClickComplete:(NSString *)meLabels{
|
||
self.headView.tagModel = self.tagModel;
|
||
}
|
||
- (void)xPMineUserInfoEditViewControllerC:(XPMineUserInfoEditViewController *)vc didClickCompleteArea:(NSString *)area{
|
||
self.userInfo.region = area;
|
||
self.userDataVC.userInfo = self.userInfo;
|
||
}
|
||
#pragma mark - Event Response
|
||
- (void)chatButtonAction:(UIButton *)sender {
|
||
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
|
||
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
|
||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||
}
|
||
|
||
- (void)attentionButtonAction:(UIButton *)sender {
|
||
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
|
||
[self.presenter attentionUser:uid state:!sender.selected];
|
||
}
|
||
|
||
#pragma mark - Getters And Setters
|
||
- (void)setUid:(NSInteger)uid {
|
||
_uid = uid;
|
||
if (_uid > 0) {
|
||
if (_uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||
[self.navView.editButton setImage:[UIImage imageNamed:@"mine_user_info_edit_self"] forState:UIControlStateNormal];
|
||
} else {
|
||
|
||
[self.navView.editButton setImage:[UIImage imageNamed:@"mine_user_info_edit"] forState:UIControlStateNormal];
|
||
}
|
||
self.navView.editButton.selected = _uid == [AccountInfoStorage instance].getUid.integerValue;
|
||
NSString * uidStr = [NSString stringWithFormat:@"%ld", uid];
|
||
self.userDataVC.userUid = uidStr;
|
||
self.giftVC.userUid = uidStr;
|
||
[self.presenter getUserInfoWithUid:uidStr];
|
||
self.editVC.uid = uidStr;
|
||
}
|
||
}
|
||
|
||
|
||
- (XPMineUserInfoHeaderView *)headView {
|
||
if (!_headView) {
|
||
_headView = [[XPMineUserInfoHeaderView alloc] init];
|
||
_headView.delegate = self;
|
||
}
|
||
return _headView;
|
||
}
|
||
|
||
- (XPMineUserInfoCustomNavView *)navView {
|
||
if (!_navView) {
|
||
_navView = [[XPMineUserInfoCustomNavView alloc] init];
|
||
_navView.delegate = self;
|
||
}
|
||
return _navView;
|
||
}
|
||
|
||
- (UIStackView *)bottomStackView {
|
||
if (!_bottomStackView) {
|
||
_bottomStackView = [[UIStackView alloc] init];
|
||
_bottomStackView.axis = UILayoutConstraintAxisHorizontal;
|
||
_bottomStackView.distribution = UIStackViewDistributionFillEqually;
|
||
_bottomStackView.alignment = UIStackViewAlignmentFill;
|
||
_bottomStackView.spacing = 25;
|
||
}
|
||
return _bottomStackView;
|
||
}
|
||
|
||
- (UIButton *)chatButton {
|
||
if (!_chatButton) {
|
||
_chatButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[_chatButton setTitle:YMLocalizedString(@"XPMineUserInfoViewController8") forState:UIControlStateNormal];
|
||
[_chatButton setTitleColor:UIColorFromRGB(0x9168FA) forState:UIControlStateNormal];
|
||
|
||
_chatButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||
[_chatButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xCCF8F9),UIColorFromRGB(0xDEE4FF),UIColorFromRGB(0xEEDCFF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||
UIImage *lineImage = [UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor],[DJDKMIMOMColor confirmButtonGradientMiddleColor],[DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake((KScreenWidth - 30 - 25) / 2, 45)];
|
||
UIColor *lineColor = [UIColor colorWithPatternImage:lineImage];
|
||
_chatButton.layer.borderWidth = 1;
|
||
_chatButton.layer.borderColor = lineColor.CGColor;
|
||
_chatButton.layer.masksToBounds = YES;
|
||
_chatButton.layer.cornerRadius = 45/2;
|
||
[_chatButton addTarget:self action:@selector(chatButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||
}
|
||
return _chatButton;
|
||
}
|
||
|
||
- (UIButton *)attentionButton {
|
||
if (!_attentionButton) {
|
||
_attentionButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[_attentionButton setTitle:YMLocalizedString(@"XPMineUserInfoViewController9") forState:UIControlStateNormal];
|
||
[_attentionButton setTitle:YMLocalizedString(@"XPMineUserInfoViewController10") forState:UIControlStateSelected];
|
||
[_attentionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||
[_attentionButton setTitleColor:UIColorFromRGB(0xB3B3C3) forState:UIControlStateSelected];
|
||
_attentionButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||
[_attentionButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor],[DJDKMIMOMColor confirmButtonGradientMiddleColor],[DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||
[_attentionButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xE6E6F0),UIColorFromRGB(0xE6E6F0),UIColorFromRGB(0xE6E6F0)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateSelected];
|
||
_attentionButton.layer.masksToBounds = YES;
|
||
_attentionButton.layer.cornerRadius = 45/2;
|
||
[_attentionButton addTarget:self action:@selector(attentionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||
}
|
||
return _attentionButton;
|
||
}
|
||
|
||
- (JXCategoryTitleView *)titleView {
|
||
if (!_titleView) {
|
||
_titleView = [[JXCategoryTitleView alloc] init];
|
||
_titleView.delegate = self;
|
||
_titleView.backgroundColor = [UIColor clearColor];
|
||
_titleView.titleColor = UIColorFromRGB(0x6D6B89);
|
||
_titleView.titleSelectedColor = UIColorFromRGB(0x1F1A4E);
|
||
_titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
|
||
_titleView.titleSelectedFont = [UIFont boldSystemFontOfSize:18];
|
||
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
||
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
||
_titleView.defaultSelectedIndex = 0;
|
||
_titleView.averageCellSpacingEnabled = NO;
|
||
_titleView.contentEdgeInsetLeft = 20;
|
||
_titleView.titles = self.titles;
|
||
_titleView.cellSpacing = 20;
|
||
_titleView.titles = self.titles;
|
||
_titleView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
|
||
|
||
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
|
||
lineView.indicatorImageViewSize = CGSizeMake(37, 8);
|
||
lineView.verticalMargin = 15;
|
||
lineView.indicatorImageView.layer.masksToBounds = YES;
|
||
lineView.indicatorImageView.layer.cornerRadius = 3;
|
||
lineView.indicatorImageView.image = [UIImage imageNamed:@"mine_dynamic"];
|
||
_titleView.indicators = @[lineView];
|
||
}
|
||
return _titleView;
|
||
}
|
||
|
||
- (JXPagerView *)pagingView {
|
||
if (!_pagingView) {
|
||
_pagingView = [[JXPagerView alloc] initWithDelegate:self];
|
||
_pagingView.backgroundColor = [UIColor clearColor];
|
||
_pagingView.listContainerView.backgroundColor = [UIColor clearColor];
|
||
_pagingView.mainTableView.backgroundColor = [UIColor clearColor];
|
||
_pagingView.listContainerView.listCellBackgroundColor = UIColor.clearColor;
|
||
_pagingView.mainTableView.gestureDelegate = self;
|
||
}
|
||
return _pagingView;
|
||
}
|
||
|
||
- (NSArray<NSString *> *)titles {
|
||
if (!_titles) {
|
||
_titles = @[YMLocalizedString(@"XPMineUserInfoViewController11"),YMLocalizedString(@"XPMineUserInfoViewController13")];
|
||
}
|
||
return _titles;
|
||
}
|
||
|
||
- (XPMineUserDataViewController *)userDataVC {
|
||
if (!_userDataVC) {
|
||
_userDataVC = [[XPMineUserDataViewController alloc] init];
|
||
_userDataVC.delegate = self;
|
||
}
|
||
return _userDataVC;
|
||
}
|
||
- (XPMineUserInfoVoiceCardView *)voiceView {
|
||
if (!_voiceView) {
|
||
_voiceView = [[XPMineUserInfoVoiceCardView alloc] init];
|
||
_voiceView.hidden = YES;
|
||
}
|
||
return _voiceView;
|
||
}
|
||
|
||
|
||
-(XPGiftUserDataViewController *)giftVC{
|
||
if (!_giftVC){
|
||
_giftVC = [XPGiftUserDataViewController new];
|
||
}
|
||
return _giftVC;
|
||
}
|
||
- (XPMineUserInfoEditViewController *)editVC{
|
||
if (!_editVC){
|
||
_editVC = [XPMineUserInfoEditViewController new];
|
||
_editVC.delegate = self;
|
||
}
|
||
return _editVC;
|
||
}
|
||
- (CountDownHelper *)countDownHelper{
|
||
if (!_countDownHelper){
|
||
_countDownHelper = [[CountDownHelper alloc]init];
|
||
}
|
||
return _countDownHelper;
|
||
}
|
||
@end
|