Skip to content

Commit

Permalink
Request Write instead of Read permission.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Jul 17, 2020
1 parent 6c8530c commit 9906e69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ public void startDownload(@NonNull DownloadJob job, @SettingsStore.Storage int s
}

if (mDownloadManager != null) {
mDownloadManager.enqueue(request);
try {
mDownloadManager.enqueue(request);
} catch (SecurityException e) {
notifyDownloadError("Cannot create output file", job.getFilename());
return;
}
scheduleUpdates();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ private void downloadEnvironment(@NonNull String envId) {
DownloadJob job = DownloadJob.create(environment.getPayload());
@SettingsStore.Storage int storage = SettingsStore.getInstance(mContext).getDownloadsStorage();
if (storage == SettingsStore.EXTERNAL &&
!mApplicationDelegate.isPermissionGranted(android.Manifest.permission.READ_EXTERNAL_STORAGE)) {
!mApplicationDelegate.isPermissionGranted(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
mApplicationDelegate.requestPermission(
job.getUri(),
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
new GeckoSession.PermissionDelegate.Callback() {
@Override
public void grant() {
Expand Down

0 comments on commit 9906e69

Please sign in to comment.