Commit a37316312e9bb3b60f0a11e03cfe070c8966acee
1 parent
f654d33e
no message
Showing
5 changed files
with
87 additions
and
5 deletions
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | #import <CNLiveUserSystemSDK/CNLiveUserSystemTypeDef.h> |
| 21 | 21 | #import "NSString+CNLiveExtension.h" |
| 22 | 22 | #import "NSDictionary+Safety.h" |
| 23 | +#import "UIImage+Common.h" | |
| 23 | 24 | |
| 24 | 25 | #import "CNLiveAddScoreManager.h" |
| 25 | 26 | #import "CNLiveGoldWhereaboutsView.h" |
| ... | ... | @@ -351,7 +352,12 @@ static const CGFloat timeValue = 1.5; |
| 351 | 352 | |
| 352 | 353 | // 更新头像 |
| 353 | 354 | - (void)requestUpdateUserHeader:(UIImage *)image{ |
| 355 | + // 固定方向 | |
| 356 | + image = [image fixOrientation]; | |
| 357 | + //压缩图片质量 | |
| 358 | + image = [self reduceImage:image percent:0.5]; | |
| 354 | 359 | [QMUITips showLoading:@"修改中" inView:self.view]; |
| 360 | + | |
| 355 | 361 | [CNLiveUserSystemCenter uploadIconWithUid:CNUserShareModel.uid icon:image compressionQuality:0.99 success:^(id result) { |
| 356 | 362 | // [[IMAPlatform sharedInstance].host asyncProfile]; |
| 357 | 363 | [QMUITips hideAllToastInView:self.view animated:YES]; |
| ... | ... | @@ -377,6 +383,13 @@ static const CGFloat timeValue = 1.5; |
| 377 | 383 | |
| 378 | 384 | } |
| 379 | 385 | |
| 386 | +// 压缩图片质量 | |
| 387 | +- (UIImage *)reduceImage:(UIImage *)image percent:(float)percent { | |
| 388 | + NSData *imageData = UIImageJPEGRepresentation(image, percent); | |
| 389 | + UIImage *newImage = [UIImage imageWithData:imageData]; | |
| 390 | + return newImage; | |
| 391 | +} | |
| 392 | + | |
| 380 | 393 | - (void)getAVAuthorizationStatus:(void (^)(void))block{ |
| 381 | 394 | AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; |
| 382 | 395 | if (device) { | ... | ... |
Example/CNLiveMineModule.xcodeproj/project.pbxproj
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | objects = { |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| 10 | + 084AE78223891906005C9A94 /* UIViewController+Present.m in Sources */ = {isa = PBXBuildFile; fileRef = 084AE78123891906005C9A94 /* UIViewController+Present.m */; }; | |
| 10 | 11 | 08B0B213237D1A4D00337DEC /* CNLiveConfigurationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 08B0B211237D1A4D00337DEC /* CNLiveConfigurationManager.m */; }; |
| 11 | 12 | 08B0B216237D1DE400337DEC /* CNLivePageJumpManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 08B0B215237D1DE400337DEC /* CNLivePageJumpManager.m */; }; |
| 12 | 13 | 08B0B219237D1FAF00337DEC /* CNLiveRootControllerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 08B0B218237D1FAE00337DEC /* CNLiveRootControllerManager.m */; }; |
| ... | ... | @@ -41,6 +42,8 @@ |
| 41 | 42 | /* End PBXContainerItemProxy section */ |
| 42 | 43 | |
| 43 | 44 | /* Begin PBXFileReference section */ |
| 45 | + 084AE78023891906005C9A94 /* UIViewController+Present.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Present.h"; sourceTree = "<group>"; }; | |
| 46 | + 084AE78123891906005C9A94 /* UIViewController+Present.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Present.m"; sourceTree = "<group>"; }; | |
| 44 | 47 | 08B0B20E237D1A4D00337DEC /* CNLiveConfigurationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveConfigurationManager.h; sourceTree = "<group>"; }; |
| 45 | 48 | 08B0B211237D1A4D00337DEC /* CNLiveConfigurationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveConfigurationManager.m; sourceTree = "<group>"; }; |
| 46 | 49 | 08B0B214237D1DE400337DEC /* CNLivePageJumpManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLivePageJumpManager.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -162,6 +165,8 @@ |
| 162 | 165 | 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, |
| 163 | 166 | 6003F5A8195388D20070C39A /* Images.xcassets */, |
| 164 | 167 | 6003F594195388D20070C39A /* Supporting Files */, |
| 168 | + 084AE78023891906005C9A94 /* UIViewController+Present.h */, | |
| 169 | + 084AE78123891906005C9A94 /* UIViewController+Present.m */, | |
| 165 | 170 | ); |
| 166 | 171 | name = "Example for CNLiveMineModule"; |
| 167 | 172 | path = CNLiveMineModule; |
| ... | ... | @@ -470,6 +475,7 @@ |
| 470 | 475 | files = ( |
| 471 | 476 | 6003F59E195388D20070C39A /* CNLIVEAppDelegate.m in Sources */, |
| 472 | 477 | 08B0B213237D1A4D00337DEC /* CNLiveConfigurationManager.m in Sources */, |
| 478 | + 084AE78223891906005C9A94 /* UIViewController+Present.m in Sources */, | |
| 473 | 479 | 08B0B216237D1DE400337DEC /* CNLivePageJumpManager.m in Sources */, |
| 474 | 480 | 6003F5A7195388D20070C39A /* CNLIVEViewController.m in Sources */, |
| 475 | 481 | 08B0B21C237D227700337DEC /* CNLiveNotificationManager.m in Sources */, | ... | ... |
Example/CNLiveMineModule/CNLIVEAppDelegate.m
| ... | ... | @@ -9,17 +9,22 @@ |
| 9 | 9 | #import "CNLIVEAppDelegate.h" |
| 10 | 10 | #import "CNLiveMineController.h" |
| 11 | 11 | #import "CNUserInfoManager.h" |
| 12 | +#import "CNLiveEnvironment.h" | |
| 13 | +#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h> | |
| 14 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | |
| 12 | 15 | |
| 13 | 16 | @implementation CNLIVEAppDelegate |
| 14 | 17 | |
| 15 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| 16 | 19 | { |
| 17 | 20 | // Override point for customization after application launch. |
| 18 | - self.window =[[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
| 19 | - CNLiveMineController *vc = [[CNLiveMineController alloc] init]; | |
| 20 | - UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; | |
| 21 | - self.window.rootViewController = nav;//设置根视图控制器 | |
| 22 | - [self.window makeKeyAndVisible]; | |
| 21 | + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
| 22 | + [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; | |
| 23 | + [CNLiveUserSystemCenter setAppId:AppId appKey:APPKey appSecret:AppSecret isTestEnvironment:TestEnvironment]; | |
| 24 | + if ([CNUserShareManager isLogin]) { | |
| 25 | + [CNLiveUserSystemCenter setUserId:CNUserShareModel.uid]; | |
| 26 | + } | |
| 27 | + [self networkParamAction]; | |
| 23 | 28 | |
| 24 | 29 | [CNUserInfoManager saveUserinfoDic:@{ |
| 25 | 30 | @"bigFaceUrl":@"http://yweb0.cnliveimg.com/images/headImg/2019/1030/1572439148697.jpg", |
| ... | ... | @@ -41,6 +46,11 @@ |
| 41 | 46 | @"uid":@"10514405", |
| 42 | 47 | @"wxUid":@"" |
| 43 | 48 | }]; |
| 49 | + CNLiveMineController *vc = [[CNLiveMineController alloc] init]; | |
| 50 | + UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; | |
| 51 | + self.window.rootViewController = nav;//设置根视图控制器 | |
| 52 | + [self.window makeKeyAndVisible]; | |
| 53 | + | |
| 44 | 54 | return YES; |
| 45 | 55 | } |
| 46 | 56 | |
| ... | ... | @@ -71,4 +81,22 @@ |
| 71 | 81 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. |
| 72 | 82 | } |
| 73 | 83 | |
| 84 | +- (void)networkParamAction{ | |
| 85 | + NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init]; | |
| 86 | + [mDict setValue:@"10514405" forKey:@"loginSid"]; | |
| 87 | + | |
| 88 | + [mDict setValue:BundleId forKey:@"platform_id"]; | |
| 89 | + | |
| 90 | + [mDict setValue:[[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""] forKey:@"uuid"]; | |
| 91 | + [mDict setValue:@"i" forKey:@"plat"]; | |
| 92 | + [mDict setValue:@"1.7.8.19.10.30.15"forKey:@"ver"]; | |
| 93 | + [mDict setObject:AppId forKey:@"appId"]; | |
| 94 | + [CNLiveNetworking setupDefaultParam:mDict]; | |
| 95 | + [CNLiveNetworking setupShowResult:NO]; | |
| 96 | + [CNLiveNetworking setupSignKey:APPKey]; | |
| 97 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 98 | + [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON]; | |
| 99 | + | |
| 100 | +} | |
| 101 | + | |
| 74 | 102 | @end | ... | ... |
Example/CNLiveMineModule/UIViewController+Present.h
0 → 100644
| 1 | +// | |
| 2 | +// UIViewController+CNLivePresent.h | |
| 3 | +// CNLiveMineModule | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/11/23. | |
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@interface UIViewController (Present) | |
| 14 | + | |
| 15 | +@end | |
| 16 | + | |
| 17 | +NS_ASSUME_NONNULL_END | ... | ... |
Example/CNLiveMineModule/UIViewController+Present.m
0 → 100644
| 1 | +// | |
| 2 | +// UIViewController+CNLivePresent.m | |
| 3 | +// CNLiveMineModule | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/11/23. | |
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "UIViewController+Present.h" | |
| 10 | + | |
| 11 | +@implementation UIViewController (Present) | |
| 12 | + | |
| 13 | +- (UIModalPresentationStyle)modalPresentationStyle{ | |
| 14 | + return UIModalPresentationFullScreen; | |
| 15 | + | |
| 16 | +} | |
| 17 | + | |
| 18 | +@end | ... | ... |