diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d9d371bc3..c6fe69ac7 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -2,10 +2,7 @@ - - - - + diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 24fbb48e7..d32d2f88e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -6,8 +6,6 @@ PODS: - connectivity_plus (0.0.1): - Flutter - FlutterMacOS - - device_info_plus (0.0.1): - - Flutter - Flutter (1.0.0) - flutter_custom_tabs_ios (2.0.0): - Flutter @@ -85,7 +83,6 @@ DEPENDENCIES: - app_links (from `.symlinks/plugins/app_links/ios`) - background_fetch (from `.symlinks/plugins/background_fetch/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`) - - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - Flutter (from `Flutter`) - flutter_custom_tabs_ios (from `.symlinks/plugins/flutter_custom_tabs_ios/ios`) - flutter_file_dialog (from `.symlinks/plugins/flutter_file_dialog/ios`) @@ -121,8 +118,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/background_fetch/ios" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/darwin" - device_info_plus: - :path: ".symlinks/plugins/device_info_plus/ios" Flutter: :path: Flutter flutter_custom_tabs_ios: @@ -172,7 +167,6 @@ SPEC CHECKSUMS: app_links: e7a6750a915a9e161c58d91bc610e8cd1d4d0ad0 background_fetch: 39f11371c0dce04b001c4bfd5e782bcccb0a85e2 connectivity_plus: 18382e7311ba19efcaee94442b23b32507b20695 - device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_custom_tabs_ios: a651b18786388923b62de8c0537607de87c2eccf flutter_file_dialog: 4c014a45b105709a27391e266c277d7e588e9299 diff --git a/lib/shared/image_viewer.dart b/lib/shared/image_viewer.dart index 05ca679ec..4450b78bb 100644 --- a/lib/shared/image_viewer.dart +++ b/lib/shared/image_viewer.dart @@ -2,25 +2,22 @@ import 'dart:async'; import 'dart:io'; import 'dart:math'; -import 'package:expandable/expandable.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:expandable/expandable.dart'; import 'package:extended_image/extended_image.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:gal/gal.dart'; import 'package:share_plus/share_plus.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:path_provider/path_provider.dart'; import 'package:path/path.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:device_info_plus/device_info_plus.dart'; -import 'package:thunder/core/enums/image_caching_mode.dart'; -import 'package:thunder/shared/dialogs.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:thunder/core/enums/image_caching_mode.dart'; import 'package:thunder/shared/snackbar.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:thunder/thunder/bloc/thunder_bloc.dart'; import 'package:thunder/utils/media/image.dart'; @@ -103,44 +100,6 @@ class _ImageViewerState extends State with TickerProviderStateMixin SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge, overlays: SystemUiOverlay.values); } - Future _requestPermission() async { - bool androidVersionBelow33 = false; - - if (!kIsWeb && Platform.isAndroid) { - androidVersionBelow33 = (await DeviceInfoPlugin().androidInfo).version.sdkInt <= 32; - } - - // Check first if we have permissions - bool hasStoragePermission = await Permission.storage.isGranted || await Permission.storage.isLimited; - bool hasPhotosPermission = await Permission.photos.isGranted || await Permission.photos.isLimited; - - if (androidVersionBelow33 && !hasStoragePermission) { - await Permission.storage.request(); - hasStoragePermission = await Permission.storage.isGranted || await Permission.storage.isLimited; - } else if (!androidVersionBelow33 && !hasPhotosPermission) { - await Permission.photos.request(); - hasPhotosPermission = await Permission.photos.isGranted || await Permission.photos.isLimited; - } - - if (!kIsWeb && Platform.isAndroid && androidVersionBelow33) return hasStoragePermission; - return hasPhotosPermission; - } - - /// Shows a dialog indicating that permissions have been denied, and must be granted in order to save image. - void showPermissionDeniedDialog(BuildContext context) { - final AppLocalizations l10n = AppLocalizations.of(context)!; - - showThunderDialog( - context: context, - title: l10n.permissionDenied, - contentText: l10n.permissionDeniedMessage, - onPrimaryButtonPressed: (_, __) { - openAppSettings(); - }, - primaryButtonText: l10n.openSettings, - ); - } - Future getImageSize() async { try { Size decodedImage = await retrieveImageDimensions(imageUrl: widget.url, imageBytes: widget.bytes).timeout(const Duration(seconds: 2)); @@ -535,12 +494,8 @@ class _ImageViewerState extends State with TickerProviderStateMixin ? null : () async { File file = await DefaultCacheManager().getSingleFile(widget.url!); - bool hasPermission = await _requestPermission(); - - if (!hasPermission) { - if (context.mounted) showPermissionDeniedDialog(context); - return; - } + bool hasPermission = await Gal.hasAccess(toAlbum: true); + if (!hasPermission) await Gal.requestAccess(toAlbum: true); setState(() => isSavingMedia = true); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index aea1e666a..34106c52a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -7,7 +7,6 @@ import Foundation import app_links import connectivity_plus -import device_info_plus import dynamic_color import file_selector_macos import flutter_inappwebview_macos @@ -25,7 +24,6 @@ import webview_flutter_wkwebview func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin")) ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) - DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 2de4b80fe..7033c467b 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -4,8 +4,6 @@ PODS: - connectivity_plus (0.0.1): - Flutter - FlutterMacOS - - device_info_plus (0.0.1): - - FlutterMacOS - dynamic_color (0.0.2): - FlutterMacOS - file_selector_macos (0.0.1): @@ -31,21 +29,21 @@ PODS: - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - - sqlite3 (3.47.1): - - sqlite3/common (= 3.47.1) - - sqlite3/common (3.47.1) - - sqlite3/dbstatvtab (3.47.1): + - sqlite3 (3.47.2): + - sqlite3/common (= 3.47.2) + - sqlite3/common (3.47.2) + - sqlite3/dbstatvtab (3.47.2): - sqlite3/common - - sqlite3/fts5 (3.47.1): + - sqlite3/fts5 (3.47.2): - sqlite3/common - - sqlite3/perf-threadsafe (3.47.1): + - sqlite3/perf-threadsafe (3.47.2): - sqlite3/common - - sqlite3/rtree (3.47.1): + - sqlite3/rtree (3.47.2): - sqlite3/common - sqlite3_flutter_libs (0.0.1): - Flutter - FlutterMacOS - - sqlite3 (~> 3.47.1) + - sqlite3 (~> 3.47.2) - sqlite3/dbstatvtab - sqlite3/fts5 - sqlite3/perf-threadsafe @@ -62,7 +60,6 @@ PODS: DEPENDENCIES: - app_links (from `Flutter/ephemeral/.symlinks/plugins/app_links/macos`) - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/darwin`) - - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`) - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) - flutter_inappwebview_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos`) @@ -88,8 +85,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/app_links/macos connectivity_plus: :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/darwin - device_info_plus: - :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos dynamic_color: :path: Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos file_selector_macos: @@ -121,25 +116,24 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: app_links: 10e0a0ab602ffaf34d142cd4862f29d34b303b2a - connectivity_plus: 4c41c08fc6d7c91f63bc7aec70ffe3730b04f563 - device_info_plus: 1b14eed9bf95428983aed283a8d51cce3d8c4215 + connectivity_plus: 18382e7311ba19efcaee94442b23b32507b20695 dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d flutter_inappwebview_macos: bdf207b8f4ebd58e86ae06cd96b147de99a67c9b flutter_local_notifications: 7062189aabf7f50938a7b8b6614ffa97656eb0bf FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1 + gal: 6a522c75909f1244732d4596d11d6a2f86ff37a5 OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 share_plus: 1fa619de8392a4398bfaf176d441853922614e89 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d - sqlite3: 1e522f0938463e44b7faf50393b40bdc1e1e456d - sqlite3_flutter_libs: 1b4e98da20ebd4e9b1240269b78cdcf492dbe9f3 + sqlite3: 7559e33dae4c78538df563795af3a86fc887ee71 + sqlite3_flutter_libs: 58ae36c0dd086395d066b4fe4de9cdca83e717b3 url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404 video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4 PODFILE CHECKSUM: c2e95c8c0fe03c5c57e438583cae4cc732296009 -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/pubspec.lock b/pubspec.lock index f7c704e89..4003ae2ca 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -370,10 +370,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "27eb0ae77836989a3bc541ce55595e8ceee0992807f14511552a898ddd0d88ac" + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.3.7" dbus: dependency: transitive description: @@ -382,22 +382,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.10" - device_info_plus: - dependency: "direct main" - description: - name: device_info_plus - sha256: "4fa68e53e26ab17b70ca39f072c285562cfc1589df5bb1e9295db90f6645f431" - url: "https://pub.dev" - source: hosted - version: "11.2.0" - device_info_plus_platform_interface: - dependency: transitive - description: - name: device_info_plus_platform_interface - sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2" - url: "https://pub.dev" - source: hosted - version: "7.0.2" drift: dependency: "direct main" description: @@ -1635,10 +1619,10 @@ packages: dependency: transitive description: name: source_gen - sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.5.0" source_span: dependency: transitive description: @@ -2071,14 +2055,6 @@ packages: url: "https://pub.dev" source: hosted version: "5.10.0" - win32_registry: - dependency: transitive - description: - name: win32_registry - sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" - url: "https://pub.dev" - source: hosted - version: "1.1.5" xayn_readability: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 4cdca0cc1..336f403c3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,7 +39,6 @@ dependencies: connectivity_plus: "^6.0.2" dart_ping: "^9.0.0" dart_ping_ios: "^4.0.0" - device_info_plus: ^11.1.1 drift: "^2.21.0" drift_flutter: "^0.2.1" dynamic_color: "^1.6.5"