Stop download functionality #45

Merged
akinwale merged 4 commits from stop-downloading into master 2018-03-30 13:11:53 +02:00
3 changed files with 7 additions and 3 deletions
Showing only changes of commit 7c8a5c2c00 - Show all commits

View file

@ -75189,6 +75189,8 @@ __d(function (global, require, module, exports, _dependencyMap) {
}); });
_reactNative.NativeModules.LbryDownloadManager.stopDownload(uri, fileInfo.file_name); _reactNative.NativeModules.LbryDownloadManager.stopDownload(uri, fileInfo.file_name);
dispatch(doDeleteFile(fileInfo.outpoint, uri));
}; };
} }
@ -75390,6 +75392,7 @@ __d(function (global, require, module, exports, _dependencyMap) {
}); });
}, _this.onStopDownloadPressed = function () { }, _this.onStopDownloadPressed = function () {
var _this$props2 = _this.props, var _this$props2 = _this.props,
deleteFile = _this$props2.deleteFile,
stopDownload = _this$props2.stopDownload, stopDownload = _this$props2.stopDownload,
fileInfo = _this$props2.fileInfo, fileInfo = _this$props2.fileInfo,
navigation = _this$props2.navigation; navigation = _this$props2.navigation;

View file

@ -1 +1 @@
”;9―V•0Ο\3yQoίψΞs +]ח~wֳהש|דב/<05>ב²€/ֽ

View file

@ -49,8 +49,7 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
NotificationCompat.Builder builder = new NotificationCompat.Builder(context); NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setContentTitle(String.format("Downloading %s...", fileName)) builder.setContentTitle(String.format("Downloading %s...", fileName))
.setSmallIcon(R.drawable.ic_file_download_black_24dp) .setSmallIcon(R.drawable.ic_file_download_black_24dp)
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW);
.setOngoing(true);
builder.setProgress(MAX_PROGRESS, 0, false); builder.setProgress(MAX_PROGRESS, 0, false);
@ -99,6 +98,8 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
} }
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
NotificationCompat.Builder builder = builders.get(notificationId);
builder.setOngoing(false);
notificationManager.cancel(notificationId); notificationManager.cancel(notificationId);
downloadIdNotificationIdMap.remove(id); downloadIdNotificationIdMap.remove(id);