@@ -290,15 +290,14 @@ - (void)conversationChanged:(NSNotification *)notification {
290290 if ([[NSFileManager defaultManager ] fileExistsAtPath: mediaPath]){
291291 mediaPath = mediaPath;
292292 NSData *img = [NSData dataWithContentsOfFile: mediaPath];
293-
294- [JMSGUser updateMyInfoWithParameter : img userFieldType: kJMSGUserFieldsAvatar completionHandler: ^(id resultObject, NSError *error) {
295- if (!error) {
296- successCallback (@[]);
297- } else {
298- failCallback (@[[error errorToDictionary ]]);
299- }
293+
294+ [JMSGUser updateMyAvatarWithData : img avatarFormat: [mediaPath pathExtension ] completionHandler: ^(id resultObject, NSError *error) {
295+ if (!error) {
296+ successCallback (@[]);
297+ } else {
298+ failCallback (@[[error errorToDictionary ]]);
299+ }
300300 }];
301-
302301 } else {
303302 failCallback (@[[self getParamError ]]);
304303 }
@@ -323,6 +322,10 @@ - (void)conversationChanged:(NSNotification *)notification {
323322 info.signature = param[@" signature" ];
324323 }
325324
325+ if (param[@" extras" ]) {
326+ info.extras = param[@" extras" ];
327+ }
328+
326329 if (param[@" gender" ]) {
327330 if ([param[@" gender" ] isEqualToString: @" male" ]) {
328331 info.gender = kJMSGUserGenderMale ;
@@ -498,7 +501,7 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
498501
499502 if ([param[@" type" ] isEqual: @" single" ] && param[@" username" ] != nil ) {
500503 JMSGImageContent *content = [[JMSGImageContent alloc ] initWithImageData: [NSData dataWithContentsOfFile: mediaPath]];
501-
504+ content. format = [mediaPath pathExtension ];
502505 content.uploadHandler = ^(float percent, NSString *msgID) {
503506 [self .bridge.eventDispatcher sendAppEventWithName: uploadProgressEvent body: @{@" messageId" : msgID,
504507 @" progress" : @(percent)}];
@@ -529,7 +532,7 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
529532
530533 } else if ([param[@" type" ] isEqual: @" group" ] && param[@" groupId" ] != nil ) {
531534 JMSGImageContent *content = [[JMSGImageContent alloc ] initWithImageData: [NSData dataWithContentsOfFile: mediaPath]];
532-
535+ content. format = [mediaPath pathExtension ];
533536 content.uploadHandler = ^(float percent, NSString *msgID) {
534537
535538 [self .bridge.eventDispatcher sendAppEventWithName: uploadProgressEvent body: @{@" messageId" : msgID,
@@ -1946,6 +1949,7 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
19461949 }
19471950
19481951 if ([param[@" type" ] isEqualToString: @" single" ]) {
1952+
19491953 [JMSGConversation createSingleConversationWithUsername: param[@" username" ]
19501954 appKey: appKey
19511955 completionHandler: ^(id resultObject, NSError *error) {
@@ -2255,7 +2259,9 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
22552259 }
22562260
22572261 if ([param[@" messageType" ] isEqualToString: @" image" ]) {
2258- content = [[JMSGImageContent alloc ] initWithImageData: [NSData dataWithContentsOfFile: mediaPath]];
2262+ JMSGImageContent *imgContent = [[JMSGImageContent alloc ] initWithImageData: [NSData dataWithContentsOfFile: mediaPath]];
2263+ imgContent.format = [mediaPath pathExtension ];
2264+ content = imgContent;
22592265 }
22602266
22612267 if ([param[@" messageType" ] isEqualToString: @" voice" ]) {
@@ -2498,7 +2504,7 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
24982504
24992505 if ([[NSFileManager defaultManager ] fileExistsAtPath: mediaPath]){
25002506 mediaPath = mediaPath;
2501- NSData *img = [[ NSData dataWithContentsOfFile: mediaPath];
2507+ NSData *img = [NSData dataWithContentsOfFile: mediaPath];
25022508
25032509 [JMSGGroup updateGroupAvatarWithGroupId: param[@" id" ] avatarData: img avatarFormat: [mediaPath pathExtension ] completionHandler: ^(id resultObject, NSError *error) {
25042510 if (!error) {
0 commit comments