diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a79101550..7374ba142 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,4 +1,6 @@ PODS: + - background_fetch (0.5.6): + - Flutter - connectivity (0.0.1): - Flutter - Reachability @@ -15,6 +17,8 @@ PODS: - Flutter - Mantle - SDWebImageWebPCoder + - flutter_inappwebview (0.0.1): + - Flutter - flutter_keyboard_visibility (0.0.1): - Flutter - flutter_secure_storage (3.3.1): @@ -76,6 +80,7 @@ PODS: - Flutter DEPENDENCIES: + - background_fetch (from `.symlinks/plugins/background_fetch/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) - crisp (from `.symlinks/plugins/crisp/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) @@ -83,6 +88,7 @@ DEPENDENCIES: - Flutter (from `Flutter`) - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`) - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`) + - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - flutter_sodium (from `.symlinks/plugins/flutter_sodium/ios`) @@ -113,6 +119,8 @@ SPEC REPOS: - Toast EXTERNAL SOURCES: + background_fetch: + :path: ".symlinks/plugins/background_fetch/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" crisp: @@ -127,6 +135,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_email_sender/ios" flutter_image_compress: :path: ".symlinks/plugins/flutter_image_compress/ios" + flutter_inappwebview: + :path: ".symlinks/plugins/flutter_inappwebview/ios" flutter_keyboard_visibility: :path: ".symlinks/plugins/flutter_keyboard_visibility/ios" flutter_secure_storage: @@ -165,6 +175,7 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/wakelock/ios" SPEC CHECKSUMS: + background_fetch: 9e1c6c010f2bafe94108358405b7f2a08d6b5ab1 connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 crisp: 31665a818a3b0231a343d5a0d617a41d63b09646 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 @@ -172,6 +183,7 @@ SPEC CHECKSUMS: Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_email_sender: f787522d0e82f50e5766c1213dbffff22fdcf009 flutter_image_compress: 082f8daaf6c1b0c9fe798251c750ef0ecd98d7ae + flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index d1670b3b4..eb609da92 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -239,12 +239,14 @@ "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework", "${BUILT_PRODUCTS_DIR}/Toast/Toast.framework", + "${BUILT_PRODUCTS_DIR}/background_fetch/background_fetch.framework", "${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework", "${BUILT_PRODUCTS_DIR}/crisp/crisp.framework", "${BUILT_PRODUCTS_DIR}/device_info/device_info.framework", "${BUILT_PRODUCTS_DIR}/esys_flutter_share/esys_flutter_share.framework", "${BUILT_PRODUCTS_DIR}/flutter_email_sender/flutter_email_sender.framework", "${BUILT_PRODUCTS_DIR}/flutter_image_compress/flutter_image_compress.framework", + "${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework", "${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework", "${BUILT_PRODUCTS_DIR}/flutter_secure_storage/flutter_secure_storage.framework", "${BUILT_PRODUCTS_DIR}/flutter_sodium/flutter_sodium.framework", @@ -274,12 +276,14 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Toast.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/background_fetch.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/crisp.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/esys_flutter_share.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_email_sender.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_image_compress.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_secure_storage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_sodium.framework", diff --git a/lib/ui/detail_page.dart b/lib/ui/detail_page.dart index 11a3c697b..e28cfca9e 100644 --- a/lib/ui/detail_page.dart +++ b/lib/ui/detail_page.dart @@ -160,7 +160,7 @@ class _DetailPageState extends State { }, onSelected: (value) { if (value == 1) { - share(context, _files[_selectedIndex]); + share(context, [_files[_selectedIndex]]); } else if (value == 2) { _displayInfo(_files[_selectedIndex]); } else if (value == 3) { diff --git a/lib/ui/gallery_app_bar_widget.dart b/lib/ui/gallery_app_bar_widget.dart index 8bff093a5..991d160c4 100644 --- a/lib/ui/gallery_app_bar_widget.dart +++ b/lib/ui/gallery_app_bar_widget.dart @@ -224,7 +224,7 @@ class _GalleryAppBarWidgetState extends State { } void _shareSelected(BuildContext context) { - shareMultiple(context, widget.selectedFiles.files.toList()); + share(context, widget.selectedFiles.files.toList()); } void _showRemoveFromCollectionSheet(BuildContext context) { diff --git a/lib/ui/memories_widget.dart b/lib/ui/memories_widget.dart index 4a7f23a40..b3769651a 100644 --- a/lib/ui/memories_widget.dart +++ b/lib/ui/memories_widget.dart @@ -233,7 +233,7 @@ class _FullScreenMemoryState extends State { IconButton( icon: Icon(Icons.share), onPressed: () { - share(context, file); + share(context, [file]); }, ), ], diff --git a/lib/utils/file_util.dart b/lib/utils/file_util.dart index 35dd6c8f0..1854631c8 100644 --- a/lib/utils/file_util.dart +++ b/lib/utils/file_util.dart @@ -132,7 +132,7 @@ Future getNativeFile(File file) async { if (file.localID == null) { return getFileFromServer(file); } else { - return file.getAsset().then((asset) => asset.file); + return file.getAsset().then((asset) => asset.originFile); } } diff --git a/lib/utils/share_util.dart b/lib/utils/share_util.dart index 85ae6cb2f..7de329bf4 100644 --- a/lib/utils/share_util.dart +++ b/lib/utils/share_util.dart @@ -1,61 +1,21 @@ -import 'package:esys_flutter_share/esys_flutter_share.dart'; +import 'package:share/share.dart'; import 'package:flutter/widgets.dart'; import 'package:photos/models/file.dart'; -import 'package:path/path.dart'; -import 'package:photos/models/file_type.dart'; import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/file_util.dart'; -import 'package:progress_dialog/progress_dialog.dart'; -import 'package:share_extend/share_extend.dart'; -Future share(BuildContext context, File file) async { - final dialog = createProgressDialog(context, "preparing..."); - if (file.fileType == FileType.image) { - return _shareImage(dialog, file); - } else { - return _shareVideo(dialog, file); - } -} - -Future shareMultiple(BuildContext context, List files) async { - if (files.length == 1) { - return share(context, files[0]); - } +Future share(BuildContext context, List files) async { final dialog = createProgressDialog(context, "preparing..."); await dialog.show(); final pathFutures = List>(); for (File file in files) { pathFutures.add(getNativeFile(file).then((file) => file.path)); } - final pathList = await Future.wait(pathFutures); + final paths = await Future.wait(pathFutures); await dialog.hide(); - return ShareExtend.shareMultiple(pathList, "image"); -} - -Future _shareVideo(ProgressDialog dialog, File file) async { - await dialog.show(); - final path = (await getNativeFile(file)).path; - await dialog.hide(); - return ShareExtend.share(path, "image"); + return Share.shareFiles(paths); } Future shareText(String text) async { - return ShareExtend.share(text, "text"); -} - -Future _shareImage(ProgressDialog dialog, File file) async { - await dialog.show(); - final bytes = await getBytes(file); - final filename = _getFilename(file.title); - final ext = extension(filename); - await dialog.hide(); - return Share.file(filename, filename, bytes, "image/" + ext); -} - -String _getFilename(String name) { - if (name.endsWith(".HEIC")) { - return name.substring(0, name.lastIndexOf(".HEIC")) + ".JPG"; - } else { - return name; - } + return Share.share(text); } diff --git a/pubspec.lock b/pubspec.lock index 4fcebc94a..94b535641 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -183,15 +183,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.4" - esys_flutter_share: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: "53e5080ec3c2c23d62e5791e5b75bed889295726" - url: "https://github.com/aeyrium/esys-flutter-share" - source: git - version: "1.0.2" event_bus: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index de87ab25e..22cf492fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,9 +31,6 @@ dependencies: shared_preferences: ^0.5.6 dio: ^3.0.9 image: ^2.1.4 - esys_flutter_share: - git: - url: https://github.com/aeyrium/esys-flutter-share share_extend: ^1.1.9 share: ^0.6.5+4 draggable_scrollbar: ^0.0.4