diff --git a/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj b/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj index 457f64e4..a0c5a1d2 100644 --- a/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj +++ b/ChatKit-OC/ChatKit-OC.xcodeproj/project.pbxproj @@ -209,7 +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 = ""; }; + D3D1667D1FD4EBB90019FDFF /* ChatKit.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = ChatKit.podspec; path = ../ChatKit.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 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 */ @@ -730,9 +730,7 @@ 9A754D481CECAC3E000967F1 /* Frameworks */, 9A754D491CECAC3E000967F1 /* Resources */, 9A1AD17B1CEDE640000FF26E /* Embed Frameworks */, - B3D3A07CFC7415F038843CA3 /* [CP] Embed Pods Frameworks */, B2766B2FC2AFFF07E341B315 /* [CP] Copy Pods Resources */, - B1F7010B803B7915B1D2C045 /* 📦 Embed Pods Frameworks */, 5852033203B0746EE8645654 /* 📦 Copy Pods Resources */, ); buildRules = ( @@ -863,21 +861,6 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - B1F7010B803B7915B1D2C045 /* 📦 Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ChatKit-OC/Pods-ChatKit-OC-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; B2766B2FC2AFFF07E341B315 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -899,7 +882,7 @@ "${PODS_ROOT}/../../ChatKit/Class/Resources/VoiceMessageSource.bundle", "${PODS_ROOT}/../../ChatKit/Class/Module/ContactList/View/LCCKContactCell.xib", "${PODS_ROOT}/MJRefresh/MJRefresh/MJRefresh.bundle", - "$PODS_CONFIGURATION_BUILD_DIR/MWPhotoBrowser/MWPhotoBrowser.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/MWPhotoBrowser/MWPhotoBrowser.bundle", "${PODS_ROOT}/RedPacketAlipay/AlipaySDK.bundle", "${PODS_ROOT}/RedpacketLib/RedpacketStaticLib/resources/RedPacketResource.bundle", "${PODS_ROOT}/TWMessageBarManager/Classes/Icons/icon-error.png", @@ -911,69 +894,35 @@ ); name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AVOSCloud_Art.inc", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/BarButtonIcon.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ChatKeyboard.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/DateTools.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Emoji.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/LCCKPBLocalizations.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/LCCKPhotoBrowser.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MBProgressHUD.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MessageBubble.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Other.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Placeholder.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/VoiceMessageSource.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/LCCKContactCell.nib", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MJRefresh.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MWPhotoBrowser.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AlipaySDK.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RedPacketResource.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/icon-error.png", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/icon-error@2x.png", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/icon-info.png", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/icon-info@2x.png", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/icon-success.png", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/icon-success@2x.png", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ChatKit-OC/Pods-ChatKit-OC-resources.sh\"\n"; showEnvVarsInLog = 0; }; - B3D3A07CFC7415F038843CA3 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-ChatKit-OC/Pods-ChatKit-OC-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/AVOSCloud/AVOSCloud.framework", - "${BUILT_PRODUCTS_DIR}/AVOSCloudIM/AVOSCloudIM.framework", - "${BUILT_PRODUCTS_DIR}/CYLDeallocBlockExecutor/CYLDeallocBlockExecutor.framework", - "${BUILT_PRODUCTS_DIR}/CYLTabBarController/CYLTabBarController.framework", - "${BUILT_PRODUCTS_DIR}/ChatKit/ChatKit.framework", - "${BUILT_PRODUCTS_DIR}/DACircularProgress/DACircularProgress.framework", - "${BUILT_PRODUCTS_DIR}/FDStackView/FDStackView.framework", - "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", - "${BUILT_PRODUCTS_DIR}/FTPopOverMenu/FTPopOverMenu.framework", - "${BUILT_PRODUCTS_DIR}/FXForms/FXForms.framework", - "${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework", - "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework", - "${BUILT_PRODUCTS_DIR}/MLLabel/MLLabel.framework", - "${BUILT_PRODUCTS_DIR}/MLPAutoCompleteTextField/MLPAutoCompleteTextField.framework", - "${BUILT_PRODUCTS_DIR}/MWPhotoBrowser/MWPhotoBrowser.framework", - "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework", - "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", - "${BUILT_PRODUCTS_DIR}/TWMessageBarManager/TWMessageBarManager.framework", - "${BUILT_PRODUCTS_DIR}/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework", - "${BUILT_PRODUCTS_DIR}/pop/pop.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AVOSCloud.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AVOSCloudIM.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CYLDeallocBlockExecutor.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CYLTabBarController.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ChatKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DACircularProgress.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FDStackView.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FTPopOverMenu.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FXForms.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MBProgressHUD.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MLLabel.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MLPAutoCompleteTextField.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MWPhotoBrowser.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TWMessageBarManager.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UITableView_FDTemplateLayoutCell.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/pop.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ChatKit-OC/Pods-ChatKit-OC-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; CDA6F8A69927C83B20C33EBD /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/ChatKit-OC/ChatKit-OC.xcodeproj/xcshareddata/xcschemes/ChatKit-OC.xcscheme b/ChatKit-OC/ChatKit-OC.xcodeproj/xcshareddata/xcschemes/ChatKit-OC.xcscheme index 815089da..70a27346 100644 --- a/ChatKit-OC/ChatKit-OC.xcodeproj/xcshareddata/xcschemes/ChatKit-OC.xcscheme +++ b/ChatKit-OC/ChatKit-OC.xcodeproj/xcshareddata/xcschemes/ChatKit-OC.xcscheme @@ -26,7 +26,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" shouldUseLaunchSchemeArgsEnv = "YES"> @@ -46,7 +45,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" @@ -64,16 +62,6 @@ - - - - + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ChatKit-OC/Example/LCChatKitExample+Setting.m b/ChatKit-OC/Example/LCChatKitExample+Setting.m index d0ca5768..6f2b571d 100644 --- a/ChatKit-OC/Example/LCChatKitExample+Setting.m +++ b/ChatKit-OC/Example/LCChatKitExample+Setting.m @@ -700,23 +700,23 @@ - (void)lcck_markReadStatusAtIndexPath:(NSIndexPath *)indexPath conversation:(AVIMConversation *)conversation controller:(LCCKConversationListViewController *)controller { NSString *conversationId = conversation.conversationId; - if (conversation.lcck_unreadCount > 0) { - if (title) { - *title = @"标记为已读"; - } - *handler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) { - [controller.tableView setEditing:NO animated:YES]; - [[LCChatKit sharedInstance] updateUnreadCountToZeroWithConversationId:conversationId]; - }; - } else { - if (title) { - *title = @"标记为未读"; - } - *handler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) { - [controller.tableView setEditing:NO animated:YES]; - [[LCChatKit sharedInstance] increaseUnreadCountWithConversationId:conversationId]; - }; + if (title) { + *title = @"标记为已读"; } + *handler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) { + [controller.tableView setEditing:NO animated:YES]; + [[LCChatKit sharedInstance] updateUnreadCountToZeroWithConversationId:conversationId]; + }; +// if (conversation.lcck_unreadCount > 0) { +// } else { +// if (title) { +// *title = @"标记为未读"; +// } +// *handler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) { +// [controller.tableView setEditing:NO animated:YES]; +// [[LCChatKit sharedInstance] increaseUnreadCountWithConversationId:conversationId]; +// }; +// } } #pragma mark 页面跳转 diff --git a/ChatKit-OC/Podfile b/ChatKit-OC/Podfile index bcaf2419..b42b2cca 100644 --- a/ChatKit-OC/Podfile +++ b/ChatKit-OC/Podfile @@ -6,8 +6,6 @@ target 'ChatKit-OC' do #======================== Lib Dependency ================= #========================================================= pod 'ChatKit', :path => '../' -# pod 'AVOSCloud', :path => '../../objc-sdk' -# pod 'AVOSCloudIM', :path => '../../objc-sdk' #========================================================= #======================== Demo Dependency ================ diff --git a/ChatKit-OC/Podfile.lock b/ChatKit-OC/Podfile.lock index 679465a2..5747216d 100644 --- a/ChatKit-OC/Podfile.lock +++ b/ChatKit-OC/Podfile.lock @@ -1,17 +1,17 @@ PODS: - - AVOSCloud (8.2.0) - - AVOSCloudIM (8.2.0): - - AVOSCloud (= 8.2.0) - - AVOSCloudIM/_ARC (= 8.2.0) - - AVOSCloudIM/_NOARC (= 8.2.0) - - AVOSCloudIM/_ARC (8.2.0): - - AVOSCloud (= 8.2.0) - - AVOSCloudIM/_NOARC (= 8.2.0) - - AVOSCloudIM/_NOARC (8.2.0): - - AVOSCloud (= 8.2.0) - - ChatKit (2.0.3): - - AVOSCloud (~> 8.2.0) - - AVOSCloudIM (~> 8.2.0) + - AVOSCloud (11.1.2) + - AVOSCloudIM (11.1.2): + - AVOSCloud (= 11.1.2) + - AVOSCloudIM/_ARC (= 11.1.2) + - AVOSCloudIM/_NOARC (= 11.1.2) + - AVOSCloudIM/_ARC (11.1.2): + - AVOSCloud (= 11.1.2) + - AVOSCloudIM/_NOARC (= 11.1.2) + - AVOSCloudIM/_NOARC (11.1.2): + - AVOSCloud (= 11.1.2) + - ChatKit (2.1.0): + - AVOSCloud (~> 11.1.1) + - AVOSCloudIM (~> 11.1.1) - CYLDeallocBlockExecutor (~> 1.1.2) - DACircularProgress (~> 2.3.1) - FDStackView (~> 1.0) @@ -22,11 +22,11 @@ PODS: - MWPhotoBrowser (~> 2.1.2) - pop (~> 1.0.9) - SDWebImage (~> 3.8.0) - - UITableView+FDTemplateLayoutCell (~> 1.5.beta) + - "UITableView+FDTemplateLayoutCell (~> 1.5.beta)" - CYLDeallocBlockExecutor (1.1.2) - CYLTabBarController (1.9.0) - DACircularProgress (2.3.1) - - FDStackView (1.0) + - FDStackView (1.0.1) - FMDB (2.6.2): - FMDB/standard (= 2.6.2) - FMDB/standard (2.6.2) @@ -34,13 +34,13 @@ PODS: - FXForms (1.2.14) - Masonry (1.0.2) - MBProgressHUD (0.9.2) - - MJRefresh (3.1.15.1) + - MJRefresh (3.1.15.3) - MLLabel (1.9.2) - MLPAutoCompleteTextField (1.5) - MWPhotoBrowser (2.1.2): - DACircularProgress (~> 2.3) - MBProgressHUD (~> 0.9) - - SDWebImage (!= 3.7.2, ~> 3.7) + - "SDWebImage (!= 3.7.2, ~> 3.7)" - pop (1.0.10) - RedPacketAlipay (15.0.2) - RedpacketLib (3.4.1): @@ -49,7 +49,7 @@ PODS: - SDWebImage/Core (= 3.8.2) - SDWebImage/Core (3.8.2) - TWMessageBarManager (1.8.1) - - UITableView+FDTemplateLayoutCell (1.6) + - "UITableView+FDTemplateLayoutCell (1.6)" DEPENDENCIES: - ChatKit (from `../`) @@ -60,24 +60,48 @@ DEPENDENCIES: - RedpacketLib (= 3.4.1) - TWMessageBarManager (= 1.8.1) +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - AVOSCloud + - AVOSCloudIM + - CYLDeallocBlockExecutor + - CYLTabBarController + - DACircularProgress + - FDStackView + - FMDB + - FTPopOverMenu + - FXForms + - Masonry + - MBProgressHUD + - MJRefresh + - MLLabel + - MLPAutoCompleteTextField + - MWPhotoBrowser + - pop + - RedPacketAlipay + - RedpacketLib + - SDWebImage + - TWMessageBarManager + - "UITableView+FDTemplateLayoutCell" + EXTERNAL SOURCES: ChatKit: - :path: ../ + :path: "../" SPEC CHECKSUMS: - AVOSCloud: c28318404ce474e722e09c8ac103fc58b2610074 - AVOSCloudIM: 62c0d6307df41ce682f7cf11463254cc49318e24 - ChatKit: 4ae53ec69e88025a529b7e7b5e95a2f68564e2e5 + AVOSCloud: 855a0f1e3458f3ed99d8099e1f88e2ff8da127d2 + AVOSCloudIM: 006eac3a7b027b41e67d8ec4237543af41be902e + ChatKit: 6178db4a372d84ded9cf848ab94f3375344f699c CYLDeallocBlockExecutor: ecf39e45dcead9e120f460df5668b8f5093d178e CYLTabBarController: 8d99fccf22866fe18c978c5ff863dc6051da45ff DACircularProgress: 4dd437c0fc3da5161cb289e07ac449493d41db71 - FDStackView: 3a4bbe0ce9c35e974246a585168b9da8c32213f1 + FDStackView: fc0697e5be2022c8af36ce66e9e2061006058ba8 FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a FTPopOverMenu: 4b412a331990fc1169c50104f1aa44b8cd4c5c4a FXForms: 724500c0c3f3eb3ba1004b3b83abcee55d3daf18 Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1 - MJRefresh: 5f8552bc25ca8751c010f621c1098dbdaacbccd6 + MJRefresh: b48380ae2b927b46c4ef000de9adb8dc748e1df7 MLLabel: df58127ce0bd1f87890ecc3232db77a85ce4cd97 MLPAutoCompleteTextField: ba4d507bbff2bd4f139d4197814fc8dd39caf77e MWPhotoBrowser: 5836d7aa041dc05a13de380c246826578adc5ea5 @@ -86,8 +110,8 @@ SPEC CHECKSUMS: RedpacketLib: e15853d93ac35141a1247b6ad79d6acb731d8704 SDWebImage: 098e97e6176540799c27e804c96653ee0833d13c TWMessageBarManager: fd84e7948ba7968a2b5d9454859135761214ec56 - UITableView+FDTemplateLayoutCell: 5c949b4a5059c404b442926c0e80f81d10a2d66f + "UITableView+FDTemplateLayoutCell": 5c949b4a5059c404b442926c0e80f81d10a2d66f -PODFILE CHECKSUM: d16020c2760c0b23c86274a3c4bed9aa620de53a +PODFILE CHECKSUM: 0c9077ef2ff9a92e0adcca86bcabd425df220379 -COCOAPODS: 1.3.1 +COCOAPODS: 1.5.3 diff --git a/ChatKit.podspec b/ChatKit.podspec index 16ba0c5a..e97c6c4c 100644 --- a/ChatKit.podspec +++ b/ChatKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ChatKit" - s.version = "2.1.0" + s.version = "2.1.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.2.0" - s.dependency "AVOSCloudIM", "~> 8.2.0" + s.dependency "AVOSCloud" , "~> 11.1.2" + s.dependency "AVOSCloudIM", "~> 11.1.2" s.dependency "MJRefresh" , "~> 3.1.9" s.dependency "Masonry" , "~> 1.0.1" s.dependency "SDWebImage" , "~> 3.8.0" diff --git a/ChatKit/Class/Model/LCCKMessage.m b/ChatKit/Class/Model/LCCKMessage.m index 3561febd..69abfce2 100644 --- a/ChatKit/Class/Model/LCCKMessage.m +++ b/ChatKit/Class/Model/LCCKMessage.m @@ -301,9 +301,9 @@ + (id)messageWithAVIMTypedMessage:(AVIMTypedMessage *)message { NSString *duration = [NSString stringWithFormat:@"%.0f", audioMsg.duration]; NSString *voicePath; NSFileManager *fileManager = [NSFileManager defaultManager]; - NSString *pathForFile = audioMsg.file.localPath; + NSString *pathForFile = audioMsg.file.persistentCachePath; if ([fileManager fileExistsAtPath:pathForFile]){ - voicePath = audioMsg.file.localPath; + voicePath = audioMsg.file.persistentCachePath; } else { voicePath = audioMsg.file.url; } @@ -322,11 +322,11 @@ + (id)messageWithAVIMTypedMessage:(AVIMTypedMessage *)message { } case kAVIMMessageMediaTypeImage: { AVIMImageMessage *imageMsg = (AVIMImageMessage *)message; - NSString *pathForFile = imageMsg.file.localPath; + NSString *pathForFile = imageMsg.file.persistentCachePath; NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *imagePath; if ([fileManager fileExistsAtPath:pathForFile]){ - imagePath = imageMsg.file.localPath; + imagePath = imageMsg.file.persistentCachePath; } lcckMessage = [[LCCKMessage alloc] initWithPhoto:nil thumbnailPhoto:nil photoPath:imagePath thumbnailURL:nil originPhotoURL:[NSURL URLWithString:imageMsg.file.url] senderId:senderId sender:sender timestamp:time serverMessageId:serverMessageId]; break; diff --git a/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.h b/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.h index 23cf9a8d..ba3c59b0 100644 --- a/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.h +++ b/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.h @@ -21,7 +21,7 @@ /** * 未读消息数,保存在了数据库。收消息的时候,更新数据库 */ -@property (nonatomic, assign) NSInteger lcck_unreadCount; +@property (nonatomic, assign, readonly) NSInteger lcck_unreadCount; /*! * 如果未读消息数未超出100,显示数字,否则显示省略号 @@ -32,7 +32,7 @@ * 是否有人提到了你,配合 @ 功能。不能看最后一条消息。 * 因为可能倒数第二条消息提到了你,所以维护一个标记。 */ -@property (nonatomic, assign) BOOL lcck_mentioned; +@property (nonatomic, assign, readonly) BOOL lcck_mentioned; /*! * 草稿 diff --git a/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.m b/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.m index 337c011b..ecd64adc 100644 --- a/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.m +++ b/ChatKit/Class/Module/Conversation/Model/AVIMConversation+LCCKExtension.m @@ -46,9 +46,9 @@ - (NSDate *)lcck_lastMessageAt { return isServerLate ? dateFromServer : dateFromCache; } -- (NSInteger)lcck_unreadCount { - NSNumber *lcck_unreadCountObject = objc_getAssociatedObject(self, @selector(lcck_unreadCount)); - return [lcck_unreadCountObject intValue]; +- (NSInteger)lcck_unreadCount +{ + return self.unreadMessagesCount; } - (NSString *)lcck_badgeText { @@ -62,20 +62,20 @@ - (NSString *)lcck_badgeText { return badgeText; } -- (void)setLcck_unreadCount:(NSInteger)lcck_unreadCount { - NSNumber *lcck_unreadCountObject = [NSNumber numberWithInteger:lcck_unreadCount]; - objc_setAssociatedObject(self, @selector(lcck_unreadCount), lcck_unreadCountObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} +//- (void)setLcck_unreadCount:(NSInteger)lcck_unreadCount { +// NSNumber *lcck_unreadCountObject = [NSNumber numberWithInteger:lcck_unreadCount]; +// objc_setAssociatedObject(self, @selector(lcck_unreadCount), lcck_unreadCountObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +//} -- (BOOL)lcck_mentioned { - NSNumber *lcck_mentionedObject = objc_getAssociatedObject(self, @selector(lcck_mentioned)); - return [lcck_mentionedObject boolValue]; +- (BOOL)lcck_mentioned +{ + return self.unreadMessagesMentioned; } -- (void)setLcck_mentioned:(BOOL)lcck_mentioned { - NSNumber *lcck_mentionedObject = [NSNumber numberWithBool:lcck_mentioned]; - objc_setAssociatedObject(self, @selector(lcck_mentioned), lcck_mentionedObject, OBJC_ASSOCIATION_ASSIGN); -} +//- (void)setLcck_mentioned:(BOOL)lcck_mentioned { +// NSNumber *lcck_mentionedObject = [NSNumber numberWithBool:lcck_mentioned]; +// objc_setAssociatedObject(self, @selector(lcck_mentioned), lcck_mentionedObject, OBJC_ASSOCIATION_ASSIGN); +//} - (NSString *)lcck_draft { return objc_getAssociatedObject(self, @selector(lcck_draft)); diff --git a/ChatKit/Class/Module/Conversation/Model/LCCKConversationViewModel.m b/ChatKit/Class/Module/Conversation/Model/LCCKConversationViewModel.m index 71ac903d..1e10e59d 100644 --- a/ChatKit/Class/Module/Conversation/Model/LCCKConversationViewModel.m +++ b/ChatKit/Class/Module/Conversation/Model/LCCKConversationViewModel.m @@ -644,6 +644,8 @@ - (void)loadMessagesFirstTimeWithCallback:(LCCKIdBoolResultBlock)callback { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { BOOL succeed = [self.parentConversationViewController filterAVIMError:error]; if (succeed) { + [[self currentConversation] readInBackground]; + [[self currentConversation] setUnreadMessagesMentioned:false]; NSMutableArray *lcckSucceedMessags = [NSMutableArray lcck_messagesWithAVIMMessages:avimTypedMessages]; [self addMessagesFirstTime:lcckSucceedMessags]; NSMutableArray *allMessages = [NSMutableArray arrayWithArray:avimTypedMessages]; diff --git a/ChatKit/Class/Tool/Service/LCCKConversationService.m b/ChatKit/Class/Tool/Service/LCCKConversationService.m index e17e6137..2e9379aa 100644 --- a/ChatKit/Class/Tool/Service/LCCKConversationService.m +++ b/ChatKit/Class/Tool/Service/LCCKConversationService.m @@ -264,7 +264,7 @@ - (void)updateUnreadCountToZeroWithConversationId:(NSString *)conversationId { - (void)updateUnreadCountToZeroWithConversationId:(NSString *)conversationId shouldRefreshWhenFinished:(BOOL)shouldRefreshWhenFinished { AVIMConversation *cachedConversation = [self.conversationDictionary objectForKey:conversationId]; - cachedConversation.lcck_unreadCount = 0; + [cachedConversation readInBackground]; dispatch_async(self.sqliteQueue, ^{ [self.databaseQueue inDatabase:^(FMDatabase *db) { [db executeUpdate:LCCKConversationTableUpdateUnreadCountSQL withArgumentsInArray:@[@0, conversationId]]; @@ -342,7 +342,7 @@ - (void)increaseUnreadCountWithConversationId:(NSString *)conversationId { - (void)increaseUnreadCountWithConversationId:(NSString *)conversationId shouldRefreshWhenFinished:(BOOL)shouldRefreshWhenFinished { AVIMConversation *cachedConversation = [self.conversationDictionary objectForKey:conversationId]; - cachedConversation.lcck_unreadCount += 1; +// cachedConversation.lcck_unreadCount += 1; dispatch_async(self.sqliteQueue, ^{ [self.databaseQueue inDatabase:^(FMDatabase *db) { [db executeUpdate:LCCKConversationTableIncreaseOneUnreadCountSQL withArgumentsInArray:@[conversationId]]; @@ -354,7 +354,7 @@ - (void)increaseUnreadCountWithConversationId:(NSString *)conversationId shouldR } - (void)increaseUnreadCount:(NSUInteger)increaseUnreadCount withConversationId:(NSString *)conversationId shouldRefreshWhenFinished:(BOOL)shouldRefreshWhenFinished { AVIMConversation *cachedConversation = [self.conversationDictionary objectForKey:conversationId]; - cachedConversation.lcck_unreadCount += increaseUnreadCount; +// cachedConversation.lcck_unreadCount += increaseUnreadCount; dispatch_async(self.sqliteQueue, ^{ [self.databaseQueue inDatabase:^(FMDatabase *db) { [db executeUpdate:LCCKConversationTableIncreaseUnreadCountSQL withArgumentsInArray:@[@(increaseUnreadCount) ,conversationId]]; @@ -370,7 +370,7 @@ - (void)updateMentioned:(BOOL)mentioned conversationId:(NSString *)conversationI - (void)updateMentioned:(BOOL)mentioned conversationId:(NSString *)conversationId shouldRefreshWhenFinished:(BOOL)shouldRefreshWhenFinished { AVIMConversation *cachedConversation = [self.conversationDictionary objectForKey:conversationId]; - cachedConversation.lcck_mentioned = mentioned; +// cachedConversation.lcck_mentioned = mentioned; dispatch_async(self.sqliteQueue, ^{ [self.databaseQueue inDatabase:^(FMDatabase *db) { [db executeUpdate:LCCKConversationTableUpdateMentionedSQL withArgumentsInArray:@[@(mentioned), conversationId]]; @@ -409,8 +409,8 @@ - (AVIMConversation *)createConversationFromResultSet:(FMResultSet *)resultSet { BOOL mentioned = [resultSet boolForColumn:LCCKConversationTableKeyMentioned]; NSString *draft = [resultSet stringForColumn:LCCKConversationTableKeyDraft]; AVIMConversation *conversation = [self conversationFromData:data]; - conversation.lcck_unreadCount = unreadCount; - conversation.lcck_mentioned = mentioned; +// conversation.lcck_unreadCount = unreadCount; +// conversation.lcck_mentioned = mentioned; conversation.lcck_draft = draft; [self pinIMClientToConversationIfNeeded:conversation]; return conversation; @@ -429,9 +429,9 @@ - (void)updateRecentConversation:(NSArray *)conversations shouldRefreshWhenFinis for (AVIMConversation *conversation in conversations) { AVIMConversation *cachedConversation = [self.conversationDictionary objectForKey:conversation.conversationId]; if (cachedConversation) { - conversation.lcck_unreadCount = cachedConversation.lcck_unreadCount; +// conversation.lcck_unreadCount = cachedConversation.lcck_unreadCount; conversation.lcck_draft = [cachedConversation.lcck_draft copy]; - conversation.lcck_mentioned = cachedConversation.lcck_mentioned; +// conversation.lcck_mentioned = cachedConversation.lcck_mentioned; [self.conversationDictionary setObject:conversation forKey:conversation.conversationId]; } } @@ -745,38 +745,46 @@ - (void)queryTypedMessagesWithConversation:(AVIMConversation *)conversation }); } -+ (void)cacheFileTypeMessages:(NSArray *)messages callback:(AVBooleanResultBlock)callback { - NSString *queueBaseLabel = [NSString stringWithFormat:@"com.chatkit.%@", NSStringFromClass([self class])]; - const char *queueName = [[NSString stringWithFormat:@"%@.ForBarrier",queueBaseLabel] UTF8String]; - dispatch_queue_t queue = dispatch_queue_create(queueName, DISPATCH_QUEUE_CONCURRENT); - - for (AVIMTypedMessage *message in messages) { - dispatch_async(queue, ^(void) { ++ (void)cacheFileTypeMessages:(NSArray *)messages callback:(AVBooleanResultBlock)callback +{ + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + dispatch_group_t downloadGroup = dispatch_group_create(); + for (AVIMTypedMessage *message in messages) { + dispatch_group_enter(downloadGroup); if (message.mediaType == kAVIMMessageMediaTypeImage || message.mediaType == kAVIMMessageMediaTypeAudio) { AVFile *file = message.file; - if (file && file.isDataAvailable == NO) { - NSError *error; - // 下载到本地 - NSData *data = [file getData:&error]; - if (error || data == nil) { - LCCKLog(@"download file error : %@", error); - } + if (file) { + [file downloadWithCompletionHandler:^(NSURL * _Nullable filePath, NSError * _Nullable error) { + dispatch_group_leave(downloadGroup); + if (error) { LCCKLog(@"download file error : %@", error); } + }]; + } else { + dispatch_group_leave(downloadGroup); } } else if (message.mediaType == kAVIMMessageMediaTypeVideo) { NSString *path = [[LCCKSettingService sharedInstance] videoPathOfMessage:(AVIMVideoMessage *)message]; if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { - NSError *error; - NSData *data = [message.file getData:&error]; - if (error) { - LCCKLog(@"download file error : %@", error); + AVFile *file = message.file; + if (file) { + [file downloadWithCompletionHandler:^(NSURL * _Nullable filePath, NSError * _Nullable error) { + dispatch_group_leave(downloadGroup); + if (error) { + LCCKLog(@"download file error : %@", error); + } else { + [NSFileManager.defaultManager copyItemAtPath:filePath.path toPath:path error:nil]; + } + }]; } else { - [data writeToFile:path atomically:YES]; + dispatch_group_leave(downloadGroup); } + } else { + dispatch_group_leave(downloadGroup); } + } else { + dispatch_group_leave(downloadGroup); } - }); - } - dispatch_barrier_async(queue, ^{ + } + dispatch_group_wait(downloadGroup, DISPATCH_TIME_FOREVER); dispatch_async(dispatch_get_main_queue(),^{ !callback ?: callback(YES, nil); }); diff --git a/ChatKit/Class/Tool/Service/LCCKSessionService.m b/ChatKit/Class/Tool/Service/LCCKSessionService.m index 42311b09..81d2877f 100644 --- a/ChatKit/Class/Tool/Service/LCCKSessionService.m +++ b/ChatKit/Class/Tool/Service/LCCKSessionService.m @@ -72,9 +72,7 @@ - (void)openWithClientId:(NSString *)clientId force:(BOOL)force callback:(AVIMBo if ([[LCChatKit sharedInstance] generateSignatureBlock]) { _client.signatureDataSource = self; } - AVIMClientOpenOption *option = [AVIMClientOpenOption new]; - option.force = force; - [_client openWithOption:option callback:^(BOOL succeeded, NSError *error) { + [_client openWithOption:AVIMClientOpenOptionForceOpen callback:^(BOOL succeeded, NSError *error) { [self updateConnectStatus]; BOOL isFirstLaunchForClientId = [[LCChatKit sharedInstance] lcck_isFirstLaunchToEvent:clientId @@ -277,9 +275,9 @@ - (void)conversation:(AVIMConversation *)conversation messageDelivered:(AVIMMess [self didReceiveStatusMessage:message conversation:conversation]; } -- (void)conversation:(AVIMConversation *)conversation messageRead:(AVIMMessage *)message { - [self didReceiveStatusMessage:message conversation:conversation]; -} +//- (void)conversation:(AVIMConversation *)conversation messageRead:(AVIMMessage *)message { +// [self didReceiveStatusMessage:message conversation:conversation]; +//} - (void)didReceiveStatusMessage:(AVIMMessage *)message conversation:(AVIMConversation *)conversation { if (!message.lcck_isValidMessage) { @@ -292,25 +290,45 @@ - (void)didReceiveStatusMessage:(AVIMMessage *)message conversation:(AVIMConvers [[NSNotificationCenter defaultCenter] postNotificationName:LCCKNotificationMessageDelivered object:userInfo]; } -- (void)conversation:(AVIMConversation *)conversation didReceiveUnread:(NSInteger)unread { - if (unread <= 0) return; - LCCKLog(@"conversatoin:%@ didReceiveUnread:%@", conversation, @(unread)); - void (^fetchedConversationCallback)() = ^() { - [conversation queryMessagesFromServerWithLimit:unread callback:^(NSArray *objects, NSError *error) { - if (!error && (objects.count > 0)) { - [self receiveMessages:objects conversation:conversation isUnreadMessage:YES]; - [conversation readInBackground]; - } - }]; - [self playLoudReceiveSoundIfNeededForConversation:conversation]; - // [conversation markAsReadInBackground]; - //FIXME: -// [conversation markAsReadInBackgroundForMessage:conversation.lcck_lastMessage]; - - }; - [self makeSureConversation:conversation isAvailableCallback:fetchedConversationCallback]; +- (void)conversation:(AVIMConversation *)conversation didUpdateForKey:(AVIMConversationUpdatedKey)key +{ + NSString *currentConversationId = LCCKConversationService.sharedInstance.currentConversationId; + NSString *conversationId = conversation.conversationId; + if ([key isEqualToString:AVIMConversationUpdatedKeyUnreadMessagesCount]) { + if ([currentConversationId isEqualToString:conversationId]) { + // do nothing. + } else { + [LCCKConversationService.sharedInstance insertRecentConversation:conversation shouldRefreshWhenFinished:true]; + } + } + if ([key isEqualToString:AVIMConversationUpdatedKeyUnreadMessagesMentioned]) { + if ([currentConversationId isEqualToString:conversationId]) { + // do nothing + } else { + [LCCKConversationService.sharedInstance insertRecentConversation:conversation shouldRefreshWhenFinished:true]; + } + } } +//- (void)conversation:(AVIMConversation *)conversation didReceiveUnread:(NSInteger)unread { +// if (unread <= 0) return; +// LCCKLog(@"conversatoin:%@ didReceiveUnread:%@", conversation, @(unread)); +// void (^fetchedConversationCallback)() = ^() { +// [conversation queryMessagesFromServerWithLimit:unread callback:^(NSArray *objects, NSError *error) { +// if (!error && (objects.count > 0)) { +// [self receiveMessages:objects conversation:conversation isUnreadMessage:YES]; +// [conversation readInBackground]; +// } +// }]; +// [self playLoudReceiveSoundIfNeededForConversation:conversation]; +// // [conversation markAsReadInBackground]; +// //FIXME: +//// [conversation markAsReadInBackgroundForMessage:conversation.lcck_lastMessage]; +// +// }; +// [self makeSureConversation:conversation isAvailableCallback:fetchedConversationCallback]; +//} + - (void)makeSureConversation:(AVIMConversation *)conversation isAvailableCallback:(LCCKVoidBlock)callback { if (!conversation.createAt && ![[LCCKConversationService sharedInstance] isRecentConversationExistWithConversationId:conversation.conversationId]) { [conversation fetchWithCallback:^(BOOL succeeded, NSError *error) { @@ -343,7 +361,7 @@ - (void)receiveMessage:(AVIMTypedMessage *)message conversation:(AVIMConversatio [[NSNotificationCenter defaultCenter] postNotificationName:LCCKNotificationCustomTransientMessageReceived object:userInfo]; } [self receiveMessages:@[message] conversation:conversation isUnreadMessage:NO]; - [conversation readInBackground]; +// [conversation readInBackground]; } - (void)receiveMessages:(NSArray *)messages conversation:(AVIMConversation *)conversation isUnreadMessage:(BOOL)isUnreadMessage { @@ -352,7 +370,7 @@ - (void)receiveMessages:(NSArray *)messages conversation:(AV // - 插入最近对话列表 // 下面的LCCKNotificationMessageReceived也会通知ConversationListVC刷新 [[LCCKConversationService sharedInstance] insertRecentConversation:conversation shouldRefreshWhenFinished:NO]; - [[LCCKConversationService sharedInstance] increaseUnreadCount:filterdMessages.count withConversationId:conversation.conversationId shouldRefreshWhenFinished:NO]; +// [[LCCKConversationService sharedInstance] increaseUnreadCount:filterdMessages.count withConversationId:conversation.conversationId shouldRefreshWhenFinished:NO]; // - 播放接收音 if (!isUnreadMessage) { [self playLoudReceiveSoundIfNeededForConversation:conversation]; @@ -367,8 +385,11 @@ - (void)receiveMessages:(NSArray *)messages conversation:(AV void(^filteredMessageCallback)(NSArray *originalMessages) = ^(NSArray *filterdMessages) { if (filterdMessages.count == 0) { return; } - // - 在最近对话列表页时,检查是否有人@我 - if (![[LCCKConversationService sharedInstance].currentConversationId isEqualToString:conversation.conversationId]) { + if ([LCCKConversationService.sharedInstance.currentConversationId isEqualToString:conversation.conversationId]) { + [conversation readInBackground]; + conversation.unreadMessagesMentioned = false; + !checkMentionedMessageCallback ?: checkMentionedMessageCallback(filterdMessages); + } else { // 没有在聊天的时候才增加未读数和设置mentioned [self isMentionedByMessages:filterdMessages callback:^(BOOL succeeded, NSError *error) { !checkMentionedMessageCallback ?: checkMentionedMessageCallback(filterdMessages); @@ -378,8 +399,6 @@ - (void)receiveMessages:(NSArray *)messages conversation:(AV // [[NSNotificationCenter defaultCenter] postNotificationName:LCCKNotificationUnreadsUpdated object:nil]; } }]; - } else { - !checkMentionedMessageCallback ?: checkMentionedMessageCallback(filterdMessages); } }; @@ -444,7 +463,7 @@ - (void)isMentionedByMessages:(NSArray *)messages callback:( NSString *queueBaseLabel = [NSString stringWithFormat:@"com.chatkit.%@", NSStringFromClass([self class])]; const char *queueName = [[NSString stringWithFormat:@"%@.%@.ForBarrier",queueBaseLabel, [[NSUUID UUID] UUIDString]] UTF8String]; dispatch_queue_t queue = dispatch_queue_create(queueName, DISPATCH_QUEUE_CONCURRENT); - + [messages enumerateObjectsUsingBlock:^(AVIMTypedMessage * _Nonnull message, NSUInteger idx, BOOL * _Nonnull stop) { if (![message isKindOfClass:[AVIMTextMessage class]]) { return; @@ -463,7 +482,7 @@ - (void)isMentionedByMessages:(NSArray *)messages callback:( } }); }]; - + dispatch_barrier_async(queue, ^{ //最后一个也没有提及就callback NSError *error = nil; @@ -481,7 +500,7 @@ - (void)isMentionedByMessages:(NSArray *)messages callback:( !callback ?: callback(isMentioned, error); }); }); - + }]; }