An open-source cross-platform alternative to AirDrop
feat: migrate away from app_group_directory
Tien Do Nam11e508d5bda1
diff --git a/app/lib/util/native/cache_helper.dart b/app/lib/util/native/cache_helper.dartindex 459c620b..e2f852b7 100644--- a/app/lib/util/native/cache_helper.dart+++ b/app/lib/util/native/cache_helper.dart@@ -3,7 +3,6 @@import 'dart:io';import 'dart:isolate';-import 'package:app_group_directory/app_group_directory.dart';import 'package:common/util/logger.dart';import 'package:file_picker/file_picker.dart';import 'package:flutter/services.dart';@@ -11,6 +10,7 @@ import 'package:localsend_app/util/file_path_helper.dart';import 'package:localsend_app/util/native/platform_check.dart';import 'package:logging/logging.dart';import 'package:path_provider/path_provider.dart';+import 'package:path_provider_foundation/path_provider_foundation.dart';import 'package:refena_flutter/refena_flutter.dart';import 'package:wechat_assets_picker/wechat_assets_picker.dart';@@ -46,12 +46,18 @@ Future<void> _clear(RootIsolateToken token) async {}): Future.value(),checkPlatform([TargetPlatform.iOS])- ? AppGroupDirectory.getAppGroupDirectory('group.org.localsend.localsendApp').then((directory) async {- if (directory == null) {+ ? PathProviderFoundation()+ .getContainerPath(+ appGroupIdentifier: 'group.org.localsend.localsendApp',+ )+ .then((directoryPath) async {+ if (directoryPath == null) {_logger.warning('Failed to get app group directory');return;}+ final directory = Directory(directoryPath);+// delete contents of the directory (only files, not directories)await for (final entry in directory.list(recursive: false, followLinks: false)) {if (entry is File && !entry.path.fileName.startsWith('.')) {diff --git a/app/pubspec.lock b/app/pubspec.lockindex 7698be13..ff327fe4 100644--- a/app/pubspec.lock+++ b/app/pubspec.lock@@ -46,14 +46,6 @@ packages:url: "https://pub.dev"source: hostedversion: "2.0.3"- app_group_directory:- dependency: "direct main"- description:- name: app_group_directory- sha256: ad89800fd55133b46e1f6940ac6b974562f7fb6394c662c0f4422b90167f2416- url: "https://pub.dev"- source: hosted- version: "2.0.0"archive:dependency: transitivedescription:@@ -1043,7 +1035,7 @@ packages:source: hostedversion: "2.2.12"path_provider_foundation:- dependency: transitive+ dependency: "direct main"description:name: path_provider_foundationsha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16diff --git a/app/pubspec.yaml b/app/pubspec.yamlindex 83ce4563..457ece89 100644--- a/app/pubspec.yaml+++ b/app/pubspec.yaml@@ -10,7 +10,6 @@ environment:sdk: ">=3.5.0 <4.0.0"dependencies:- app_group_directory: 2.0.0basic_utils: 5.7.0collection: ^1.17.2 # allow newer versions, so it can compile with newer Flutter versionscommon:@@ -46,6 +45,7 @@ dependencies:pasteboard: 0.3.0path: 1.9.0path_provider: 2.1.4+ path_provider_foundation: 2.4.0permission_handler: 11.3.1pretty_qr_code: 3.3.0refena_flutter: 2.1.1