Enable one-shot deletes for Android 11+
This commit is contained in:
parent
dada941088
commit
bf210d18ab
5 changed files with 20 additions and 4 deletions
|
@ -9,3 +9,4 @@ const String SENTRY_DEBUG_DSN =
|
|||
"https://b31c8af8384a4ce980509b8f592a67eb@errors.ente.io/3";
|
||||
const String ROADMAP_URL = "https://roadmap.ente.io";
|
||||
const int MICRO_SECONDS_IN_DAY = 86400000000;
|
||||
const int ANDROID_11_SDK_INT = 30;
|
|
@ -2,10 +2,12 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:photo_manager/photo_manager.dart';
|
||||
import 'package:photos/core/constants.dart';
|
||||
import 'package:photos/core/event_bus.dart';
|
||||
import 'package:photos/db/files_db.dart';
|
||||
import 'package:photos/events/collection_updated_event.dart';
|
||||
|
@ -144,7 +146,12 @@ Future<bool> deleteLocalFiles(
|
|||
BuildContext context, List<String> localIDs) async {
|
||||
final List<String> deletedIDs = [];
|
||||
if (Platform.isAndroid) {
|
||||
deletedIDs.addAll(await _deleteLocalFilesInBatches(context, localIDs));
|
||||
final androidInfo = await DeviceInfoPlugin().androidInfo;
|
||||
if (androidInfo.version.sdkInt < ANDROID_11_SDK_INT) {
|
||||
deletedIDs.addAll(await _deleteLocalFilesInBatches(context, localIDs));
|
||||
} else {
|
||||
deletedIDs.addAll(await _deleteLocalFilesInOneShot(context, localIDs));
|
||||
}
|
||||
} else {
|
||||
deletedIDs.addAll(await _deleteLocalFilesInOneShot(context, localIDs));
|
||||
}
|
||||
|
|
11
pubspec.lock
11
pubspec.lock
|
@ -165,12 +165,19 @@ packages:
|
|||
source: hosted
|
||||
version: "1.0.3"
|
||||
device_info:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: device_info
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.2+6"
|
||||
version: "2.0.2"
|
||||
device_info_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -92,6 +92,7 @@ dependencies:
|
|||
intl: ^0.17.0
|
||||
confetti: ^0.5.5
|
||||
flutter_easyloading: ^3.0.0
|
||||
device_info: ^2.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
2
thirdparty/super_logging/pubspec.yaml
vendored
2
thirdparty/super_logging/pubspec.yaml
vendored
|
@ -12,7 +12,7 @@ dependencies:
|
|||
sdk: flutter
|
||||
|
||||
package_info_plus: ^1.0.1
|
||||
device_info: ^0.4.1+4
|
||||
device_info: ^2.0.2
|
||||
logging: ^1.0.1
|
||||
sentry: ^5.0.0
|
||||
intl: ^0.17.0
|
||||
|
|
Loading…
Reference in a new issue