CNLiveCompleteInfoController.m
3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
// CNLiveCompleteInfoController.m
// CNLiveLoginModule
//
// Created by 153993236@qq.com on 11/12/2019.
// Copyright (c) 2019 153993236@qq.com. All rights reserved.
//
#import "CNLiveCompleteInfoController.h"
#import "MJExtension.h"
#import "QMUIKit.h"
#import "YYKit.h"
#import "CNLiveNavigationBar.h"
#import "CNLiveCategory.h"
#import "CNUserInfoManager.h"
#import "CNLiveEnvironment.h"
#import "CNLiveManager.h"
#import "CNLiveCompleteInfoView.h"
#import "CNLiveLoginRequest.h"
@interface CNLiveCompleteInfoController()<CNLiveCompleteInfoViewDelegate>
@property (nonatomic, strong) CNLiveCompleteInfoView *infoView;
@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
@end
@implementation CNLiveCompleteInfoController
#pragma mark - 生命周期
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.automaticallyAdjustsScrollViewInsets = NO;
self.view.backgroundColor = [UIColor whiteColor];
[self createUI];
}
- (void)createUI{
[self.view addSubview:self.navigationBar];
[self.view addSubview:self.infoView];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES];
}
#pragma mark - CNLiveCompleteInfoViewDelegate
- (void)loginSuccess:(CNLiveCompleteInfoView *)view result:(id _Nonnull)result{
// 进入tabbar
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
#pragma mark - 懒加载
- (CNLiveNavigationBar *)navigationBar {
if (!_navigationBar) {
_navigationBar = [CNLiveNavigationBar navigationBar];
_navigationBar.backgroundColor = [UIColor whiteColor];
_navigationBar.title.text = @"完善信息";
__weak typeof(self) weakSelf = self;
_navigationBar.onClickLeftButton = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
_navigationBar.right = nil;
}
return _navigationBar;
}
- (CNLiveCompleteInfoView *)infoView{
if(!_infoView){
_infoView = [[CNLiveCompleteInfoView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/8.0, NavigationContentTop+40, self.view.frame.size.width*3/4.0, 250)];
_infoView.center = CGPointMake(self.view.center.x, self.view.center.y-50);
_infoView.delegate = self;
}
return _infoView;
}
#pragma mark - 连接IM
- (void)connectionIM:(id)result{
NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:result[@"data"]];
NSString *faceUrl = [dic objectForKey:@"faceUrl"];
if ([faceUrl containsString:@"/mobile/images/mobilehead/default/"]) {
//网家家默认头像地址
[dic setValue:CNLiveNetAddDefaultHead forKey:@"faceUrl"];
}
[CNUserInfoManager saveUserinfoDic:dic];
// 连接IM
__weak typeof(self) weakSelf = self;
[[CNLiveLoginRequest manager] loginTIM:CNUserShareModel.uid success:^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if(!strongSelf) return;
// 进入tabbar
[CNLiveNotificationManager postNotificationName:CNLiveLoginSuccess object:nil];
} failed:^(int code, NSString * _Nonnull msg) {
// 错误逻辑
__strong typeof(weakSelf) strongSelf = weakSelf;
if(!strongSelf) return;
}];
}
@end