From 9f2e458bdc73c1bcf2ecccd9f380ef81ce8c18f9 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 14 Jan 2025 14:16:47 +0100 Subject: [PATCH 1/2] add request permission Signed-off-by: alperozturk --- .../nextcloud/client/jobs/MediaFoldersDetectionWork.kt | 6 +++--- .../owncloud/android/ui/activity/FileDisplayActivity.java | 8 +++++--- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt b/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt index 930e849351fa..ff5e587c0f37 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt @@ -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, diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index b63dc4fd6fbf..08045aa9c3b7 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -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() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bfdf186159c2..af4c6453ee2a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1259,6 +1259,6 @@ Permission changes A new permission is required to access location information for uploaded images.\nMake sure that media access is set to \"Always allow all\". Changes to auto upload - 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. + 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 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. Manual intervention required to re-enable auto-upload From 1574ffc5a5a53ff0a926bad9690e181ba8a11245 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 14 Jan 2025 14:32:32 +0100 Subject: [PATCH 2/2] update translation Signed-off-by: alperozturk --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index af4c6453ee2a..f58fe2ebebd7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1259,6 +1259,6 @@ Permission changes A new permission is required to access location information for uploaded images.\nMake sure that media access is set to \"Always allow all\". Changes to auto upload - 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 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. + 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. Manual intervention required to re-enable auto-upload