|
@@ -494,15 +494,20 @@ public class RNFetchBlobFS {
|
494
|
494
|
* @param paths An array of file paths.
|
495
|
495
|
* @param callback JS contest callback
|
496
|
496
|
*/
|
497
|
|
- static void removeSession(ReadableArray paths, Callback callback) {
|
|
497
|
+ static void removeSession(ReadableArray paths, final Callback callback) {
|
498
|
498
|
|
499
|
499
|
AsyncTask<ReadableArray, Integer, Integer> task = new AsyncTask<ReadableArray, Integer, Integer>() {
|
500
|
500
|
@Override
|
501
|
501
|
protected Integer doInBackground(ReadableArray ...paths) {
|
502
|
|
- for(int i =0; i< paths[0].size(); i++) {
|
503
|
|
- File f = new File(paths[0].getString(i));
|
504
|
|
- if(f.exists())
|
505
|
|
- f.delete();
|
|
502
|
+ try {
|
|
503
|
+ for (int i = 0; i < paths[0].size(); i++) {
|
|
504
|
+ File f = new File(paths[0].getString(i));
|
|
505
|
+ if (f.exists())
|
|
506
|
+ f.delete();
|
|
507
|
+ }
|
|
508
|
+ callback.invoke(null, true);
|
|
509
|
+ } catch(Exception err) {
|
|
510
|
+ callback.invoke(err.getLocalizedMessage());
|
506
|
511
|
}
|
507
|
512
|
return paths[0].size();
|
508
|
513
|
}
|