Commit f6aba4960ba0e757f792acbffa706f95f77bc8ad
1 parent
5c37b3b8
no message
Showing
14 changed files
with
329 additions
and
136 deletions
CNLiveMineModule.podspec
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_update_select.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "mine_update_select@2x.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "filename" : "mine_update_select@3x.png", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "version" : 1, | |
| 20 | + "author" : "xcode" | |
| 21 | + } | |
| 22 | +} | |
| 0 | 23 | \ No newline at end of file | ... | ... |
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_update_select.imageset/mine_update_select@2x.png
0 → 100644
330 Bytes
CNLiveMineModule/Assets/CNLiveMineModule.xcassets/mine_update_select.imageset/mine_update_select@3x.png
0 → 100644
700 Bytes
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateCell.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveInfoUpdateCell.m | |
| 3 | +// CNLiveMineModule | |
| 4 | +// | |
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | +static NSString * const kCNLiveInfoUpdateCell = @"CNLiveInfoUpdateCell"; | |
| 13 | + | |
| 14 | +@interface CNLiveInfoUpdateCell : UITableViewCell | |
| 15 | +@property (nonatomic, copy) NSString *text; | |
| 16 | +@property (nonatomic, assign) BOOL isShow; | |
| 17 | + | |
| 18 | +@end | |
| 19 | + | |
| 20 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateCell.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveInfoUpdateCell.m | |
| 3 | +// CNLiveMineModule | |
| 4 | +// | |
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveInfoUpdateCell.h" | |
| 10 | +#import <Masonry/Masonry.h> | |
| 11 | +#import <SDWebImage/SDWebImage.h> | |
| 12 | +#import "CNLiveUserInfoModel.h" | |
| 13 | + | |
| 14 | +@interface CNLiveInfoUpdateCell() | |
| 15 | +@property (nonatomic, strong) UIView *line; | |
| 16 | +@property (nonatomic, strong) UILabel *title; | |
| 17 | + | |
| 18 | +@property (nonatomic, strong) UIImageView *pic; | |
| 19 | + | |
| 20 | +@end | |
| 21 | + | |
| 22 | +@implementation CNLiveInfoUpdateCell | |
| 23 | +static const NSInteger margin = 12; | |
| 24 | + | |
| 25 | +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | |
| 26 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
| 27 | + if (self) { | |
| 28 | + self.contentView.backgroundColor = [UIColor whiteColor]; | |
| 29 | + | |
| 30 | + [self.contentView addSubview:self.title]; | |
| 31 | + [self.contentView addSubview:self.pic]; | |
| 32 | + [self.contentView addSubview:self.line]; | |
| 33 | + | |
| 34 | + [self xw_layoutSubviews]; | |
| 35 | + | |
| 36 | + } | |
| 37 | + return self; | |
| 38 | +} | |
| 39 | + | |
| 40 | +- (void)xw_layoutSubviews{ | |
| 41 | + | |
| 42 | + [_title mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 43 | + make.left.equalTo(self.contentView.mas_left).with.offset(margin); | |
| 44 | + make.top.equalTo(self.contentView.mas_top).with.offset(0); | |
| 45 | + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0); | |
| 46 | + | |
| 47 | + }]; | |
| 48 | + | |
| 49 | + [_pic mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 50 | + make.right.equalTo(self.contentView.mas_right).with.offset(-margin); | |
| 51 | + make.top.equalTo(self.contentView.mas_top).with.offset(0); | |
| 52 | + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0); | |
| 53 | + | |
| 54 | + }]; | |
| 55 | + | |
| 56 | + [_line mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 57 | + make.left.equalTo(self.contentView.mas_left).with.offset(0); | |
| 58 | + make.right.equalTo(self.contentView.mas_right).with.offset(-0); | |
| 59 | + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0); | |
| 60 | + make.height.offset(0.5); | |
| 61 | + | |
| 62 | + }]; | |
| 63 | + | |
| 64 | + | |
| 65 | +} | |
| 66 | + | |
| 67 | +- (void)setText:(NSString *)text{ | |
| 68 | + _text = text; | |
| 69 | + _title.text = text; | |
| 70 | +} | |
| 71 | + | |
| 72 | +- (void)setIsShow:(BOOL)isShow{ | |
| 73 | + _isShow = isShow; | |
| 74 | + _pic.hidden = !isShow; | |
| 75 | +} | |
| 76 | + | |
| 77 | +- (void)awakeFromNib { | |
| 78 | + [super awakeFromNib]; | |
| 79 | + // Initialization code | |
| 80 | +} | |
| 81 | + | |
| 82 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | |
| 83 | + [super setSelected:selected animated:animated]; | |
| 84 | + | |
| 85 | + // Configure the view for the selected state | |
| 86 | +} | |
| 87 | +#pragma mark - 懒加载 | |
| 88 | +- (UIView *)line { | |
| 89 | + if (!_line) { | |
| 90 | + _line = [[UIView alloc] init]; | |
| 91 | + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0]; | |
| 92 | + } | |
| 93 | + return _line; | |
| 94 | +} | |
| 95 | + | |
| 96 | +- (UILabel *)title { | |
| 97 | + if (!_title) { | |
| 98 | + _title = [[UILabel alloc] init]; | |
| 99 | + _title.numberOfLines = 1; | |
| 100 | + _title.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]; | |
| 101 | + _title.font = [UIFont systemFontOfSize:16]; | |
| 102 | + } | |
| 103 | + return _title; | |
| 104 | +} | |
| 105 | + | |
| 106 | + | |
| 107 | +- (UIImageView *)pic { | |
| 108 | + if (!_pic) { | |
| 109 | + _pic = [[UIImageView alloc] init]; | |
| 110 | + UIImage *xw_image = [self xw_getImageName:@"mine_update_select" bundleName:@"CNLiveMineModule" targetClass:[self class]]; | |
| 111 | + _pic.image = xw_image; | |
| 112 | + _pic.hidden = YES; | |
| 113 | + _pic.contentMode = UIViewContentModeCenter; | |
| 114 | + | |
| 115 | + } | |
| 116 | + return _pic; | |
| 117 | +} | |
| 118 | + | |
| 119 | + | |
| 120 | +/** | |
| 121 | + * 创建图片 | |
| 122 | + * | |
| 123 | + * @param imageName 图片名字 | |
| 124 | + * @param bundleName 图片所在的bundle名字 | |
| 125 | + * @param targetClass 类和bundle的同级目录 | |
| 126 | + * @return 返回UIImage | |
| 127 | + */ | |
| 128 | +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 129 | + NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 130 | + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 131 | + NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 132 | + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 133 | + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 134 | +} | |
| 135 | + | |
| 136 | +@end | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m
| ... | ... | @@ -21,6 +21,9 @@ |
| 21 | 21 | #import "NSString+CNLiveExtension.h" |
| 22 | 22 | #import "NSDictionary+Safety.h" |
| 23 | 23 | #import "UIImage+Common.h" |
| 24 | +#import "CNLiveManager.h" | |
| 25 | +#import "TIMAdapter.h" | |
| 26 | +#import "CommonLibrary.h" | |
| 24 | 27 | |
| 25 | 28 | #import "CNLiveAddScoreManager.h" |
| 26 | 29 | #import "CNLiveGoldWhereaboutsView.h" |
| ... | ... | @@ -29,7 +32,9 @@ |
| 29 | 32 | #import "CNLiveUserInfoNotification.h" |
| 30 | 33 | #import "CNLiveUserInfoNavigationBar.h" |
| 31 | 34 | |
| 32 | -@interface CNLiveInfoUpdateController ()<UITextFieldDelegate,UITextViewDelegate,CNLiveUserInfoNavigationBarDelegate,QMUIAlertControllerDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate>{ | |
| 35 | +#import "CNLiveInfoUpdateCell.h" | |
| 36 | + | |
| 37 | +@interface CNLiveInfoUpdateController ()<UITextFieldDelegate,UITextViewDelegate,CNLiveUserInfoNavigationBarDelegate,QMUIAlertControllerDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate,UITableViewDelegate,UITableViewDataSource>{ | |
| 33 | 38 | UIImage *_image; |
| 34 | 39 | } |
| 35 | 40 | @property (nonatomic, strong) CNLiveUserInfoNavigationBar *navigationBar; |
| ... | ... | @@ -42,6 +47,10 @@ |
| 42 | 47 | @property (nonatomic, strong) UITextView *textView; |
| 43 | 48 | @property (nonatomic, strong) UILabel *textNum; |
| 44 | 49 | |
| 50 | +// 性别 | |
| 51 | +@property (nonatomic, strong) UITableView *tableView; | |
| 52 | +@property (nonatomic, strong) NSString *gender; | |
| 53 | + | |
| 45 | 54 | @end |
| 46 | 55 | |
| 47 | 56 | @implementation CNLiveInfoUpdateController |
| ... | ... | @@ -58,6 +67,7 @@ static const CGFloat timeValue = 1.5; |
| 58 | 67 | self = [super init]; |
| 59 | 68 | if (self) { |
| 60 | 69 | self.model = model; |
| 70 | + self.gender = CNUserShareModel.gender; | |
| 61 | 71 | } |
| 62 | 72 | return self; |
| 63 | 73 | } |
| ... | ... | @@ -213,7 +223,47 @@ static const CGFloat timeValue = 1.5; |
| 213 | 223 | - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { |
| 214 | 224 | [self.view endEditing:YES]; |
| 215 | 225 | } |
| 226 | +#pragma mark - UITableViewDataSource | |
| 227 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
| 228 | + return 2; | |
| 229 | +} | |
| 230 | + | |
| 231 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| 232 | + NSArray *data = @[@"男", @"女"]; | |
| 233 | + CNLiveInfoUpdateCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveInfoUpdateCell forIndexPath:indexPath]; | |
| 234 | + cell.text = data[indexPath.row]; | |
| 235 | + if(indexPath.row == 0){ | |
| 236 | + cell.isShow = [CNUserShareModel.gender isEqualToString:@"m"]; | |
| 237 | + }else if (indexPath.row == 1){ | |
| 238 | + cell.isShow = [CNUserShareModel.gender isEqualToString:@"f"]; | |
| 239 | + } | |
| 240 | + return cell; | |
| 241 | +} | |
| 242 | + | |
| 243 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| 244 | + return 50.0; | |
| 245 | +} | |
| 246 | + | |
| 247 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
| 248 | + [self.tableView qmui_clearsSelection]; | |
| 249 | + | |
| 250 | + self.navigationBar.right.userInteractionEnabled = YES; | |
| 251 | + self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0]; | |
| 216 | 252 | |
| 253 | + CNLiveInfoUpdateCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | |
| 254 | + NSArray *visibleCells = [self.tableView visibleCells]; | |
| 255 | + for (CNLiveInfoUpdateCell *visibleCell in visibleCells) { | |
| 256 | + visibleCell.isShow = NO; | |
| 257 | + } | |
| 258 | + cell.isShow = YES; | |
| 259 | + | |
| 260 | + if(indexPath.row == 0){ | |
| 261 | + self.gender = @"m"; | |
| 262 | + }else if(indexPath.row == 1){ | |
| 263 | + self.gender = @"f"; | |
| 264 | + } | |
| 265 | + | |
| 266 | +} | |
| 217 | 267 | #pragma mark - CNLiveUserInfoNavigationBarDelegate |
| 218 | 268 | - (void)navigationBar:(CNLiveUserInfoNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ |
| 219 | 269 | if ([actionEvents isEqualToString:@"1"]) { |
| ... | ... | @@ -233,6 +283,11 @@ static const CGFloat timeValue = 1.5; |
| 233 | 283 | [self requestUpdateUserNickname]; |
| 234 | 284 | } |
| 235 | 285 | break; |
| 286 | + case CNLiveUserInfoDataTypeGender://昵称 | |
| 287 | + { | |
| 288 | + [self requestUpdateUserGender]; | |
| 289 | + } | |
| 290 | + break; | |
| 236 | 291 | case CNLiveUserInfoDataTypeAddress://地区 |
| 237 | 292 | { |
| 238 | 293 | [self requestUpdateUserAddress]; |
| ... | ... | @@ -264,7 +319,7 @@ static const CGFloat timeValue = 1.5; |
| 264 | 319 | if(!strongSelf) return ; |
| 265 | 320 | strongSelf.navigationBar.right.userInteractionEnabled = YES; |
| 266 | 321 | __strong typeof(strongSelf) weakSelf = strongSelf; |
| 267 | - [strongSelf getAVAuthorizationStatus:^{ | |
| 322 | + [CNLiveAuthorizationManager getAVAuthorizationStatus:^{ | |
| 268 | 323 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 269 | 324 | if(!strongSelf) return ; |
| 270 | 325 | XFCameraController *cameraController = [[XFCameraController alloc] init]; |
| ... | ... | @@ -291,7 +346,7 @@ static const CGFloat timeValue = 1.5; |
| 291 | 346 | if(!strongSelf) return ; |
| 292 | 347 | strongSelf.navigationBar.right.userInteractionEnabled = YES; |
| 293 | 348 | __strong typeof(strongSelf) weakSelf = strongSelf; |
| 294 | - [strongSelf getPHAuthorizationStatus:^{ | |
| 349 | + [CNLiveAuthorizationManager getPHAuthorizationStatus:^{ | |
| 295 | 350 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 296 | 351 | if(!strongSelf) return ; |
| 297 | 352 | TZImagePickerController *picker = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:strongSelf]; |
| ... | ... | @@ -312,7 +367,7 @@ static const CGFloat timeValue = 1.5; |
| 312 | 367 | QMUIAlertAction *action3 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { |
| 313 | 368 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 314 | 369 | if(!strongSelf) return ; |
| 315 | - [strongSelf getPHAuthorizationStatus:^{ | |
| 370 | + [CNLiveAuthorizationManager getPHAuthorizationStatus:^{ | |
| 316 | 371 | UIImage *image = [strongSelf generateImage:strongSelf.imageView]; |
| 317 | 372 | [QMUITips showLoadingInView:strongSelf.view]; |
| 318 | 373 | [strongSelf saveImage:image]; |
| ... | ... | @@ -359,7 +414,7 @@ static const CGFloat timeValue = 1.5; |
| 359 | 414 | [QMUITips showLoading:@"修改中" inView:self.view]; |
| 360 | 415 | |
| 361 | 416 | [CNLiveUserSystemCenter uploadIconWithUid:CNUserShareModel.uid icon:image compressionQuality:0.99 success:^(id result) { |
| 362 | -// [[IMAPlatform sharedInstance].host asyncProfile]; | |
| 417 | + [[IMAPlatform sharedInstance].host asyncProfile]; | |
| 363 | 418 | [QMUITips hideAllToastInView:self.view animated:YES]; |
| 364 | 419 | CNUserShareModel.faceUrl = result[@"data"][@"faceUrl"]; |
| 365 | 420 | CNUserShareModel.bigFaceUrl = result[@"data"][@"bigFaceUrl"]; |
| ... | ... | @@ -390,93 +445,6 @@ static const CGFloat timeValue = 1.5; |
| 390 | 445 | return newImage; |
| 391 | 446 | } |
| 392 | 447 | |
| 393 | -- (void)getAVAuthorizationStatus:(void (^)(void))block{ | |
| 394 | - AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; | |
| 395 | - if (device) { | |
| 396 | - AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; | |
| 397 | - switch (status) { | |
| 398 | - case AVAuthorizationStatusNotDetermined: { | |
| 399 | - [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { | |
| 400 | - if (granted) { | |
| 401 | - dispatch_sync(dispatch_get_main_queue(), ^{ | |
| 402 | - block(); | |
| 403 | - }); | |
| 404 | - NSLog(@"用户第一次同意了访问相机权限 - - %@", [NSThread currentThread]); | |
| 405 | - } else { | |
| 406 | - NSLog(@"用户第一次拒绝了访问相机权限 - - %@", [NSThread currentThread]); | |
| 407 | - } | |
| 408 | - }]; | |
| 409 | - break; | |
| 410 | - } | |
| 411 | - case AVAuthorizationStatusAuthorized: { | |
| 412 | - block(); | |
| 413 | - break; | |
| 414 | - } | |
| 415 | - case AVAuthorizationStatusDenied: { | |
| 416 | - NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; | |
| 417 | - NSString *app_Name = [infoDict objectForKey:@"CFBundleDisplayName"]; | |
| 418 | - if (app_Name == nil) { | |
| 419 | - app_Name = [infoDict objectForKey:@"CFBundleName"]; | |
| 420 | - } | |
| 421 | - NSString *messageString = [NSString stringWithFormat:@"请在iPhone的\"设置 - 隐私 - 相机\"选项中,允许%@访问你的相机", app_Name]; | |
| 422 | - UIAlertController *alertC = [UIAlertController alertControllerWithTitle:nil message:messageString preferredStyle:(UIAlertControllerStyleAlert)]; | |
| 423 | - UIAlertAction *alertA = [UIAlertAction actionWithTitle:@"好" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { | |
| 424 | - | |
| 425 | - }]; | |
| 426 | - | |
| 427 | - [alertC addAction:alertA]; | |
| 428 | - [self presentViewController:alertC animated:YES completion:nil]; | |
| 429 | - break; | |
| 430 | - } | |
| 431 | - case AVAuthorizationStatusRestricted: { | |
| 432 | - NSLog(@"因为系统原因, 无法访问相册"); | |
| 433 | - break; | |
| 434 | - } | |
| 435 | - | |
| 436 | - default: | |
| 437 | - break; | |
| 438 | - } | |
| 439 | - return; | |
| 440 | - } | |
| 441 | - [QMUITips showError:@"未检测到您的摄像头" inView:self.view hideAfterDelay:timeValue]; | |
| 442 | -} | |
| 443 | - | |
| 444 | -- (void)getPHAuthorizationStatus:(void (^)(void))block{ | |
| 445 | - // 1.获取当前App的相册授权状态 | |
| 446 | - PHAuthorizationStatus authorizationStatus = [PHPhotoLibrary authorizationStatus]; | |
| 447 | - | |
| 448 | - // 2.判断授权状态 | |
| 449 | - if (authorizationStatus == PHAuthorizationStatusAuthorized) { | |
| 450 | - // 2.1 如果已经授权, 保存图片(调用步骤2的方法) | |
| 451 | - block(); | |
| 452 | - | |
| 453 | - } else if (authorizationStatus == PHAuthorizationStatusNotDetermined) { // 如果没决定, 弹出指示框, 让用户选择 | |
| 454 | - [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { | |
| 455 | - // 如果用户选择授权, 则保存图片 | |
| 456 | - if (status == PHAuthorizationStatusAuthorized) { | |
| 457 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 458 | - block(); | |
| 459 | - }); | |
| 460 | - } | |
| 461 | - }]; | |
| 462 | - | |
| 463 | - } else { | |
| 464 | - NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; | |
| 465 | - NSString *app_Name = [infoDict objectForKey:@"CFBundleDisplayName"]; | |
| 466 | - if (app_Name == nil) { | |
| 467 | - app_Name = [infoDict objectForKey:@"CFBundleName"]; | |
| 468 | - } | |
| 469 | - NSString *messageString = [NSString stringWithFormat:@"请在iPhone的\"设置 - 隐私 - 相机\"选项中,允许%@访问你的相册", app_Name]; | |
| 470 | - UIAlertController *alertC = [UIAlertController alertControllerWithTitle:nil message:messageString preferredStyle:(UIAlertControllerStyleAlert)]; | |
| 471 | - UIAlertAction *alertA = [UIAlertAction actionWithTitle:@"好" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { | |
| 472 | - | |
| 473 | - }]; | |
| 474 | - | |
| 475 | - [alertC addAction:alertA]; | |
| 476 | - [self presentViewController:alertC animated:YES completion:nil]; | |
| 477 | - } | |
| 478 | -} | |
| 479 | - | |
| 480 | 448 | // 保存图片 |
| 481 | 449 | - (void)saveImage:(UIImage *)image{ |
| 482 | 450 | if(!image){ |
| ... | ... | @@ -497,6 +465,7 @@ static const CGFloat timeValue = 1.5; |
| 497 | 465 | |
| 498 | 466 | }]; |
| 499 | 467 | } |
| 468 | + | |
| 500 | 469 | // UIView转UIImage |
| 501 | 470 | - (UIImage *)generateImage:(UIView *)view{ |
| 502 | 471 | // 1.开启上下文 |
| ... | ... | @@ -527,7 +496,6 @@ static const CGFloat timeValue = 1.5; |
| 527 | 496 | |
| 528 | 497 | [QMUITips showLoading:@"修改中" inView:self.view]; |
| 529 | 498 | [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeNickName uid:CNUserShareModel.uid modifyInfo:text success:^(id result) { |
| 530 | -// [[IMAPlatform sharedInstance].host asyncProfile]; | |
| 531 | 499 | CNUserShareModel.nickname = self.textField.text; |
| 532 | 500 | [self showSucceed:@"修改成功"]; |
| 533 | 501 | |
| ... | ... | @@ -545,6 +513,25 @@ static const CGFloat timeValue = 1.5; |
| 545 | 513 | |
| 546 | 514 | } |
| 547 | 515 | |
| 516 | +#pragma mark - 更新性别 | |
| 517 | +- (void)requestUpdateUserGender{ | |
| 518 | + if ([self.gender isEqualToString:CNUserShareModel.gender]) { | |
| 519 | + self.navigationBar.right.userInteractionEnabled = YES; | |
| 520 | + [self goBack]; | |
| 521 | + return; | |
| 522 | + } | |
| 523 | + [QMUITips showLoading:@"修改中" inView:self.view]; | |
| 524 | + [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeGender uid:CNUserShareModel.uid modifyInfo:self.gender success:^(id result) { | |
| 525 | + CNUserShareModel.gender = self.gender; | |
| 526 | + [self showSucceed:@"修改成功"]; | |
| 527 | + | |
| 528 | + } failure:^(NSDictionary *errorDic) { | |
| 529 | + [self showError:errorDic[@"errorMessage"]]; | |
| 530 | + | |
| 531 | + }]; | |
| 532 | + | |
| 533 | +} | |
| 534 | + | |
| 548 | 535 | #pragma mark - 更新地区 |
| 549 | 536 | - (void)requestUpdateUserAddress{ |
| 550 | 537 | NSString *text = [self.textField.text trim]; |
| ... | ... | @@ -605,6 +592,7 @@ static const CGFloat timeValue = 1.5; |
| 605 | 592 | |
| 606 | 593 | #pragma mark - 更新提示 |
| 607 | 594 | - (void)showSucceed:(NSString *)text{ |
| 595 | + [[IMAPlatform sharedInstance].host asyncProfile]; | |
| 608 | 596 | [QMUITips hideAllToastInView:self.view animated:YES]; |
| 609 | 597 | self.navigationBar.right.userInteractionEnabled = YES; |
| 610 | 598 | [QMUITips showSucceed:text inView:self.view]; |
| ... | ... | @@ -626,28 +614,28 @@ static const CGFloat timeValue = 1.5; |
| 626 | 614 | _navigationBar.backgroundColor = [UIColor whiteColor]; |
| 627 | 615 | _navigationBar.delegate = self; |
| 628 | 616 | switch (self.model.dataType) { |
| 629 | - case CNLiveUserInfoDataTypeHead: | |
| 630 | - { | |
| 631 | - UIImage *xw_image = [self xw_getImageName:@"mine_info_set" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; | |
| 632 | - [_navigationBar.right setImage:xw_image forState:UIControlStateNormal]; | |
| 633 | - } | |
| 634 | - break; | |
| 635 | - default: | |
| 636 | - { | |
| 637 | - _navigationBar.right.frame = CGRectMake(SCREEN_WIDTH-45-15, StatusBarHeight+10, 45, 24); | |
| 638 | - [_navigationBar.right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter]; | |
| 639 | - _navigationBar.right.backgroundColor = [UIColor lightGrayColor]; | |
| 640 | - _navigationBar.right.userInteractionEnabled = NO; | |
| 641 | - _navigationBar.right.titleLabel.font = [UIFont boldSystemFontOfSize:13]; | |
| 642 | - [_navigationBar.right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | |
| 643 | - [_navigationBar.right setTitle:@"完成" forState:UIControlStateNormal]; | |
| 644 | - _navigationBar.right.adjustsImageWhenHighlighted = NO; | |
| 645 | - _navigationBar.right.layer.masksToBounds = YES; | |
| 646 | - _navigationBar.right.layer.cornerRadius = 5; | |
| 647 | - } | |
| 648 | - break; | |
| 649 | - | |
| 650 | - } | |
| 617 | + case CNLiveUserInfoDataTypeHead: | |
| 618 | + { | |
| 619 | + UIImage *xw_image = [self xw_getImageName:@"mine_info_set" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; | |
| 620 | + [_navigationBar.right setImage:xw_image forState:UIControlStateNormal]; | |
| 621 | + } | |
| 622 | + break; | |
| 623 | + default: | |
| 624 | + { | |
| 625 | + _navigationBar.right.frame = CGRectMake(SCREEN_WIDTH-45-15, StatusBarHeight+10, 45, 24); | |
| 626 | + [_navigationBar.right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter]; | |
| 627 | + _navigationBar.right.backgroundColor = [UIColor lightGrayColor]; | |
| 628 | + _navigationBar.right.userInteractionEnabled = NO; | |
| 629 | + _navigationBar.right.titleLabel.font = [UIFont boldSystemFontOfSize:13]; | |
| 630 | + [_navigationBar.right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | |
| 631 | + [_navigationBar.right setTitle:@"完成" forState:UIControlStateNormal]; | |
| 632 | + _navigationBar.right.adjustsImageWhenHighlighted = NO; | |
| 633 | + _navigationBar.right.layer.masksToBounds = YES; | |
| 634 | + _navigationBar.right.layer.cornerRadius = 5; | |
| 635 | + | |
| 636 | + } | |
| 637 | + break; | |
| 638 | + } | |
| 651 | 639 | } |
| 652 | 640 | return _navigationBar; |
| 653 | 641 | } |
| ... | ... | @@ -687,6 +675,16 @@ static const CGFloat timeValue = 1.5; |
| 687 | 675 | self.textField.text = self.model.content; |
| 688 | 676 | } |
| 689 | 677 | break; |
| 678 | + case CNLiveUserInfoDataTypeGender: | |
| 679 | + { | |
| 680 | + self.navigationBar.title.text = @"设置性别"; | |
| 681 | + [self.navigationBar.left setTitle:@"取消" forState:UIControlStateNormal]; | |
| 682 | + [self.navigationBar.left setTitleColor:[UIColor colorWithRed:30/255.0 green:30/255.0 blue:30/255.0 alpha:1.0] forState:UIControlStateNormal]; | |
| 683 | + [self.navigationBar.left setImage:nil forState:UIControlStateNormal]; | |
| 684 | + _contentView.frame = CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 100); | |
| 685 | + [_contentView addSubview:self.tableView]; | |
| 686 | + } | |
| 687 | + break; | |
| 690 | 688 | case CNLiveUserInfoDataTypeIntroduction: |
| 691 | 689 | { |
| 692 | 690 | self.navigationBar.title.text = @"设置个性签名"; |
| ... | ... | @@ -694,7 +692,7 @@ static const CGFloat timeValue = 1.5; |
| 694 | 692 | _contentView.frame = CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 120); |
| 695 | 693 | [_contentView addSubview:self.textView]; |
| 696 | 694 | self.textView.text = self.model.content; |
| 697 | - self.textNum.text = [NSString stringWithFormat:@"%ld",MAX(0,MAX_LIMIT_NUMS - self.textView.text.length)]; | |
| 695 | + self.textNum.text = [NSString stringWithFormat:@"%lu",MAX(0,MAX_LIMIT_NUMS - self.textView.text.length)]; | |
| 698 | 696 | |
| 699 | 697 | [_contentView addSubview:self.textNum]; |
| 700 | 698 | [self.textNum mas_makeConstraints:^(MASConstraintMaker *make) { |
| ... | ... | @@ -766,6 +764,20 @@ static const CGFloat timeValue = 1.5; |
| 766 | 764 | return _textNum; |
| 767 | 765 | } |
| 768 | 766 | |
| 767 | +- (UITableView *)tableView { | |
| 768 | + if (!_tableView) { | |
| 769 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100) style:UITableViewStylePlain]; | |
| 770 | + _tableView.delegate = self; | |
| 771 | + _tableView.dataSource = self; | |
| 772 | + _tableView.showsVerticalScrollIndicator = NO; | |
| 773 | + _tableView.showsHorizontalScrollIndicator = NO; | |
| 774 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 775 | + [_tableView registerClass:[CNLiveInfoUpdateCell class] forCellReuseIdentifier:kCNLiveInfoUpdateCell]; | |
| 776 | + _tableView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; | |
| 777 | + } | |
| 778 | + return _tableView; | |
| 779 | +} | |
| 780 | + | |
| 769 | 781 | #pragma mark - 响应方法 |
| 770 | 782 | - (void)goBack { |
| 771 | 783 | [self.textField resignFirstResponder]; | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.h
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.m
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoController.m
| ... | ... | @@ -160,7 +160,9 @@ |
| 160 | 160 | break; |
| 161 | 161 | case CNLiveUserInfoDataTypeGender: |
| 162 | 162 | { |
| 163 | - [self updateGenderActionSheetView]; | |
| 163 | + CNLiveInfoUpdateController *vc = [[CNLiveInfoUpdateController alloc]initWithModel:model]; | |
| 164 | + vc.delegate = self; | |
| 165 | + [self.navigationController pushViewController:vc animated:YES]; | |
| 164 | 166 | } |
| 165 | 167 | break; |
| 166 | 168 | case CNLiveUserInfoDataTypeCode: |
| ... | ... | @@ -210,19 +212,6 @@ |
| 210 | 212 | [self goBack]; |
| 211 | 213 | } |
| 212 | 214 | } |
| 213 | -#pragma mark - 私有方法 | |
| 214 | -// 修改性别 | |
| 215 | -- (void)updateGenderActionSheetView{ | |
| 216 | - __weak typeof(self) weakSelf = self; | |
| 217 | - | |
| 218 | -} | |
| 219 | - | |
| 220 | -// 更新性别 | |
| 221 | -- (void)requestUpdateUserGender:(NSString *)gender{ | |
| 222 | - // 数据请求更新 | |
| 223 | - | |
| 224 | - | |
| 225 | -} | |
| 226 | 215 | |
| 227 | 216 | #pragma mark - 懒加载 |
| 228 | 217 | - (CNLiveUserInfoNavigationBar *)navigationBar { | ... | ... |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoNavigationBar.m
| ... | ... | @@ -58,6 +58,7 @@ static const NSInteger margin = 15; |
| 58 | 58 | if (!_left) { |
| 59 | 59 | _left= [UIButton buttonWithType:UIButtonTypeCustom]; |
| 60 | 60 | _left.adjustsImageWhenHighlighted = NO; |
| 61 | + _left.titleLabel.font = [UIFont systemFontOfSize:15]; | |
| 61 | 62 | _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); |
| 62 | 63 | UIImage *image = [self xw_getImageName:@"mine_back_black_b" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoNavigationBar class]]; |
| 63 | 64 | [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | ... | ... |
Example/CNLiveMineModule.xcodeproj/project.pbxproj
| ... | ... | @@ -339,6 +339,7 @@ |
| 339 | 339 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", |
| 340 | 340 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", |
| 341 | 341 | "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", |
| 342 | + "${BUILT_PRODUCTS_DIR}/CNLiveCacheManagerKit/CNLiveCacheManagerKit.framework", | |
| 342 | 343 | "${BUILT_PRODUCTS_DIR}/CNLiveChooseCountry/CNLiveChooseCountry.framework", |
| 343 | 344 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", |
| 344 | 345 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", |
| ... | ... | @@ -353,6 +354,7 @@ |
| 353 | 354 | "${BUILT_PRODUCTS_DIR}/CNLiveUploadManager/CNLiveUploadManager.framework", |
| 354 | 355 | "${BUILT_PRODUCTS_DIR}/CNLiveUserAgreementManager/CNLiveUserAgreementManager.framework", |
| 355 | 356 | "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework", |
| 357 | + "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", | |
| 356 | 358 | "${BUILT_PRODUCTS_DIR}/HappyDNS/HappyDNS.framework", |
| 357 | 359 | "${BUILT_PRODUCTS_DIR}/JXCategoryView/JXCategoryView.framework", |
| 358 | 360 | "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework", |
| ... | ... | @@ -363,6 +365,7 @@ |
| 363 | 365 | "${BUILT_PRODUCTS_DIR}/SDAutoLayout/SDAutoLayout.framework", |
| 364 | 366 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", |
| 365 | 367 | "${BUILT_PRODUCTS_DIR}/SGQRCode/SGQRCode.framework", |
| 368 | + "${PODS_ROOT}/TXIMSDK_iOS/ImSDK.framework", | |
| 366 | 369 | "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", |
| 367 | 370 | ); |
| 368 | 371 | name = "[CP] Embed Pods Frameworks"; |
| ... | ... | @@ -373,6 +376,7 @@ |
| 373 | 376 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", |
| 374 | 377 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", |
| 375 | 378 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", |
| 379 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCacheManagerKit.framework", | |
| 376 | 380 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveChooseCountry.framework", |
| 377 | 381 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", |
| 378 | 382 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", |
| ... | ... | @@ -387,6 +391,7 @@ |
| 387 | 391 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUploadManager.framework", |
| 388 | 392 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserAgreementManager.framework", |
| 389 | 393 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework", |
| 394 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework", | |
| 390 | 395 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HappyDNS.framework", |
| 391 | 396 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JXCategoryView.framework", |
| 392 | 397 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework", |
| ... | ... | @@ -397,6 +402,7 @@ |
| 397 | 402 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDAutoLayout.framework", |
| 398 | 403 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", |
| 399 | 404 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SGQRCode.framework", |
| 405 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ImSDK.framework", | |
| 400 | 406 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", |
| 401 | 407 | ); |
| 402 | 408 | runOnlyForDeploymentPostprocessing = 0; |
| ... | ... | @@ -610,10 +616,12 @@ |
| 610 | 616 | baseConfigurationReference = A107C92B1363BA9D7027FD97 /* Pods-CNLiveMineModule_Example.debug.xcconfig */; |
| 611 | 617 | buildSettings = { |
| 612 | 618 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 619 | + CURRENT_PROJECT_VERSION = 1.0; | |
| 613 | 620 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 614 | 621 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 615 | 622 | GCC_PREFIX_HEADER = "CNLiveMineModule/CNLiveMineModule-Prefix.pch"; |
| 616 | 623 | INFOPLIST_FILE = "CNLiveMineModule/CNLiveMineModule-Info.plist"; |
| 624 | + MARKETING_VERSION = 1.0; | |
| 617 | 625 | MODULE_NAME = ExampleApp; |
| 618 | 626 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.CNLiveMineModule; |
| 619 | 627 | PRODUCT_NAME = "我的模块"; |
| ... | ... | @@ -628,10 +636,12 @@ |
| 628 | 636 | baseConfigurationReference = 75B26F3FEFD98849EC15D9D1 /* Pods-CNLiveMineModule_Example.release.xcconfig */; |
| 629 | 637 | buildSettings = { |
| 630 | 638 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 639 | + CURRENT_PROJECT_VERSION = 1.0; | |
| 631 | 640 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 632 | 641 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 633 | 642 | GCC_PREFIX_HEADER = "CNLiveMineModule/CNLiveMineModule-Prefix.pch"; |
| 634 | 643 | INFOPLIST_FILE = "CNLiveMineModule/CNLiveMineModule-Info.plist"; |
| 644 | + MARKETING_VERSION = 1.0; | |
| 635 | 645 | MODULE_NAME = ExampleApp; |
| 636 | 646 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.CNLiveMineModule; |
| 637 | 647 | PRODUCT_NAME = "我的模块"; | ... | ... |
Example/CNLiveMineModule/CNLIVEAppDelegate.m
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | { |
| 20 | 20 | // Override point for customization after application launch. |
| 21 | 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; |
| 22 | - [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; | |
| 22 | + [CNLiveEnvironmentManager setEnvironment:CNLiveDebugAppStore]; | |
| 23 | 23 | [CNLiveUserSystemCenter setAppId:AppId appKey:APPKey appSecret:AppSecret isTestEnvironment:TestEnvironment]; |
| 24 | 24 | if ([CNUserShareManager isLogin]) { |
| 25 | 25 | [CNLiveUserSystemCenter setUserId:CNUserShareModel.uid]; |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | @"email":@"", |
| 33 | 33 | @"extInfo":@"", |
| 34 | 34 | @"faceUrl":@"http://yweb0.cnliveimg.com/images/headImg/2019/1030/1572439148697_small.jpg", |
| 35 | - @"gender":@"m", | |
| 35 | + @"gender":@"f", | |
| 36 | 36 | @"hUid":@"", |
| 37 | 37 | @"isNewUser":@"0", |
| 38 | 38 | @"location":@"北京市海淀区", | ... | ... |
Example/CNLiveMineModule/CNLiveMineModule-Info.plist
| ... | ... | @@ -17,11 +17,11 @@ |
| 17 | 17 | <key>CFBundlePackageType</key> |
| 18 | 18 | <string>APPL</string> |
| 19 | 19 | <key>CFBundleShortVersionString</key> |
| 20 | - <string>1.0</string> | |
| 20 | + <string>$(MARKETING_VERSION)</string> | |
| 21 | 21 | <key>CFBundleSignature</key> |
| 22 | 22 | <string>????</string> |
| 23 | 23 | <key>CFBundleVersion</key> |
| 24 | - <string>1.0</string> | |
| 24 | + <string>$(CURRENT_PROJECT_VERSION)</string> | |
| 25 | 25 | <key>LSRequiresIPhoneOS</key> |
| 26 | 26 | <true/> |
| 27 | 27 | <key>NSAppTransportSecurity</key> | ... | ... |