Skip to content

Commit

Permalink
[Summary] fix video&file cannot share to line
Browse files Browse the repository at this point in the history
[Type] fix
[Scope] ios/android
[Bug]
[Phenomemon]

[Reason]

[Changes]
ios: remove filename wrapping quotes
android: set correct file type to intent

[Announcement]
  • Loading branch information
Aylie committed Aug 21, 2020
1 parent 7c070c7 commit 6191590
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/android/nl/xservices/plugins/SocialSharing.java
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ private Uri getFileUriAndSetType(Intent sendIntent, String dir, String image, St
}
}
saveFile(getBytes(connection.getInputStream()), dir, filename);
// update file type
String fileType = getMIMEType(image);
sendIntent.setType(fileType);
} else {
saveFile(getBytes(webView.getContext().getAssets().open(image)), dir, filename);
}
Expand Down
4 changes: 3 additions & 1 deletion src/ios/SocialSharing.m
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,9 @@ -(NSString*) storeInFile: (NSString*) fileName
fileData: (NSData*) fileData {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:fileName];
// remove filename wrapping quotes
NSString *filenameWithoutQuote = [fileName stringByReplacingOccurrencesOfString:@"'" withString:@""];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:filenameWithoutQuote];
[fileData writeToFile:filePath atomically:YES];
_tempStoredFile = filePath;
return filePath;
Expand Down

0 comments on commit 6191590

Please sign in to comment.