Explorar o código

添加发送消息状态回调

heavyrian2012 %!s(int64=3) %!d(string=hai) anos
pai
achega
a156563281

+ 5 - 5
nativeplugins/wf-uni-wfc-client/ios/WFChatClient.xcframework/Info.plist

@@ -6,30 +6,30 @@
 	<array>
 		<dict>
 			<key>LibraryIdentifier</key>
-			<string>ios-arm64_x86_64-simulator</string>
+			<string>ios-arm64</string>
 			<key>LibraryPath</key>
 			<string>WFChatClient.framework</string>
 			<key>SupportedArchitectures</key>
 			<array>
 				<string>arm64</string>
-				<string>x86_64</string>
 			</array>
 			<key>SupportedPlatform</key>
 			<string>ios</string>
-			<key>SupportedPlatformVariant</key>
-			<string>simulator</string>
 		</dict>
 		<dict>
 			<key>LibraryIdentifier</key>
-			<string>ios-arm64</string>
+			<string>ios-arm64_x86_64-simulator</string>
 			<key>LibraryPath</key>
 			<string>WFChatClient.framework</string>
 			<key>SupportedArchitectures</key>
 			<array>
 				<string>arm64</string>
+				<string>x86_64</string>
 			</array>
 			<key>SupportedPlatform</key>
 			<string>ios</string>
+			<key>SupportedPlatformVariant</key>
+			<string>simulator</string>
 		</dict>
 	</array>
 	<key>CFBundlePackageType</key>

BIN=BIN
nativeplugins/wf-uni-wfc-client/ios/WFChatClient.xcframework/ios-arm64/WFChatClient.framework/WFChatClient


BIN=BIN
nativeplugins/wf-uni-wfc-client/ios/WFClientUniPlugin.xcframework/ios-arm64/WFClientUniPlugin.framework/WFClientUniPlugin


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
uni-iOS-SDK/HBuilder-uniPluginDemo/HBuilder-Hello/Pandora/apps/__UNI__BE5CC7E/www/app-config-service.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
uni-iOS-SDK/HBuilder-uniPluginDemo/HBuilder-Hello/Pandora/apps/__UNI__BE5CC7E/www/app-service.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
uni-iOS-SDK/HBuilder-uniPluginDemo/HBuilder-Hello/Pandora/apps/__UNI__BE5CC7E/www/app-view.js


+ 39 - 2
uni-iOS-SDK/HBuilder-uniPluginDemo/WFClientUniPlugin/WFClientUniPlugin/ClientModule.m

@@ -81,8 +81,11 @@ UNI_EXPORT_METHOD_SYNC(@selector(connect:userId:token:))
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onChannelInfoUpdated:) name:kChannelInfoUpdated object:nil];
 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUserOnlineStateUpdated:) name:kUserOnlineStateUpdated object:nil];
-
-
+    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMediaUploadProgress:) name:kUploadMediaMessageProgresse object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMessageStatusUpdated:) name:kSendingMessageStatusUpdated object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMessageUpdated:) name:kMessageUpdated object:nil];
+    
     return [[WFCCNetworkService sharedInstance] connect:userId token:token];
 }
 //
@@ -2357,6 +2360,40 @@ UNI_EXPORT_METHOD(@selector(createChannel:portrait:desc:extra:success:error:))
     [self onIndication:@[@"onUserOnlineStateUpdated", [self convertModelListToString:events]]];
 }
 
+- (void)onMediaUploadProgress:(NSNotification *)notification {
+    WFCCMessage *msg = notification.userInfo[@"message"];
+    BOOL finish = [notification.userInfo[@"finish"] boolValue];
+    if(finish) {
+        NSString *remoteUrl = notification.userInfo[@"remoteUrl"];
+        [self onIndication:@[@"onMediaUpload", msg.toJsonStr, remoteUrl]];
+    } else {
+        int uploaded = [notification.userInfo[@"uploaded"] intValue];
+        int total = [notification.userInfo[@"total"] intValue];
+        [self onIndication:@[@"onProgress", msg.toJsonStr, @(uploaded), @(total)]];
+    }
+}
+
+- (void)onMessageStatusUpdated:(NSNotification *)notification {
+    int status = [notification.userInfo[@"status"] intValue];
+    WFCCMessage *msg = notification.userInfo[@"message"];
+    
+    if(status == Message_Status_Sent) {
+        [self onIndication:@[@"onSendSuccess", msg.toJsonStr]];
+    } else if(status == Message_Status_Send_Failure) {
+        int errorCode = [notification.userInfo[@"errorCode"] intValue];
+        [self onIndication:@[@"onSendFail", msg.toJsonStr, @(errorCode)]];
+    } else if(status == Message_Status_Sending) {
+        int64_t saveTime = [notification.userInfo[@"saveTime"] longLongValue];
+        [self onIndication:@[@"onSendPrepare", msg.toJsonStr, @(saveTime)]];
+    }
+}
+
+- (void)onMessageUpdated:(NSNotification *)notification {
+    long messageId = [notification.object longValue];
+    WFCCMessage *msg = [[WFCCIMService sharedWFCIMService] getMessage:messageId];
+    [self onIndication:@[@"onMessageUpdate", msg.toJsonStr]];
+}
+
 - (WFCCConversation *)conversationFromJsonString:(NSString *)strConv {
     NSError *__error = nil;
     NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:[strConv dataUsingEncoding:NSUTF8StringEncoding]

+ 5 - 5
uni-iOS-SDK/HBuilder-uniPluginDemo/WF_SDK/WFChatClient.xcframework/Info.plist

@@ -6,30 +6,30 @@
 	<array>
 		<dict>
 			<key>LibraryIdentifier</key>
-			<string>ios-arm64_x86_64-simulator</string>
+			<string>ios-arm64</string>
 			<key>LibraryPath</key>
 			<string>WFChatClient.framework</string>
 			<key>SupportedArchitectures</key>
 			<array>
 				<string>arm64</string>
-				<string>x86_64</string>
 			</array>
 			<key>SupportedPlatform</key>
 			<string>ios</string>
-			<key>SupportedPlatformVariant</key>
-			<string>simulator</string>
 		</dict>
 		<dict>
 			<key>LibraryIdentifier</key>
-			<string>ios-arm64</string>
+			<string>ios-arm64_x86_64-simulator</string>
 			<key>LibraryPath</key>
 			<string>WFChatClient.framework</string>
 			<key>SupportedArchitectures</key>
 			<array>
 				<string>arm64</string>
+				<string>x86_64</string>
 			</array>
 			<key>SupportedPlatform</key>
 			<string>ios</string>
+			<key>SupportedPlatformVariant</key>
+			<string>simulator</string>
 		</dict>
 	</array>
 	<key>CFBundlePackageType</key>

BIN=BIN
uni-iOS-SDK/HBuilder-uniPluginDemo/WF_SDK/WFChatClient.xcframework/ios-arm64/WFChatClient.framework/WFChatClient


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio