|
@@ -165,7 +165,7 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
|
165
|
165
|
if (options.addAndroidDownloads.getBoolean("useDownloadManager")) {
|
166
|
166
|
Uri uri = Uri.parse(url);
|
167
|
167
|
DownloadManager.Request req = new DownloadManager.Request(uri);
|
168
|
|
- if(options.addAndroidDownloads.getBoolean("notification")) {
|
|
168
|
+ if(options.addAndroidDownloads.hasKey("notification") && options.addAndroidDownloads.getBoolean("notification")) {
|
169
|
169
|
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
170
|
170
|
} else {
|
171
|
171
|
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
|
|
@@ -562,11 +562,13 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
|
562
|
562
|
String utf8 = new String(b);
|
563
|
563
|
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, utf8);
|
564
|
564
|
}
|
565
|
|
- // This usually mean the data is contains invalid unicode characters, it's
|
566
|
|
- // binary data
|
|
565
|
+ // This usually mean the data is contains invalid unicode characters but still valid data,
|
|
566
|
+ // it's binary data, so send it as a normal string
|
567
|
567
|
catch(CharacterCodingException ignored) {
|
|
568
|
+
|
568
|
569
|
if(responseFormat == ResponseFormat.UTF8) {
|
569
|
|
- callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, "");
|
|
570
|
+ String utf8 = new String(b);
|
|
571
|
+ callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, utf8);
|
570
|
572
|
}
|
571
|
573
|
else {
|
572
|
574
|
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_BASE64, android.util.Base64.encodeToString(b, Base64.NO_WRAP));
|