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

Commit

Permalink
Merge pull request #368 from zapcannon87/master
Browse files Browse the repository at this point in the history
Release v2.0.1
  • Loading branch information
zapcannon87 authored Dec 4, 2017
2 parents 5966feb + 4855481 commit c4a447c
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 82 deletions.
8 changes: 2 additions & 6 deletions ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 = "<group>"; };
9AB37B251DC86A60000782F2 /* ChatKit 自定义样式.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = "ChatKit 自定义样式.md"; path = "../../../../../ChatKit 自定义样式.md"; sourceTree = "<group>"; };
9AB37B261DC86A60000782F2 /* ChatKit 自定义业务.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = "ChatKit 自定义业务.md"; path = "../../../../../ChatKit 自定义业务.md"; sourceTree = "<group>"; };
9AB37B271DC86A60000782F2 /* ChatKit.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ChatKit.podspec; path = ../../../../../ChatKit.podspec; sourceTree = "<group>"; };
9AB37B281DC86A60000782F2 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../../../README.md; sourceTree = "<group>"; };
9AB37B291DC86A60000782F2 /* REDPACKET.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = REDPACKET.md; path = ../../../../../REDPACKET.md; sourceTree = "<group>"; };
9AB37B2F1DC86A6E000782F2 /* issue_template.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = issue_template.md; path = ../../../../../.github/issue_template.md; sourceTree = "<group>"; };
Expand Down Expand Up @@ -211,6 +209,7 @@
9AC3A4DC1DF9C8BD00F3405F /* LCCKUserGroupItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCCKUserGroupItemCell.m; sourceTree = "<group>"; };
9AC3A4E01DF9CE0300F3405F /* LCCKChatDetailHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCCKChatDetailHelper.h; sourceTree = "<group>"; };
9AC3A4E11DF9CE0300F3405F /* LCCKChatDetailHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCCKChatDetailHelper.m; sourceTree = "<group>"; };
D3D1667D1FD4EBB90019FDFF /* ChatKit.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = ChatKit.podspec; path = ../ChatKit.podspec; sourceTree = "<group>"; };
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>"; };
E7586C4E1D630681000C18B4 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -442,7 +441,6 @@
9AB37B301DC86A6E000782F2 /* pull_request_template.md */,
9AB37B251DC86A60000782F2 /* ChatKit 自定义样式.md */,
9AB37B261DC86A60000782F2 /* ChatKit 自定义业务.md */,
9AB37B271DC86A60000782F2 /* ChatKit.podspec */,
9AB37B281DC86A60000782F2 /* README.md */,
9AB37B291DC86A60000782F2 /* REDPACKET.md */,
);
Expand Down Expand Up @@ -565,6 +563,7 @@
isa = PBXGroup;
children = (
9A4CBADB1DB87F2000E61C92 /* ChatKit-OC.entitlements */,
D3D1667D1FD4EBB90019FDFF /* ChatKit.podspec */,
9A4730281CECAEC500AEB86F /* Example */,
9A754D4C1CECAC3E000967F1 /* Products */,
578A4ED63A7AFF3EA27EF73A /* Frameworks */,
Expand Down Expand Up @@ -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 /* [email protected] in Resources */,
9A4730681CECAEC500AEB86F /* LCCKLoginViewController.xib in Resources */,
Expand Down Expand Up @@ -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\"",
Expand Down Expand Up @@ -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\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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);
}

Expand All @@ -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));
}

Expand All @@ -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;
Expand Down Expand Up @@ -337,16 +337,16 @@ - (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;
}

#pragma mark Decomposing Dates
- (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;
}

Expand Down
101 changes: 55 additions & 46 deletions ChatKit-OC/Example/LCChatKitExample+Setting.m
Original file line number Diff line number Diff line change
Expand Up @@ -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提示设置
Expand Down
30 changes: 15 additions & 15 deletions ChatKit-OC/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ChatKit.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand All @@ -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"
Expand Down

0 comments on commit c4a447c

Please sign in to comment.