Skip to content

Commit

Permalink
Merge pull request #1118 from Aylie-Chou/bug-cannot-share-to-line
Browse files Browse the repository at this point in the history
Set correct file type to intent after download file from uri & solve issue#1115
  • Loading branch information
EddyVerbruggen committed Aug 30, 2020
2 parents 7c070c7 + 6191590 commit 5c385d0
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 5c385d0

Please sign in to comment.