Skip to content

Commit

Permalink
Merge pull request #14408 from nextcloud/backport/14407/stable-3.30
Browse files Browse the repository at this point in the history
[stable-3.30] Request Media Location and Storage Permissions in the Action of the ReEnableAutoUploadDialog
  • Loading branch information
tobiasKaminsky authored Jan 14, 2025
2 parents ba6b01c + 1574ffc commit e362c66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ class MediaFoldersDetectionWork constructor(

private fun sendAutoUploadNotification() {
val notificationId = randomIdGenerator.nextInt()
val intent = Intent().apply {
setClassName(context, FileDisplayActivity::class.java.name)
setAction(FileDisplayActivity.AUTO_UPLOAD_NOTIFICATION)
val intent = Intent(context, FileDisplayActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
action = FileDisplayActivity.AUTO_UPLOAD_NOTIFICATION
}
val pendingIntent = PendingIntent.getActivity(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,18 +655,20 @@ protected void onNewIntent(Intent intent) {
setLeftFragment(new GroupfolderListFragment());
getSupportFragmentManager().executePendingTransactions();
} else if (AUTO_UPLOAD_NOTIFICATION.equals(intent.getAction())) {
handleAutoUploadNotification();
showReEnableAutoUploadDialog();
}
}
}

private void handleAutoUploadNotification() {
private void showReEnableAutoUploadDialog() {
new MaterialAlertDialogBuilder(this, R.style.Theme_ownCloud_Dialog)
.setTitle(R.string.re_enable_auto_upload)
.setMessage(R.string.re_enable_auto_upload_desc)
.setNegativeButton(R.string.dialog_close, (dialog, which) -> {
dialog.dismiss();
PermissionUtil.requestExternalStoragePermission(this, viewThemeUtils);
PermissionUtil.requestMediaLocationPermission(this);
preferences.setAutoUploadGPlayNotificationShown(true);
dialog.dismiss();
})
.setIcon(R.drawable.nav_synced_folders)
.create()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,6 @@
<string name="upload_gplay">Permission changes</string>
<string name="upload_gplay_desc">A new permission is required to access location information for uploaded images.\nMake sure that media access is set to \"Always allow all\".</string>
<string name="re_enable_auto_upload">Changes to auto upload</string>
<string name="re_enable_auto_upload_desc">Due to new restrictions imposed by Google, we have been forced to remove an important permission. We are currently working with Google to resolve this issue and restore full functionality.\n\nTo re-enable auto upload for new photos and videos:\nSelect \"Allow all\" in the following dialogue or the system settings.\nAllow Nextcloud to use location when prompted, as this allows us to store location when uploading images.\n\nAuto upload will no longer be able to upload any other files when using the Google Play version of the Nextcloud app.\n\nPlease check for any files that may not have been uploaded since December 2024.</string>
<string name="re_enable_auto_upload_desc">Due to new restrictions imposed by Google, we have been forced to remove an important permission. We are currently working with Google to resolve this issue and restore full functionality.\n\nTo re-enable auto upload for new photos and videos:\nSelect \"Allow all\" in the following dialogue or the system settings.\nAllow media location when prompted, as this allows Nextcloud to store location data when uploading images.\n\nAuto upload will only be able to upload image and video files when using the Google Play version of the Nextcloud app.\n\nPlease check for any files that may not have been uploaded since December 2024.</string>
<string name="click_to_learn_how_to_re_enable_auto_uploads">Manual intervention required to re-enable auto-upload</string>
</resources>

0 comments on commit e362c66

Please sign in to comment.