Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit c4a447c

Browse files
authored
Merge pull request #368 from zapcannon87/master
Release v2.0.1
2 parents 5966feb + 4855481 commit c4a447c

File tree

5 files changed

+87
-82
lines changed

5 files changed

+87
-82
lines changed

ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
9A562A3C1E03D52F00BB23DD /* LCCKSettingFooterTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A562A331E03D52F00BB23DD /* LCCKSettingFooterTitleView.m */; };
5151
9A562A3D1E03D52F00BB23DD /* LCCKSettingHeaderTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A562A351E03D52F00BB23DD /* LCCKSettingHeaderTitleView.m */; };
5252
9A7E2DE91D5F1040003A7312 /* LCCKContactManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A7E2DE81D5F1040003A7312 /* LCCKContactManager.m */; };
53-
9AB37B2C1DC86A60000782F2 /* ChatKit.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 9AB37B271DC86A60000782F2 /* ChatKit.podspec */; };
5453
9AC3A4901DF9B7B400F3405F /* LCCKSingleConversationDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AC3A48F1DF9B7B400F3405F /* LCCKSingleConversationDetailViewController.m */; };
5554
9AC3A4931DF9B7D500F3405F /* LCCKGroupConversationDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AC3A4921DF9B7D500F3405F /* LCCKGroupConversationDetailViewController.m */; };
5655
9AC3A4B81DF9BEE600F3405F /* LCCKUIUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AC3A4B31DF9BEE600F3405F /* LCCKUIUtility.m */; };
@@ -180,7 +179,6 @@
180179
9AAFE6571D48C863004A0309 /* zh-Hans-CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans-CN"; path = "zh-Hans-CN.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
181180
9AB37B251DC86A60000782F2 /* ChatKit 自定义样式.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = "ChatKit 自定义样式.md"; path = "../../../../../ChatKit 自定义样式.md"; sourceTree = "<group>"; };
182181
9AB37B261DC86A60000782F2 /* ChatKit 自定义业务.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = "ChatKit 自定义业务.md"; path = "../../../../../ChatKit 自定义业务.md"; sourceTree = "<group>"; };
183-
9AB37B271DC86A60000782F2 /* ChatKit.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ChatKit.podspec; path = ../../../../../ChatKit.podspec; sourceTree = "<group>"; };
184182
9AB37B281DC86A60000782F2 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../../../README.md; sourceTree = "<group>"; };
185183
9AB37B291DC86A60000782F2 /* REDPACKET.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = REDPACKET.md; path = ../../../../../REDPACKET.md; sourceTree = "<group>"; };
186184
9AB37B2F1DC86A6E000782F2 /* issue_template.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = issue_template.md; path = ../../../../../.github/issue_template.md; sourceTree = "<group>"; };
@@ -211,6 +209,7 @@
211209
9AC3A4DC1DF9C8BD00F3405F /* LCCKUserGroupItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCCKUserGroupItemCell.m; sourceTree = "<group>"; };
212210
9AC3A4E01DF9CE0300F3405F /* LCCKChatDetailHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCCKChatDetailHelper.h; sourceTree = "<group>"; };
213211
9AC3A4E11DF9CE0300F3405F /* LCCKChatDetailHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCCKChatDetailHelper.m; sourceTree = "<group>"; };
212+
D3D1667D1FD4EBB90019FDFF /* ChatKit.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = ChatKit.podspec; path = ../ChatKit.podspec; sourceTree = "<group>"; };
214213
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 = "<group>"; };
215214
E7586C4E1D630681000C18B4 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
216215
/* End PBXFileReference section */
@@ -442,7 +441,6 @@
442441
9AB37B301DC86A6E000782F2 /* pull_request_template.md */,
443442
9AB37B251DC86A60000782F2 /* ChatKit 自定义样式.md */,
444443
9AB37B261DC86A60000782F2 /* ChatKit 自定义业务.md */,
445-
9AB37B271DC86A60000782F2 /* ChatKit.podspec */,
446444
9AB37B281DC86A60000782F2 /* README.md */,
447445
9AB37B291DC86A60000782F2 /* REDPACKET.md */,
448446
);
@@ -565,6 +563,7 @@
565563
isa = PBXGroup;
566564
children = (
567565
9A4CBADB1DB87F2000E61C92 /* ChatKit-OC.entitlements */,
566+
D3D1667D1FD4EBB90019FDFF /* ChatKit.podspec */,
568567
9A4730281CECAEC500AEB86F /* Example */,
569568
9A754D4C1CECAC3E000967F1 /* Products */,
570569
578A4ED63A7AFF3EA27EF73A /* Frameworks */,
@@ -791,7 +790,6 @@
791790
files = (
792791
9A4730711CECAEC500AEB86F /* LaunchScreen.storyboard in Resources */,
793792
9A4730701CECAEC500AEB86F /* Assets.xcassets in Resources */,
794-
9AB37B2C1DC86A60000782F2 /* ChatKit.podspec in Resources */,
795793
9A2669CE1D6DA89100B66545 /* LCCKVCardView.xib in Resources */,
796794
9A2669CA1D6DA89100B66545 /* calling_card_bg@2x.png in Resources */,
797795
9A4730681CECAEC500AEB86F /* LCCKLoginViewController.xib in Resources */,
@@ -1193,7 +1191,6 @@
11931191
"\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloud\"",
11941192
"\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloudIM\"",
11951193
"\"$PODS_CONFIGURATION_BUILD_DIR/CYLTabBarController\"",
1196-
"\"$PODS_CONFIGURATION_BUILD_DIR/CYLTableViewRowAction\"",
11971194
"\"$PODS_CONFIGURATION_BUILD_DIR/ChatKit\"",
11981195
"\"$PODS_CONFIGURATION_BUILD_DIR/DACircularProgress\"",
11991196
"\"$PODS_CONFIGURATION_BUILD_DIR/FDStackView\"",
@@ -1238,7 +1235,6 @@
12381235
"\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloud\"",
12391236
"\"$PODS_CONFIGURATION_BUILD_DIR/AVOSCloudIM\"",
12401237
"\"$PODS_CONFIGURATION_BUILD_DIR/CYLTabBarController\"",
1241-
"\"$PODS_CONFIGURATION_BUILD_DIR/CYLTableViewRowAction\"",
12421238
"\"$PODS_CONFIGURATION_BUILD_DIR/ChatKit\"",
12431239
"\"$PODS_CONFIGURATION_BUILD_DIR/DACircularProgress\"",
12441240
"\"$PODS_CONFIGURATION_BUILD_DIR/FDStackView\"",

ChatKit-OC/Example/Class/Module/Utilities/DataUtilities/NSDate+Utilities.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ - (BOOL) isLastWeek {
156156
}
157157
// Thanks, mspasov
158158
- (BOOL) isSameMonthAsDate: (NSDate *) aDate {
159-
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:self];
160-
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:aDate];
159+
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear | NSCalendarUnitMonth fromDate:self];
160+
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear | NSCalendarUnitMonth fromDate:aDate];
161161
return ((components1.month == components2.month) &&
162162
(components1.year == components2.year));
163163
}
@@ -175,8 +175,8 @@ - (BOOL) isNextMonth {
175175
}
176176

177177
- (BOOL) isSameYearAsDate: (NSDate *) aDate {
178-
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:self];
179-
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:aDate];
178+
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:self];
179+
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:aDate];
180180
return (components1.year == components2.year);
181181
}
182182

@@ -186,14 +186,14 @@ - (BOOL) isThisYear {
186186
}
187187

188188
- (BOOL) isNextYear {
189-
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:self];
190-
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:[NSDate date]];
189+
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:self];
190+
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:[NSDate date]];
191191
return (components1.year == (components2.year + 1));
192192
}
193193

194194
- (BOOL) isLastYear {
195-
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:self];
196-
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:[NSDate date]];
195+
NSDateComponents *components1 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:self];
196+
NSDateComponents *components2 = [CURRENT_CALENDAR components:NSCalendarUnitYear fromDate:[NSDate date]];
197197
return (components1.year == (components2.year - 1));
198198
}
199199

@@ -214,7 +214,7 @@ - (BOOL) isInPast {
214214
}
215215
#pragma mark Roles
216216
- (BOOL) isTypicallyWeekend {
217-
NSDateComponents *components = [CURRENT_CALENDAR components:NSWeekdayCalendarUnit fromDate:self];
217+
NSDateComponents *components = [CURRENT_CALENDAR components:NSCalendarUnitWeekday fromDate:self];
218218
if ((components.weekday == 1) ||
219219
(components.weekday == 7))
220220
return YES;
@@ -337,16 +337,16 @@ - (NSInteger) daysBeforeDate: (NSDate *) aDate {
337337
// Thanks, dmitrydims
338338
// I have not yet thoroughly tested this
339339
- (NSInteger)distanceInDaysToDate:(NSDate *)anotherDate {
340-
NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
341-
NSDateComponents *components = [gregorianCalendar components:NSDayCalendarUnit fromDate:self toDate:anotherDate options:0];
340+
NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
341+
NSDateComponents *components = [gregorianCalendar components:NSCalendarUnitDay fromDate:self toDate:anotherDate options:0];
342342
return components.day;
343343
}
344344

345345
#pragma mark Decomposing Dates
346346
- (NSInteger) nearestHour {
347347
NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] + D_MINUTE * 30;
348348
NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval];
349-
NSDateComponents *components = [CURRENT_CALENDAR components:NSHourCalendarUnit fromDate:newDate];
349+
NSDateComponents *components = [CURRENT_CALENDAR components:NSCalendarUnitHour fromDate:newDate];
350350
return components.hour;
351351
}
352352

ChatKit-OC/Example/LCChatKitExample+Setting.m

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -384,52 +384,61 @@ - (void)lcck_setupBadge {
384384
* 强制重连
385385
*/
386386
- (void)lcck_setupForceReconect {
387-
[[LCChatKit sharedInstance] setForceReconnectSessionBlock:^(
388-
NSError *aError, BOOL granted,
389-
__kindof UIViewController *viewController,
390-
LCCKReconnectSessionCompletionHandler completionHandler) {
391-
BOOL isSingleSignOnOffline = (aError.code == 4111);
392-
if (isSingleSignOnOffline) {
393-
// 一旦出现单点登录被踢错误,必须退出到登录界面重新登录
394-
// - 退回登录页面
395-
[[self class] lcck_clearLocalClientInfo];
396-
LCCKLoginViewController *loginViewController = [[LCCKLoginViewController alloc] init];
397-
[loginViewController setClientIDHandler:^(NSString *clientID) {
398-
[LCCKUtil showProgressText:@"open client ..." duration:10.0f];
399-
[LCChatKitExample invokeThisMethodAfterLoginSuccessWithClientId:clientID
400-
success:^{
401-
[LCCKUtil hideProgress];
402-
LCCKTabBarControllerConfig *tabBarControllerConfig =
403-
[[LCCKTabBarControllerConfig alloc] init];
404-
[UIApplication sharedApplication].keyWindow.rootViewController =
405-
tabBarControllerConfig.tabBarController;
406-
}
407-
failed:^(NSError *error) {
408-
[LCCKUtil hideProgress];
409-
NSLog(@"%@", error);
410-
}];
411-
}];
412-
[[self class] lcck_tryPresentViewControllerViewController:loginViewController];
413-
//completionHandler用来提示重连成功的HUD,此处可以不用执行
414-
!completionHandler ?: completionHandler(YES, nil);
415-
return;
416-
}
417-
418-
// - 用户允许重连请求,发起重连或强制登录
419-
if (granted == YES) {
420-
BOOL force = NO;
421-
NSString *title = @"正在重连聊天服务...";
422-
[[self class] lcck_showMessage:title toView:viewController.view];
423-
[[LCChatKit sharedInstance] openWithClientId:[LCChatKit sharedInstance].clientId
424-
force:force
425-
callback:^(BOOL succeeded, NSError *error) {
426-
[[self class] lcck_hideHUDForView:viewController.view];
427-
//completionHandler用来提示重连成功的HUD
428-
!completionHandler ?: completionHandler(succeeded, error);
429-
}];
430-
return;
431-
}
432-
}];
387+
[[LCChatKit sharedInstance] setForceReconnectSessionBlock:
388+
^(NSError *aError, BOOL granted, __kindof UIViewController *viewController, LCCKReconnectSessionCompletionHandler completionHandler) {
389+
390+
BOOL isSingleSignOnOffline = (aError.code == 4111);
391+
392+
if (isSingleSignOnOffline) {
393+
394+
// - 用户允许重连请求,发起重连或强制登录
395+
if (granted == YES) {
396+
397+
NSString *title = @"正在重连聊天服务...";
398+
399+
// 从系统偏好读取用户已经保存的信息
400+
NSUserDefaults *defaultsGet = [NSUserDefaults standardUserDefaults];
401+
NSString *clientId = [defaultsGet stringForKey:LCCK_KEY_USERID];
402+
403+
[[self class] lcck_showMessage:title toView:viewController.view];
404+
[[LCChatKit sharedInstance] openWithClientId:clientId
405+
force:granted
406+
callback:
407+
^(BOOL succeeded, NSError *error) {
408+
[[self class] lcck_hideHUDForView:viewController.view];
409+
//completionHandler用来提示重连成功的HUD
410+
!completionHandler ?: completionHandler(succeeded, error);
411+
}];
412+
return;
413+
}
414+
415+
// 一旦出现单点登录被踢错误,必须退出到登录界面重新登录
416+
// - 退回登录页面
417+
[[self class] lcck_clearLocalClientInfo];
418+
LCCKLoginViewController *loginViewController = [[LCCKLoginViewController alloc] init];
419+
[loginViewController setClientIDHandler:^(NSString *clientID) {
420+
[LCCKUtil showProgressText:@"open client ..." duration:10.0f];
421+
[LCChatKitExample invokeThisMethodAfterLoginSuccessWithClientId:clientID
422+
success:
423+
^{
424+
[LCCKUtil hideProgress];
425+
LCCKTabBarControllerConfig *tabBarControllerConfig =
426+
[[LCCKTabBarControllerConfig alloc] init];
427+
[UIApplication sharedApplication].keyWindow.rootViewController =
428+
tabBarControllerConfig.tabBarController;
429+
}
430+
failed:
431+
^(NSError *error) {
432+
[LCCKUtil hideProgress];
433+
NSLog(@"%@", error);
434+
}];
435+
}];
436+
[[self class] lcck_tryPresentViewControllerViewController:loginViewController];
437+
//completionHandler用来提示重连成功的HUD,此处可以不用执行
438+
!completionHandler ?: completionHandler(YES, nil);
439+
return;
440+
}
441+
}];
433442
}
434443
/**
435444
* 各个情况的hud提示设置

ChatKit-OC/Podfile.lock

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
PODS:
2-
- AVOSCloud (8.0.0)
3-
- AVOSCloudIM (8.0.0):
4-
- AVOSCloud (= 8.0.0)
5-
- AVOSCloudIM/_ARC (= 8.0.0)
6-
- AVOSCloudIM/_NOARC (= 8.0.0)
7-
- AVOSCloudIM/_ARC (8.0.0):
8-
- AVOSCloud (= 8.0.0)
9-
- AVOSCloudIM/_NOARC (= 8.0.0)
10-
- AVOSCloudIM/_NOARC (8.0.0):
11-
- AVOSCloud (= 8.0.0)
2+
- AVOSCloud (8.0.4)
3+
- AVOSCloudIM (8.0.4):
4+
- AVOSCloud (= 8.0.4)
5+
- AVOSCloudIM/_ARC (= 8.0.4)
6+
- AVOSCloudIM/_NOARC (= 8.0.4)
7+
- AVOSCloudIM/_ARC (8.0.4):
8+
- AVOSCloud (= 8.0.4)
9+
- AVOSCloudIM/_NOARC (= 8.0.4)
10+
- AVOSCloudIM/_NOARC (8.0.4):
11+
- AVOSCloud (= 8.0.4)
1212
- ChatKit (2.0.0):
13-
- AVOSCloud (~> 8.0.0)
14-
- AVOSCloudIM (~> 8.0.0)
13+
- AVOSCloud (~> 8.0.4)
14+
- AVOSCloudIM (~> 8.0.4)
1515
- CYLDeallocBlockExecutor (~> 1.1.2)
1616
- DACircularProgress (~> 2.3.1)
1717
- FDStackView (~> 1.0)
@@ -65,9 +65,9 @@ EXTERNAL SOURCES:
6565
:path: ../
6666

6767
SPEC CHECKSUMS:
68-
AVOSCloud: c79e2b8dcdf5676442f3d7d04a45068af1cfb10f
69-
AVOSCloudIM: e48f54840a216a1a341ce2d75d47c20ace4e16e8
70-
ChatKit: 95dc20970f263d31330059561cf8769bc7859487
68+
AVOSCloud: 645f20b77cdcc0622a45c663c1a5735a17d1df27
69+
AVOSCloudIM: 182e93f9e6e3ad165c6fd67d8c01d15f561a7538
70+
ChatKit: 5c1e12b04919974ed4eeb7455d45861d99212390
7171
CYLDeallocBlockExecutor: ecf39e45dcead9e120f460df5668b8f5093d178e
7272
CYLTabBarController: 8d99fccf22866fe18c978c5ff863dc6051da45ff
7373
DACircularProgress: 4dd437c0fc3da5161cb289e07ac449493d41db71

ChatKit.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ChatKit"
3-
s.version = "2.0.0"
3+
s.version = "2.0.1"
44
s.summary = "An IM App Framework, support sending text, pictures, audio, video, location messaging, managing address book, more interesting features."
55
s.homepage = "https://github.com/LeanCloud/ChatKit-OC"
66
s.license = { :type => 'MIT', :file => 'LICENSE' }
@@ -13,8 +13,8 @@ Pod::Spec.new do |s|
1313
s.resources = 'ChatKit/Class/Resources/*', 'ChatKit/**/*.xib'
1414

1515
s.requires_arc = true
16-
s.dependency "AVOSCloud" , "~> 8.0.0"
17-
s.dependency "AVOSCloudIM", "~> 8.0.0"
16+
s.dependency "AVOSCloud" , "~> 8.0.4"
17+
s.dependency "AVOSCloudIM", "~> 8.0.4"
1818
s.dependency "MJRefresh" , "~> 3.1.9"
1919
s.dependency "Masonry" , "~> 1.0.1"
2020
s.dependency "SDWebImage" , "~> 3.8.0"

0 commit comments

Comments
 (0)