@@ -51,27 +51,18 @@ public class RNFetchBlobFS {
51
51
/**
52
52
* Static method that returns system folders to JS context
53
53
* @param ctx React Native application context
54
- * @param callback Javascript callback function
55
54
*/
56
- static public void getSystemfolders (ReactApplicationContext ctx , Callback callback ) {
57
- callback .invoke (
58
- // document folder
59
- ctx .getFilesDir ().getAbsolutePath (),
60
- // cache folder
61
- ctx .getCacheDir ().getAbsolutePath (),
62
- // SD card folder
63
- Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_DCIM ).getAbsolutePath (),
64
- // Download folder
65
- Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_DOWNLOADS ).getAbsolutePath (),
66
- // Picture
67
- Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_PICTURES ).getAbsolutePath (),
68
- // Music
69
- Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_MUSIC ).getAbsolutePath (),
70
- // Movies
71
- Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_MOVIES ).getAbsolutePath (),
72
- // Ringtones
73
- Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_RINGTONES ).getAbsolutePath ()
74
- );
55
+ static public Map <String , Object > getSystemfolders (ReactApplicationContext ctx ) {
56
+ Map <String , Object > res = new HashMap <>();
57
+ res .put ("DocumentDir" , ctx .getFilesDir ().getAbsolutePath ());
58
+ res .put ("CacheDir" , ctx .getCacheDir ().getAbsolutePath ());
59
+ res .put ("DCIMDir" , Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_DCIM ).getAbsolutePath ());
60
+ res .put ("PictureDir" , Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_PICTURES ).getAbsolutePath ());
61
+ res .put ("MusicDir" , Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_MUSIC ).getAbsolutePath ());
62
+ res .put ("DownloadDir" , Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_DOWNLOADS ).getAbsolutePath ());
63
+ res .put ("MovieDir" , Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_MOVIES ).getAbsolutePath ());
64
+ res .put ("RingtoneDir" , Environment .getExternalStoragePublicDirectory (Environment .DIRECTORY_RINGTONES ).getAbsolutePath ());
65
+ return res ;
75
66
}
76
67
77
68
/**
@@ -431,7 +422,7 @@ void scanFile(String [] path, String[] mimes, final Callback callback) {
431
422
Intent scanFileIntent = new Intent (
432
423
Intent .ACTION_MEDIA_SCANNER_SCAN_FILE , uri );
433
424
mCtx .sendBroadcast (scanFileIntent );
434
- callback .invoke ();
425
+ callback .invoke (null , true );
435
426
}
436
427
}
437
428
0 commit comments