Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] display deletion prompt if android version does not support media management permissions (#11756)

aspizu2508bb98a6db
diff --git a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
index 33c9340a02..a533d02b4a 100644
--- a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
@@ -5,6 +5,7 @@ import "package:ente_components/ente_components.dart";
import "package:ente_strings/ente_strings.dart";
import "package:flutter/material.dart";
import "package:photo_manager/photo_manager.dart";
+import "package:photos/core/constants.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/details_sheet_event.dart";
import "package:photos/models/file/extensions/file_props.dart";
@@ -14,6 +15,7 @@ import "package:photos/service_locator.dart";
import "package:photos/ui/notification/toast.dart";
import 'package:photos/ui/viewer/file/file_details_widget.dart';
import "package:photos/utils/delete_file_util.dart";
+import "package:photos/utils/device_info.dart";
Future<void> showSingleFileDeleteSheet(
BuildContext context,
@@ -29,7 +31,9 @@ Future<void> showSingleFileDeleteSheet(
showShortToast(context, l10n.noDeviceThatCanBeDeleted);
return;
}
- if (Platform.isAndroid && await PhotoManager.canManageMedia()) {
+ if (Platform.isAndroid &&
+ (await isAndroidSDKVersionLowerThan(android11SDKINT) ||
+ await PhotoManager.canManageMedia())) {
if (!context.mounted) return;
await showBottomSheetComponent<bool>(
context: context,
diff --git a/mobile/apps/photos/lib/utils/delete_file_util.dart b/mobile/apps/photos/lib/utils/delete_file_util.dart
index b888a55e95..8f02f24ee5 100644
--- a/mobile/apps/photos/lib/utils/delete_file_util.dart
+++ b/mobile/apps/photos/lib/utils/delete_file_util.dart
@@ -886,7 +886,9 @@ Future<void> showDeleteSheet(
return;
}
var didDelete = false;
- if (Platform.isAndroid && await PhotoManager.canManageMedia()) {
+ if (Platform.isAndroid &&
+ (await isAndroidSDKVersionLowerThan(android11SDKINT) ||
+ await PhotoManager.canManageMedia())) {
if (!context.mounted) return;
didDelete =
await showBottomSheetComponent<bool>(