Skip to content

Commit e362c66

Browse files
Merge pull request #14408 from nextcloud/backport/14407/stable-3.30
[stable-3.30] Request Media Location and Storage Permissions in the Action of the ReEnableAutoUploadDialog
2 parents ba6b01c + 1574ffc commit e362c66

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ class MediaFoldersDetectionWork constructor(
208208

209209
private fun sendAutoUploadNotification() {
210210
val notificationId = randomIdGenerator.nextInt()
211-
val intent = Intent().apply {
212-
setClassName(context, FileDisplayActivity::class.java.name)
213-
setAction(FileDisplayActivity.AUTO_UPLOAD_NOTIFICATION)
211+
val intent = Intent(context, FileDisplayActivity::class.java).apply {
212+
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
213+
action = FileDisplayActivity.AUTO_UPLOAD_NOTIFICATION
214214
}
215215
val pendingIntent = PendingIntent.getActivity(
216216
context,

app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -655,18 +655,20 @@ protected void onNewIntent(Intent intent) {
655655
setLeftFragment(new GroupfolderListFragment());
656656
getSupportFragmentManager().executePendingTransactions();
657657
} else if (AUTO_UPLOAD_NOTIFICATION.equals(intent.getAction())) {
658-
handleAutoUploadNotification();
658+
showReEnableAutoUploadDialog();
659659
}
660660
}
661661
}
662662

663-
private void handleAutoUploadNotification() {
663+
private void showReEnableAutoUploadDialog() {
664664
new MaterialAlertDialogBuilder(this, R.style.Theme_ownCloud_Dialog)
665665
.setTitle(R.string.re_enable_auto_upload)
666666
.setMessage(R.string.re_enable_auto_upload_desc)
667667
.setNegativeButton(R.string.dialog_close, (dialog, which) -> {
668-
dialog.dismiss();
668+
PermissionUtil.requestExternalStoragePermission(this, viewThemeUtils);
669+
PermissionUtil.requestMediaLocationPermission(this);
669670
preferences.setAutoUploadGPlayNotificationShown(true);
671+
dialog.dismiss();
670672
})
671673
.setIcon(R.drawable.nav_synced_folders)
672674
.create()

app/src/main/res/values/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,6 @@
12591259
<string name="upload_gplay">Permission changes</string>
12601260
<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>
12611261
<string name="re_enable_auto_upload">Changes to auto upload</string>
1262-
<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>
1262+
<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>
12631263
<string name="click_to_learn_how_to_re_enable_auto_uploads">Manual intervention required to re-enable auto-upload</string>
12641264
</resources>

0 commit comments

Comments
 (0)