diff --git a/Example/OpenIMSDKiOS.xcodeproj/project.pbxproj b/Example/OpenIMSDKiOS.xcodeproj/project.pbxproj index 6a1a389..c354217 100644 --- a/Example/OpenIMSDKiOS.xcodeproj/project.pbxproj +++ b/Example/OpenIMSDKiOS.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 06E322500E6F29AE7E3406B9 /* Pods_OpenIMSDKiOS_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC002E155A37FC7CD6D16335 /* Pods_OpenIMSDKiOS_Example.framework */; }; + 173F10BA2B3EDD49002826B9 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 173F10B92B3EDD49002826B9 /* libresolv.tbd */; }; 17918D0727BC8F380040C924 /* OPENIMSDKTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 17918D0627BC8F380040C924 /* OPENIMSDKTableViewCell.m */; }; 17CADD2727C7227F0069C80E /* photo_test.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 17CADD2527C7227F0069C80E /* photo_test.jpeg */; }; 17CADD2827C7227F0069C80E /* voice_test.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 17CADD2627C7227F0069C80E /* voice_test.m4a */; }; @@ -42,6 +43,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 173F10B92B3EDD49002826B9 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; 17918D0527BC8F380040C924 /* OPENIMSDKTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OPENIMSDKTableViewCell.h; sourceTree = ""; }; 17918D0627BC8F380040C924 /* OPENIMSDKTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OPENIMSDKTableViewCell.m; sourceTree = ""; }; 17CADD2527C7227F0069C80E /* photo_test.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = photo_test.jpeg; sourceTree = ""; }; @@ -82,6 +84,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 173F10BA2B3EDD49002826B9 /* libresolv.tbd in Frameworks */, 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, @@ -137,6 +140,7 @@ 6003F58C195388D20070C39A /* Frameworks */ = { isa = PBXGroup; children = ( + 173F10B92B3EDD49002826B9 /* libresolv.tbd */, 6003F58D195388D20070C39A /* Foundation.framework */, 6003F58F195388D20070C39A /* CoreGraphics.framework */, 6003F591195388D20070C39A /* UIKit.framework */, diff --git a/Example/OpenIMSDKiOS/OPENIMSDKViewController.m b/Example/OpenIMSDKiOS/OPENIMSDKViewController.m index 25b493c..ab26acd 100644 --- a/Example/OpenIMSDKiOS/OPENIMSDKViewController.m +++ b/Example/OpenIMSDKiOS/OPENIMSDKViewController.m @@ -67,7 +67,6 @@ - (void)viewDidLoad @[@{OIM_LIST_CELL_TITLE: @"Login", OIM_LIST_CELL_FUNC: @"login"}, @{OIM_LIST_CELL_TITLE: @"Login Status", OIM_LIST_CELL_FUNC: @"loginStatus"}, @{OIM_LIST_CELL_TITLE: @"Logout", OIM_LIST_CELL_FUNC: @"logout"}, - @{OIM_LIST_CELL_TITLE: @"Set Heartbeat", OIM_LIST_CELL_FUNC: @"setHeartbeatInterval"}, ], @[@{OIM_LIST_CELL_TITLE: @"Get User Info", OIM_LIST_CELL_FUNC: @"getSelfInfo"}, @@ -245,11 +244,13 @@ - (void)callback { }]; - [OIMManager.callbacker setConversationListenerWithOnSyncServerStart:^{ + [OIMManager.callbacker setConversationListenerWithOnSyncServerStart:^(BOOL result) { - } onSyncServerFinish:^{ + } onSyncServerFinish:^(BOOL result) { - } onSyncServerFailed:^{ + } onSyncServerFailed:^(BOOL result) { + + } onSyncServerProgress:^(NSInteger number) { } onConversationChanged:^(NSArray * _Nullable conversations) { @@ -307,6 +308,8 @@ - (void)initSDK { } onUserTokenExpired:^{ + } onUserTokenInvalid:^(NSString * _Nullable item) { + }]; } @@ -386,14 +389,6 @@ - (void)getUsersInfo { }]; } -- (void)setHeartbeatInterval { - [self operate:_cmd - todo:^(void (^callback)(NSNumber *code, NSString *msg)) { - - [OIMManager.manager setHeartbeatInterval:30]; - }]; -} - #pragma mark - #pragma mark - Friend diff --git a/OpenIMSDK.podspec b/OpenIMSDK.podspec index ceadafe..016b128 100644 --- a/OpenIMSDK.podspec +++ b/OpenIMSDK.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'OpenIMSDK' - s.version = '3.5.1+1' + s.version = '3.8.0-rc.16' s.summary = 'Open-IM-SDK' # This description is used to generate tags and improve search results. @@ -77,6 +77,6 @@ Pod::Spec.new do |s| s.static_framework = true - s.dependency 'OpenIMSDKCore', '3.5.1' + s.dependency 'OpenIMSDKCore', '3.8.0-rc.16' s.dependency 'MJExtension' end diff --git a/OpenIMSDK/Callbacker/OIMCallbacker+Closure.h b/OpenIMSDK/Callbacker/OIMCallbacker+Closure.h index 21c0c91..e0166af 100644 --- a/OpenIMSDK/Callbacker/OIMCallbacker+Closure.h +++ b/OpenIMSDK/Callbacker/OIMCallbacker+Closure.h @@ -18,9 +18,10 @@ NS_ASSUME_NONNULL_BEGIN * * Actively fetch conversation records at app startup, and later refresh data based on listener callbacks for conversation changes. */ -- (void)setConversationListenerWithOnSyncServerStart:(OIMVoidCallback)onSyncServerStart - onSyncServerFinish:(OIMVoidCallback)onSyncServerFinish - onSyncServerFailed:(OIMVoidCallback)onSyncServerFailed +- (void)setConversationListenerWithOnSyncServerStart:(OIMBoolCallback)onSyncServerStart + onSyncServerFinish:(OIMBoolCallback)onSyncServerFinish + onSyncServerFailed:(OIMBoolCallback)onSyncServerFailed + onSyncServerProgress:(OIMNumberCallback)onSyncServerProgress onConversationChanged:(OIMConversationsInfoCallback)onConversationChanged onNewConversation:(OIMConversationsInfoCallback)onNewConversation onTotalUnreadMessageCountChanged:(OIMNumberCallback)onTotalUnreadMessageCountChanged; diff --git a/OpenIMSDK/Callbacker/OIMCallbacker+Closure.m b/OpenIMSDK/Callbacker/OIMCallbacker+Closure.m index f6533fc..e77d32f 100644 --- a/OpenIMSDK/Callbacker/OIMCallbacker+Closure.m +++ b/OpenIMSDK/Callbacker/OIMCallbacker+Closure.m @@ -9,15 +9,15 @@ @implementation OIMCallbacker (Closure) -- (void)setConversationListenerWithOnSyncServerStart:(OIMVoidCallback)onSyncServerStart - onSyncServerFinish:(OIMVoidCallback)onSyncServerFinish - onSyncServerFailed:(OIMVoidCallback)onSyncServerFailed - onConversationChanged:(OIMConversationsInfoCallback)onConversationChanged - onNewConversation:(OIMConversationsInfoCallback)onNewConversation - onTotalUnreadMessageCountChanged:(OIMNumberCallback)onTotalUnreadMessageCountChanged { +- (void)setConversationListenerWithOnSyncServerStart:(OIMBoolCallback)onSyncServerStart + onSyncServerFinish:(OIMBoolCallback)onSyncServerFinish + onSyncServerFailed:(OIMBoolCallback)onSyncServerFailed + onSyncServerProgress:(OIMNumberCallback)onSyncServerProgress + onConversationChanged:(OIMConversationsInfoCallback)onConversationChanged onNewConversation:(OIMConversationsInfoCallback)onNewConversation onTotalUnreadMessageCountChanged:(OIMNumberCallback)onTotalUnreadMessageCountChanged{ self.syncServerStart = onSyncServerStart; self.syncServerFinish = onSyncServerFinish; self.syncServerFailed = onSyncServerFailed; + self.syncServerProgress = onSyncServerProgress; self.onConversationChanged = onConversationChanged; self.onNewConversation = onNewConversation; self.onTotalUnreadMessageCountChanged = onTotalUnreadMessageCountChanged; diff --git a/OpenIMSDK/Callbacker/OIMCallbacker.h b/OpenIMSDK/Callbacker/OIMCallbacker.h index a873c4c..7b1e46d 100644 --- a/OpenIMSDK/Callbacker/OIMCallbacker.h +++ b/OpenIMSDK/Callbacker/OIMCallbacker.h @@ -96,6 +96,8 @@ typedef void (^OIMGetAdvancedHistoryMessageListCallback)(OIMGetAdvancedHistoryMe */ - (void)onUserTokenExpired; +- (void)onUserTokenInvalid:(NSString *)errMsg; + @end /// User Status Callbacks @@ -232,17 +234,19 @@ typedef void (^OIMGetAdvancedHistoryMessageListCallback)(OIMGetAdvancedHistoryMe /** * Synchronization with the server has started for conversations. */ -- (void)onSyncServerStart; +- (void)onSyncServerStart:(BOOL)reInstall; + +- (void)onSyncServerProgress:(NSInteger)progress; /** * Synchronization with the server for conversations has completed. */ -- (void)onSyncServerFinish; +- (void)onSyncServerFinish:(BOOL)reInstall; /** * Synchronization with the server for conversations has failed. */ -- (void)onSyncServerFailed; +- (void)onSyncServerFailed:(BOOL)reInstall; /** * New conversations have been added. @@ -319,6 +323,7 @@ Open_im_sdk_callbackOnCustomBusinessListener @property (nonatomic, nullable, copy) OIMVoidCallback connectSuccess; @property (nonatomic, nullable, copy) OIMVoidCallback kickedOffline; @property (nonatomic, nullable, copy) OIMVoidCallback userTokenExpired; +@property (nonatomic, nullable, copy) OIMStringCallback userTokenInvalid; /** * Add IM SDK listener. @@ -393,9 +398,10 @@ Open_im_sdk_callbackOnCustomBusinessListener /// Conversation Listener /// Set after a successful InitSDK and before Login, called when conversation-related information changes. -@property (nonatomic, nullable, copy) OIMVoidCallback syncServerStart; -@property (nonatomic, nullable, copy) OIMVoidCallback syncServerFinish; -@property (nonatomic, nullable, copy) OIMVoidCallback syncServerFailed; +@property (nonatomic, nullable, copy) OIMBoolCallback syncServerStart; +@property (nonatomic, nullable, copy) OIMBoolCallback syncServerFinish; +@property (nonatomic, nullable, copy) OIMBoolCallback syncServerFailed; +@property (nonatomic, nullable, copy) OIMNumberCallback syncServerProgress; @property (nonatomic, nullable, copy) OIMConversationsInfoCallback onNewConversation; @property (nonatomic, nullable, copy) OIMConversationsInfoCallback onConversationChanged; @property (nonatomic, nullable, copy) OIMNumberCallback onTotalUnreadMessageCountChanged; diff --git a/OpenIMSDK/Callbacker/OIMCallbacker.m b/OpenIMSDK/Callbacker/OIMCallbacker.m index a739413..c253592 100644 --- a/OpenIMSDK/Callbacker/OIMCallbacker.m +++ b/OpenIMSDK/Callbacker/OIMCallbacker.m @@ -209,6 +209,16 @@ - (void)onUserTokenExpired { }]; } +- (void)onUserTokenInvalid:(NSString *)errMsg { + [self dispatchMainThread:^{ + if (self.userTokenInvalid) { + self.userTokenInvalid(errMsg); + } + + [self.sdkListeners onUserTokenInvalid:errMsg]; + }]; +} + #pragma mark - #pragma mark - User @@ -585,33 +595,43 @@ - (void)onNewConversation:(NSString * _Nullable)conversationList { }]; } -- (void)onSyncServerFailed { +- (void)onSyncServerFailed:(BOOL)reinstalled { [self dispatchMainThread:^{ if (self.syncServerFailed) { - self.syncServerFailed(); + self.syncServerFailed(reinstalled); } - [self.conversationListeners onSyncServerFailed]; + [self.conversationListeners onSyncServerFailed:reinstalled]; }]; } -- (void)onSyncServerFinish { +- (void)onSyncServerFinish:(BOOL)reinstalled { [self dispatchMainThread:^{ if (self.syncServerFinish) { - self.syncServerFinish(); + self.syncServerFinish(reinstalled); } - [self.conversationListeners onSyncServerFinish]; + [self.conversationListeners onSyncServerFinish:reinstalled]; + }]; +} + +- (void)onSyncServerStart:(BOOL)reinstalled { + [self dispatchMainThread:^{ + if (self.syncServerStart) { + self.syncServerStart(reinstalled); + } + + [self.conversationListeners onSyncServerStart:reinstalled]; }]; } -- (void)onSyncServerStart { +- (void)onSyncServerProgress:(long)progress { [self dispatchMainThread:^{ if (self.syncServerStart) { - self.syncServerStart(); + self.syncServerStart(progress); } - [self.conversationListeners onSyncServerStart]; + [self.conversationListeners onSyncServerProgress:progress]; }]; } diff --git a/OpenIMSDK/Interface/OIMManager+Connection.h b/OpenIMSDK/Interface/OIMManager+Connection.h index 022e18b..2f7cfb2 100644 --- a/OpenIMSDK/Interface/OIMManager+Connection.h +++ b/OpenIMSDK/Interface/OIMManager+Connection.h @@ -37,12 +37,8 @@ NS_ASSUME_NONNULL_BEGIN onConnectFailure:(OIMFailureCallback)onConnectFailure onConnectSuccess:(OIMVoidCallback)onConnectSuccess onKickedOffline:(OIMVoidCallback)onKickedOffline - onUserTokenExpired:(OIMVoidCallback)onUserTokenExpired; - -/** - * Set heartbeat interval - */ -- (void)setHeartbeatInterval:(NSInteger)heartbeatInterval; + onUserTokenExpired:(OIMVoidCallback)onUserTokenExpired + onUserTokenInvalid:(OIMStringCallback)onUserTokenInvalid; - (void)unInitSDK; diff --git a/OpenIMSDK/Interface/OIMManager+Connection.m b/OpenIMSDK/Interface/OIMManager+Connection.m index 251f21d..dce3e50 100644 --- a/OpenIMSDK/Interface/OIMManager+Connection.m +++ b/OpenIMSDK/Interface/OIMManager+Connection.m @@ -35,13 +35,15 @@ - (BOOL)initSDKWithConfig:(OIMInitConfig *)config onConnectFailure:(OIMFailureCallback)onConnectFailure onConnectSuccess:(OIMVoidCallback)onConnectSuccess onKickedOffline:(OIMVoidCallback)onKickedOffline - onUserTokenExpired:(OIMVoidCallback)onUserTokenExpired { + onUserTokenExpired:(OIMVoidCallback)onUserTokenExpired + onUserTokenInvalid:(OIMStringCallback)onUserTokenInvalid { [self class].callbacker.connecting = onConnecting; [self class].callbacker.connectFailure = onConnectFailure; [self class].callbacker.connectSuccess = onConnectSuccess; [self class].callbacker.kickedOffline = onKickedOffline; [self class].callbacker.userTokenExpired = onUserTokenExpired; + [self class].callbacker.userTokenInvalid = onUserTokenInvalid; NSMutableDictionary *param = [NSMutableDictionary new]; @@ -57,10 +59,6 @@ - (BOOL)initSDKWithConfig:(OIMInitConfig *)config return Open_im_sdkInitSDK([self class].callbacker, [self operationId], param.mj_JSONString); } -- (void)setHeartbeatInterval:(NSInteger)heartbeatInterval { - Open_im_sdkSetHeartbeatInterval(heartbeatInterval); -} - - (void)unInitSDK { Open_im_sdkUnInitSDK([self operationId]); } diff --git a/OpenIMSDK/Interface/OIMManager+Friend.h b/OpenIMSDK/Interface/OIMManager+Friend.h index 9866bd5..79dac7c 100644 --- a/OpenIMSDK/Interface/OIMManager+Friend.h +++ b/OpenIMSDK/Interface/OIMManager+Friend.h @@ -96,6 +96,11 @@ NS_ASSUME_NONNULL_BEGIN - (void)getFriendListWithOnSuccess:(nullable OIMFullUsersInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; +- (void)getFriendListPageWithOffset:(NSInteger)offset + count:(NSInteger)count + onSuccess:(nullable OIMFullUsersInfoCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure; + /** * Check if there is a friend relationship, i.e., if the user is in the friend list of the logged-in user. Note: Friendship is a two-way relationship. * A result of 1 means the user is a friend (and not in the blacklist). diff --git a/OpenIMSDK/Interface/OIMManager+Friend.m b/OpenIMSDK/Interface/OIMManager+Friend.m index e2fb09e..06ad8c0 100644 --- a/OpenIMSDK/Interface/OIMManager+Friend.m +++ b/OpenIMSDK/Interface/OIMManager+Friend.m @@ -122,6 +122,19 @@ - (void)getFriendListWithOnSuccess:(OIMFullUsersInfoCallback)onSuccess Open_im_sdkGetFriendList(callback, [self operationId]); } +- (void)getFriendListPageWithOffset:(NSInteger)offset + count:(NSInteger)count + onSuccess:(OIMFullUsersInfoCallback)onSuccess + onFailure:(OIMFailureCallback)onFailure { + CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { + if (onSuccess) { + onSuccess([OIMFullUserInfo mj_objectArrayWithKeyValuesArray:data]); + } + } onFailure:onFailure]; + + Open_im_sdkGetFriendListPage(callback, [self operationId], (int32_t)offset, (int32_t)count); +} + - (void)checkFriend:(NSArray *)usersID onSuccess:(OIMSimpleResultsCallback)onSuccess onFailure:(OIMFailureCallback)onFailure { diff --git a/OpenIMSDK/Interface/OIMManager+Group.h b/OpenIMSDK/Interface/OIMManager+Group.h index 1deed44..96f8cb5 100644 --- a/OpenIMSDK/Interface/OIMManager+Group.h +++ b/OpenIMSDK/Interface/OIMManager+Group.h @@ -51,6 +51,11 @@ NS_ASSUME_NONNULL_BEGIN - (void)getJoinedGroupListWithOnSuccess:(nullable OIMGroupsInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; +- (void)getJoinedGroupListPageWithOffset:(NSInteger)offset + count:(NSInteger)count + onSuccess:(nullable OIMGroupsInfoCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure; + /** * Batch get group information * @@ -296,6 +301,11 @@ NS_ASSUME_NONNULL_BEGIN - (void)isJoinedGroup:(NSString *)groupID onSuccess:(nullable OIMBoolCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure; + +- (void)getUsersInGroup:(NSString *)groupID + userIDs:(NSArray *)userIDs + onSuccess:(nullable OIMStringArrayCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure; @end NS_ASSUME_NONNULL_END diff --git a/OpenIMSDK/Interface/OIMManager+Group.m b/OpenIMSDK/Interface/OIMManager+Group.m index 901ee34..7605ef3 100644 --- a/OpenIMSDK/Interface/OIMManager+Group.m +++ b/OpenIMSDK/Interface/OIMManager+Group.m @@ -63,6 +63,19 @@ - (void)getJoinedGroupListWithOnSuccess:(OIMGroupsInfoCallback)onSuccess Open_im_sdkGetJoinedGroupList(callback, [self operationId]); } +- (void)getJoinedGroupListPageWithOffset:(NSInteger)offset + count:(NSInteger)count + onSuccess:(OIMGroupsInfoCallback)onSuccess + onFailure:(OIMFailureCallback)onFailure { + CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { + if (onSuccess) { + onSuccess([OIMGroupInfo mj_objectArrayWithKeyValuesArray:data]); + } + } onFailure:onFailure]; + + Open_im_sdkGetJoinedGroupListPage(callback, [self operationId], (int32_t)offset, (int32_t)count); +} + - (void)getSpecifiedGroupsInfo:(NSArray *)groupsID onSuccess:(nullable OIMGroupsInfoCallback)onSuccess onFailure:(nullable OIMFailureCallback)onFailure { @@ -332,4 +345,19 @@ - (void)isJoinedGroup:(NSString *)groupID Open_im_sdkIsJoinGroup(callback, [self operationId], groupID); } + +- (void)getUsersInGroup:(NSString *)groupID + userIDs:(NSArray *)userIDs + onSuccess:(nullable OIMStringArrayCallback)onSuccess + onFailure:(nullable OIMFailureCallback)onFailure { + CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) { + if (onSuccess) { + NSArray *users = data.mj_JSONObject; + onSuccess(nil, users); + } + } onFailure:onFailure]; + + Open_im_sdkGetUsersInGroup(callback, [self operationId], groupID, userIDs.mj_JSONString); +} + @end