Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett committed Aug 7, 2024
2 parents e08fb76 + b13d07d commit bafa194
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 1 deletion.
9 changes: 9 additions & 0 deletions OpenIMSDK/Callbacker/OIMCallbacker+Closure.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ NS_ASSUME_NONNULL_BEGIN
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
onConversationUserInputStatusChanged:(nullable OIMInputStatusChangedCallback)onConversationUserInputStatusChanged;

/**
* Set friend relationship listeners
*
Expand Down
18 changes: 17 additions & 1 deletion OpenIMSDK/Callbacker/OIMCallbacker+Closure.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,30 @@ - (void)setConversationListenerWithOnSyncServerStart:(OIMBoolCallback)onSyncServ
onSyncServerFinish:(OIMBoolCallback)onSyncServerFinish
onSyncServerFailed:(OIMBoolCallback)onSyncServerFailed
onSyncServerProgress:(OIMNumberCallback)onSyncServerProgress
onConversationChanged:(OIMConversationsInfoCallback)onConversationChanged onNewConversation:(OIMConversationsInfoCallback)onNewConversation onTotalUnreadMessageCountChanged:(OIMNumberCallback)onTotalUnreadMessageCountChanged{
onConversationChanged:(OIMConversationsInfoCallback)onConversationChanged onNewConversation:(OIMConversationsInfoCallback)onNewConversation onTotalUnreadMessageCountChanged:(OIMNumberCallback)onTotalUnreadMessageCountChanged {
[self setConversationListenerWithOnSyncServerStart:onSyncServerStart
onSyncServerFinish:onSyncServerFinish
onSyncServerFailed:onSyncServerFailed
onSyncServerProgress: onSyncServerProgress
onConversationChanged:onConversationChanged
onNewConversation:onNewConversation
onTotalUnreadMessageCountChanged:onTotalUnreadMessageCountChanged
onConversationUserInputStatusChanged:nil];
}

- (void)setConversationListenerWithOnSyncServerStart:(OIMBoolCallback)onSyncServerStart
onSyncServerFinish:(OIMBoolCallback)onSyncServerFinish
onSyncServerFailed:(OIMBoolCallback)onSyncServerFailed
onSyncServerProgress:(OIMNumberCallback)onSyncServerProgress
onConversationChanged:(OIMConversationsInfoCallback)onConversationChanged onNewConversation:(OIMConversationsInfoCallback)onNewConversation onTotalUnreadMessageCountChanged:(OIMNumberCallback)onTotalUnreadMessageCountChanged onConversationUserInputStatusChanged:(OIMInputStatusChangedCallback)onConversationUserInputStatusChanged {
self.syncServerStart = onSyncServerStart;
self.syncServerFinish = onSyncServerFinish;
self.syncServerFailed = onSyncServerFailed;
self.syncServerProgress = onSyncServerProgress;
self.onConversationChanged = onConversationChanged;
self.onNewConversation = onNewConversation;
self.onTotalUnreadMessageCountChanged = onTotalUnreadMessageCountChanged;
self.onConversationUserInputStatusChanged = onConversationUserInputStatusChanged;
}

- (void)setFriendListenerWithOnBlackAdded:(OIMBlackInfoCallback)onBlackAdded
Expand Down
8 changes: 8 additions & 0 deletions OpenIMSDK/Callbacker/OIMCallbacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ typedef void (^OIMRevokedCallback)(OIMMessageRevokedInfo * _Nullable msgRovoked)

typedef void (^OIMGetAdvancedHistoryMessageListCallback)(OIMGetAdvancedHistoryMessageListInfo * _Nullable result);

typedef void (^OIMInputStatusChangedCallback)(NSArray<NSNumber *> *inputStatesChangedData);

/// IMSDK Core Callbacks
@protocol OIMSDKListener <NSObject>
@optional
Expand Down Expand Up @@ -263,6 +265,11 @@ typedef void (^OIMGetAdvancedHistoryMessageListCallback)(OIMGetAdvancedHistoryMe
*/
- (void)onTotalUnreadMessageCountChanged:(NSInteger)totalUnreadCount;

/**
* User input status updates.
*/
- (void)onConversationUserInputStatusChanged:(OIMInputStatusChangedData *)inputStatusChangedData;

@end

/// Advanced Message Listener
Expand Down Expand Up @@ -405,6 +412,7 @@ Open_im_sdk_callbackOnCustomBusinessListener
@property (nonatomic, nullable, copy) OIMConversationsInfoCallback onNewConversation;
@property (nonatomic, nullable, copy) OIMConversationsInfoCallback onConversationChanged;
@property (nonatomic, nullable, copy) OIMNumberCallback onTotalUnreadMessageCountChanged;
@property (nonatomic, nullable, copy) OIMInputStatusChangedCallback onConversationUserInputStatusChanged;

/**
* Add conversation listener.
Expand Down
22 changes: 22 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Conversation.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,28 @@ NS_ASSUME_NONNULL_BEGIN
- (void)searchConversation:(NSString *)name
onSuccess:(nullable OIMConversationsInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

/**
* Typing status for one-on-one chat
*
* @param conversationID Receiver's ID
* @param focus Customized tip message
*/
- (void)changeInputStates:(NSString *)conversationID
focus:(BOOL)focus
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

/**
* Typing status for one-on-one chat
*
* @param conversationID Conversation's ID
* @param userID User's ID
*/
- (void)getInputstates:(NSString *)conversationID
userID:(NSString *)userID
onSuccess:(nullable OIMInputStatusChangedCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
@end

NS_ASSUME_NONNULL_END
22 changes: 22 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Conversation.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,26 @@ - (void)searchConversation:(NSString *)name

Open_im_sdkSearchConversation(callback, [self operationId], name);
}

- (void)changeInputStates:(NSString *)conversationID
focus:(BOOL)focus
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure {
CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:onSuccess onFailure:onFailure];

Open_im_sdkChangeInputStates(callback, [self operationId], conversationID, focus);
}

- (void)getInputstates:(NSString *)conversationID
userID:(NSString *)userID
onSuccess:(OIMInputStatusChangedCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure {
CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) {
if (onSuccess) {
onSuccess(data.mj_JSONObject);
}
} onFailure:onFailure];

Open_im_sdkGetInputStates(callback, [self operationId], conversationID, userID);
}
@end
12 changes: 12 additions & 0 deletions OpenIMSDK/Model/OIMConversationInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,16 @@ NS_ASSUME_NONNULL_BEGIN

@end

/// input status Information
///
@interface OIMInputStatusChangedData : NSObject

@property (nonatomic, copy) NSString *conversationID;

@property (nonatomic, copy) NSString *userID;
// OIMPlatform
@property (nonatomic, copy) NSArray<NSNumber *> *platformIDs;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions OpenIMSDK/Model/OIMConversationInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ @implementation OIMConversationInfo
@implementation OIMConversationNotDisturbInfo

@end

@implementation OIMInputStatusChangedData

@end

0 comments on commit bafa194

Please sign in to comment.