diff --git a/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj b/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj index b932fbff..57e557b3 100644 --- a/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj +++ b/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj @@ -50,7 +50,6 @@ 9A562A3C1E03D52F00BB23DD /* LCCKSettingFooterTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A562A331E03D52F00BB23DD /* LCCKSettingFooterTitleView.m */; }; 9A562A3D1E03D52F00BB23DD /* LCCKSettingHeaderTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A562A351E03D52F00BB23DD /* LCCKSettingHeaderTitleView.m */; }; 9A7E2DE91D5F1040003A7312 /* LCCKContactManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A7E2DE81D5F1040003A7312 /* LCCKContactManager.m */; }; - 9AB37B2C1DC86A60000782F2 /* ChatKit.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 9AB37B271DC86A60000782F2 /* ChatKit.podspec */; }; 9AC3A4901DF9B7B400F3405F /* LCCKSingleConversationDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AC3A48F1DF9B7B400F3405F /* LCCKSingleConversationDetailViewController.m */; }; 9AC3A4931DF9B7D500F3405F /* LCCKGroupConversationDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AC3A4921DF9B7D500F3405F /* LCCKGroupConversationDetailViewController.m */; }; 9AC3A4B81DF9BEE600F3405F /* LCCKUIUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AC3A4B31DF9BEE600F3405F /* LCCKUIUtility.m */; }; @@ -180,7 +179,6 @@ 9AAFE6571D48C863004A0309 /* zh-Hans-CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans-CN"; path = "zh-Hans-CN.lproj/LaunchScreen.strings"; sourceTree = ""; }; 9AB37B251DC86A60000782F2 /* ChatKit 自定义样式.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = "ChatKit 自定义样式.md"; path = "../../../../../ChatKit 自定义样式.md"; sourceTree = ""; }; 9AB37B261DC86A60000782F2 /* ChatKit 自定义业务.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = "ChatKit 自定义业务.md"; path = "../../../../../ChatKit 自定义业务.md"; sourceTree = ""; }; - 9AB37B271DC86A60000782F2 /* ChatKit.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ChatKit.podspec; path = ../../../../../ChatKit.podspec; sourceTree = ""; }; 9AB37B281DC86A60000782F2 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../../../README.md; sourceTree = ""; }; 9AB37B291DC86A60000782F2 /* REDPACKET.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = REDPACKET.md; path = ../../../../../REDPACKET.md; sourceTree = ""; }; 9AB37B2F1DC86A6E000782F2 /* issue_template.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = issue_template.md; path = ../../../../../.github/issue_template.md; sourceTree = ""; }; @@ -211,6 +209,7 @@ 9AC3A4DC1DF9C8BD00F3405F /* LCCKUserGroupItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCCKUserGroupItemCell.m; sourceTree = ""; }; 9AC3A4E01DF9CE0300F3405F /* LCCKChatDetailHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCCKChatDetailHelper.h; sourceTree = ""; }; 9AC3A4E11DF9CE0300F3405F /* LCCKChatDetailHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCCKChatDetailHelper.m; sourceTree = ""; }; + D3D1667D1FD4EBB90019FDFF /* ChatKit.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = ChatKit.podspec; path = ../ChatKit.podspec; sourceTree = ""; }; E55D34EC8F162DB5443587B0 /* Pods-ChatKit-OC.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChatKit-OC.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ChatKit-OC/Pods-ChatKit-OC.debug.xcconfig"; sourceTree = ""; }; E7586C4E1D630681000C18B4 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -442,7 +441,6 @@ 9AB37B301DC86A6E000782F2 /* pull_request_template.md */, 9AB37B251DC86A60000782F2 /* ChatKit 自定义样式.md */, 9AB37B261DC86A60000782F2 /* ChatKit 自定义业务.md */, - 9AB37B271DC86A60000782F2 /* ChatKit.podspec */, 9AB37B281DC86A60000782F2 /* README.md */, 9AB37B291DC86A60000782F2 /* REDPACKET.md */, ); @@ -565,6 +563,7 @@ isa = PBXGroup; children = ( 9A4CBADB1DB87F2000E61C92 /* ChatKit-OC.entitlements */, + D3D1667D1FD4EBB90019FDFF /* ChatKit.podspec */, 9A4730281CECAEC500AEB86F /* Example */, 9A754D4C1CECAC3E000967F1 /* Products */, 578A4ED63A7AFF3EA27EF73A /* Frameworks */, @@ -791,7 +790,6 @@ files = ( 9A4730711CECAEC500AEB86F /* LaunchScreen.storyboard in Resources */, 9A4730701CECAEC500AEB86F /* Assets.xcassets in Resources */, - 9AB37B2C1DC86A60000782F2 /* ChatKit.podspec in Resources */, 9A2669CE1D6DA89100B66545 /* LCCKVCardView.xib in Resources */, 9A2669CA1D6DA89100B66545 /* calling_card_bg@2x.png in Resources */, 9A4730681CECAEC500AEB86F /* LCCKLoginViewController.xib in Resources */, @@ -1193,7 +1191,6 @@ "\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloud\"", "\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloudIM\"", "\"$PODS_CONFIGURATION_BUILD_DIR/CYLTabBarController\"", - "\"$PODS_CONFIGURATION_BUILD_DIR/CYLTableViewRowAction\"", "\"$PODS_CONFIGURATION_BUILD_DIR/ChatKit\"", "\"$PODS_CONFIGURATION_BUILD_DIR/DACircularProgress\"", "\"$PODS_CONFIGURATION_BUILD_DIR/FDStackView\"", @@ -1238,7 +1235,6 @@ "\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloud\"", "\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloudIM\"", "\"$PODS_CONFIGURATION_BUILD_DIR/CYLTabBarController\"", - "\"$PODS_CONFIGURATION_BUILD_DIR/CYLTableViewRowAction\"", "\"$PODS_CONFIGURATION_BUILD_DIR/ChatKit\"", "\"$PODS_CONFIGURATION_BUILD_DIR/DACircularProgress\"", "\"$PODS_CONFIGURATION_BUILD_DIR/FDStackView\"", diff --git a/ChatKit-OC/Example/Class/Module/Utilities/DataUtilities/NSDate+Utilities.m b/ChatKit-OC/Example/Class/Module/Utilities/DataUtilities/NSDate+Utilities.m index c6b8a0ac..c80e1140 100755 --- a/ChatKit-OC/Example/Class/Module/Utilities/DataUtilities/NSDate+Utilities.m +++ b/ChatKit-OC/Example/Class/Module/Utilities/DataUtilities/NSDate+Utilities.m @@ -156,8 +156,8 @@ - (BOOL) isLastWeek { } // Thanks, mspasov - (BOOL) isSameMonthAsDate: (NSDate *) aDate { - NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:self]; - NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:aDate]; + NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear | NSCalendarUnitMonth fromDate:self]; + NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear | NSCalendarUnitMonth fromDate:aDate]; return ((components1.month == components2.month) && (components1.year == components2.year)); } @@ -175,8 +175,8 @@ - (BOOL) isNextMonth { } - (BOOL) isSameYearAsDate: (NSDate *) aDate { - NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:self]; - NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:aDate]; + NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:self]; + NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:aDate]; return (components1.year == components2.year); } @@ -186,14 +186,14 @@ - (BOOL) isThisYear { } - (BOOL) isNextYear { - NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:self]; - NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:[NSDate date]]; + NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:self]; + NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:[NSDate date]]; return (components1.year == (components2.year + 1)); } - (BOOL) isLastYear { - NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:self]; - NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:[NSDate date]]; + NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:self]; + NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:[NSDate date]]; return (components1.year == (components2.year - 1)); } @@ -214,7 +214,7 @@ - (BOOL) isInPast { } #pragma mark Roles - (BOOL) isTypicallyWeekend { - NSDateComponents *components = [CURRENT_CALENDAR components:NSWeekdayCalendarUnit fromDate:self]; + NSDateComponents *components = [CURRENT_CALENDAR components:NSCalendarUnitWeekday fromDate:self]; if ((components.weekday == 1) || (components.weekday == 7)) return YES; @@ -337,8 +337,8 @@ - (NSInteger) daysBeforeDate: (NSDate *) aDate { // Thanks, dmitrydims // I have not yet thoroughly tested this - (NSInteger)distanceInDaysToDate:(NSDate *)anotherDate { - NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; - NSDateComponents *components = [gregorianCalendar components:NSDayCalendarUnit fromDate:self toDate:anotherDate options:0]; + NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + NSDateComponents *components = [gregorianCalendar components:NSCalendarUnitDay fromDate:self toDate:anotherDate options:0]; return components.day; } @@ -346,7 +346,7 @@ - (NSInteger)distanceInDaysToDate:(NSDate *)anotherDate { - (NSInteger) nearestHour { NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] + D_MINUTE * 30; NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; - NSDateComponents *components = [CURRENT_CALENDAR components:NSHourCalendarUnit fromDate:newDate]; + NSDateComponents *components = [CURRENT_CALENDAR components:NSCalendarUnitHour fromDate:newDate]; return components.hour; } diff --git a/ChatKit-OC/Example/LCChatKitExample+Setting.m b/ChatKit-OC/Example/LCChatKitExample+Setting.m index 506ebad4..d40a0b62 100644 --- a/ChatKit-OC/Example/LCChatKitExample+Setting.m +++ b/ChatKit-OC/Example/LCChatKitExample+Setting.m @@ -384,52 +384,61 @@ - (void)lcck_setupBadge { * 强制重连 */ - (void)lcck_setupForceReconect { - [[LCChatKit sharedInstance] setForceReconnectSessionBlock:^( - NSError *aError, BOOL granted, - __kindof UIViewController *viewController, - LCCKReconnectSessionCompletionHandler completionHandler) { - BOOL isSingleSignOnOffline = (aError.code == 4111); - if (isSingleSignOnOffline) { - // 一旦出现单点登录被踢错误,必须退出到登录界面重新登录 - // - 退回登录页面 - [[self class] lcck_clearLocalClientInfo]; - LCCKLoginViewController *loginViewController = [[LCCKLoginViewController alloc] init]; - [loginViewController setClientIDHandler:^(NSString *clientID) { - [LCCKUtil showProgressText:@"open client ..." duration:10.0f]; - [LCChatKitExample invokeThisMethodAfterLoginSuccessWithClientId:clientID - success:^{ - [LCCKUtil hideProgress]; - LCCKTabBarControllerConfig *tabBarControllerConfig = - [[LCCKTabBarControllerConfig alloc] init]; - [UIApplication sharedApplication].keyWindow.rootViewController = - tabBarControllerConfig.tabBarController; - } - failed:^(NSError *error) { - [LCCKUtil hideProgress]; - NSLog(@"%@", error); - }]; - }]; - [[self class] lcck_tryPresentViewControllerViewController:loginViewController]; - //completionHandler用来提示重连成功的HUD,此处可以不用执行 - !completionHandler ?: completionHandler(YES, nil); - return; - } - - // - 用户允许重连请求,发起重连或强制登录 - if (granted == YES) { - BOOL force = NO; - NSString *title = @"正在重连聊天服务..."; - [[self class] lcck_showMessage:title toView:viewController.view]; - [[LCChatKit sharedInstance] openWithClientId:[LCChatKit sharedInstance].clientId - force:force - callback:^(BOOL succeeded, NSError *error) { - [[self class] lcck_hideHUDForView:viewController.view]; - //completionHandler用来提示重连成功的HUD - !completionHandler ?: completionHandler(succeeded, error); - }]; - return; - } - }]; + [[LCChatKit sharedInstance] setForceReconnectSessionBlock: + ^(NSError *aError, BOOL granted, __kindof UIViewController *viewController, LCCKReconnectSessionCompletionHandler completionHandler) { + + BOOL isSingleSignOnOffline = (aError.code == 4111); + + if (isSingleSignOnOffline) { + + // - 用户允许重连请求,发起重连或强制登录 + if (granted == YES) { + + NSString *title = @"正在重连聊天服务..."; + + // 从系统偏好读取用户已经保存的信息 + NSUserDefaults *defaultsGet = [NSUserDefaults standardUserDefaults]; + NSString *clientId = [defaultsGet stringForKey:LCCK_KEY_USERID]; + + [[self class] lcck_showMessage:title toView:viewController.view]; + [[LCChatKit sharedInstance] openWithClientId:clientId + force:granted + callback: + ^(BOOL succeeded, NSError *error) { + [[self class] lcck_hideHUDForView:viewController.view]; + //completionHandler用来提示重连成功的HUD + !completionHandler ?: completionHandler(succeeded, error); + }]; + return; + } + + // 一旦出现单点登录被踢错误,必须退出到登录界面重新登录 + // - 退回登录页面 + [[self class] lcck_clearLocalClientInfo]; + LCCKLoginViewController *loginViewController = [[LCCKLoginViewController alloc] init]; + [loginViewController setClientIDHandler:^(NSString *clientID) { + [LCCKUtil showProgressText:@"open client ..." duration:10.0f]; + [LCChatKitExample invokeThisMethodAfterLoginSuccessWithClientId:clientID + success: + ^{ + [LCCKUtil hideProgress]; + LCCKTabBarControllerConfig *tabBarControllerConfig = + [[LCCKTabBarControllerConfig alloc] init]; + [UIApplication sharedApplication].keyWindow.rootViewController = + tabBarControllerConfig.tabBarController; + } + failed: + ^(NSError *error) { + [LCCKUtil hideProgress]; + NSLog(@"%@", error); + }]; + }]; + [[self class] lcck_tryPresentViewControllerViewController:loginViewController]; + //completionHandler用来提示重连成功的HUD,此处可以不用执行 + !completionHandler ?: completionHandler(YES, nil); + return; + } + }]; } /** * 各个情况的hud提示设置 diff --git a/ChatKit-OC/Podfile.lock b/ChatKit-OC/Podfile.lock index 9c942998..3ee26c67 100644 --- a/ChatKit-OC/Podfile.lock +++ b/ChatKit-OC/Podfile.lock @@ -1,17 +1,17 @@ PODS: - - AVOSCloud (8.0.0) - - AVOSCloudIM (8.0.0): - - AVOSCloud (= 8.0.0) - - AVOSCloudIM/_ARC (= 8.0.0) - - AVOSCloudIM/_NOARC (= 8.0.0) - - AVOSCloudIM/_ARC (8.0.0): - - AVOSCloud (= 8.0.0) - - AVOSCloudIM/_NOARC (= 8.0.0) - - AVOSCloudIM/_NOARC (8.0.0): - - AVOSCloud (= 8.0.0) + - AVOSCloud (8.0.4) + - AVOSCloudIM (8.0.4): + - AVOSCloud (= 8.0.4) + - AVOSCloudIM/_ARC (= 8.0.4) + - AVOSCloudIM/_NOARC (= 8.0.4) + - AVOSCloudIM/_ARC (8.0.4): + - AVOSCloud (= 8.0.4) + - AVOSCloudIM/_NOARC (= 8.0.4) + - AVOSCloudIM/_NOARC (8.0.4): + - AVOSCloud (= 8.0.4) - ChatKit (2.0.0): - - AVOSCloud (~> 8.0.0) - - AVOSCloudIM (~> 8.0.0) + - AVOSCloud (~> 8.0.4) + - AVOSCloudIM (~> 8.0.4) - CYLDeallocBlockExecutor (~> 1.1.2) - DACircularProgress (~> 2.3.1) - FDStackView (~> 1.0) @@ -65,9 +65,9 @@ EXTERNAL SOURCES: :path: ../ SPEC CHECKSUMS: - AVOSCloud: c79e2b8dcdf5676442f3d7d04a45068af1cfb10f - AVOSCloudIM: e48f54840a216a1a341ce2d75d47c20ace4e16e8 - ChatKit: 95dc20970f263d31330059561cf8769bc7859487 + AVOSCloud: 645f20b77cdcc0622a45c663c1a5735a17d1df27 + AVOSCloudIM: 182e93f9e6e3ad165c6fd67d8c01d15f561a7538 + ChatKit: 5c1e12b04919974ed4eeb7455d45861d99212390 CYLDeallocBlockExecutor: ecf39e45dcead9e120f460df5668b8f5093d178e CYLTabBarController: 8d99fccf22866fe18c978c5ff863dc6051da45ff DACircularProgress: 4dd437c0fc3da5161cb289e07ac449493d41db71 diff --git a/ChatKit.podspec b/ChatKit.podspec index 1c6c9878..ec6834ac 100644 --- a/ChatKit.podspec +++ b/ChatKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ChatKit" - s.version = "2.0.0" + s.version = "2.0.1" s.summary = "An IM App Framework, support sending text, pictures, audio, video, location messaging, managing address book, more interesting features." s.homepage = "https://github.com/LeanCloud/ChatKit-OC" s.license = { :type => 'MIT', :file => 'LICENSE' } @@ -13,8 +13,8 @@ Pod::Spec.new do |s| s.resources = 'ChatKit/Class/Resources/*', 'ChatKit/**/*.xib' s.requires_arc = true - s.dependency "AVOSCloud" , "~> 8.0.0" - s.dependency "AVOSCloudIM", "~> 8.0.0" + s.dependency "AVOSCloud" , "~> 8.0.4" + s.dependency "AVOSCloudIM", "~> 8.0.4" s.dependency "MJRefresh" , "~> 3.1.9" s.dependency "Masonry" , "~> 1.0.1" s.dependency "SDWebImage" , "~> 3.8.0"