Browse Source

fix mediaType issue

imndx 3 months ago
parent
commit
58bff99fc7
1 changed files with 6 additions and 2 deletions
  1. 6 2
      imclient/lib/imclient_method_channel.dart

+ 6 - 2
imclient/lib/imclient_method_channel.dart

@@ -956,8 +956,12 @@ class ImclientPlatform extends PlatformInterface {
       payload.mentionedTargets = Tools.convertDynamicList(map['mentionedTargets']);
     }
 
-    if (map['mediaType'] != null && map['mediaType'] >= 0 && map['mediaType'] < 10) {
-      payload.mediaType = MediaType.values[map['mediaType']];
+    if (map['mediaType'] != null){
+     if( map['mediaType'] >= 0 && map['mediaType'] < 8) {
+       payload.mediaType = MediaType.values[map['mediaType']];
+     }else{
+       payload.mediaType = MediaType.Media_Type_GENERAL;
+     }
     }
     payload.remoteMediaUrl = map['remoteMediaUrl'];
     payload.localMediaPath = map['localMediaPath'];