From f6e0993dff267824b4d3d0058787a6d9d7bd5cc8 Mon Sep 17 00:00:00 2001 From: Curtly Critchlow Date: Wed, 11 Sep 2024 08:36:16 -0400 Subject: [PATCH 1/4] fix: file_selector package replaced with file_picker in at_backupkey_flutter. --- .../linux/flutter/generated_plugin_registrant.cc | 4 ---- .../example/linux/flutter/generated_plugins.cmake | 1 - packages/at_backupkey_flutter/example/macos/Podfile | 2 +- .../example/macos/Runner.xcodeproj/project.pbxproj | 11 ++++++----- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../example/macos/Runner/AppDelegate.swift | 2 +- .../windows/flutter/generated_plugin_registrant.cc | 3 --- .../example/windows/flutter/generated_plugins.cmake | 1 - .../lib/widgets/backup_key_widget.dart | 8 +++++--- packages/at_backupkey_flutter/pubspec.yaml | 7 ++----- 10 files changed, 16 insertions(+), 25 deletions(-) diff --git a/packages/at_backupkey_flutter/example/linux/flutter/generated_plugin_registrant.cc b/packages/at_backupkey_flutter/example/linux/flutter/generated_plugin_registrant.cc index 3d1b3ca9d..d34a64d83 100644 --- a/packages/at_backupkey_flutter/example/linux/flutter/generated_plugin_registrant.cc +++ b/packages/at_backupkey_flutter/example/linux/flutter/generated_plugin_registrant.cc @@ -8,7 +8,6 @@ #include #include -#include #include void fl_register_plugins(FlPluginRegistry* registry) { @@ -18,9 +17,6 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) biometric_storage_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "BiometricStoragePlugin"); biometric_storage_plugin_register_with_registrar(biometric_storage_registrar); - g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); - file_selector_plugin_register_with_registrar(file_selector_linux_registrar); g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/packages/at_backupkey_flutter/example/linux/flutter/generated_plugins.cmake b/packages/at_backupkey_flutter/example/linux/flutter/generated_plugins.cmake index 393e05db7..7df401e7d 100644 --- a/packages/at_backupkey_flutter/example/linux/flutter/generated_plugins.cmake +++ b/packages/at_backupkey_flutter/example/linux/flutter/generated_plugins.cmake @@ -5,7 +5,6 @@ list(APPEND FLUTTER_PLUGIN_LIST at_file_saver biometric_storage - file_selector_linux url_launcher_linux ) diff --git a/packages/at_backupkey_flutter/example/macos/Podfile b/packages/at_backupkey_flutter/example/macos/Podfile index dade8dfad..049abe295 100644 --- a/packages/at_backupkey_flutter/example/macos/Podfile +++ b/packages/at_backupkey_flutter/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.11' +platform :osx, '10.14' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/project.pbxproj b/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/project.pbxproj index 20b5b4edb..e756dcf4f 100644 --- a/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -203,7 +203,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -278,6 +278,7 @@ }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -404,7 +405,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -483,7 +484,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -530,7 +531,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index f58bf75b4..824cde8c1 100644 --- a/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/at_backupkey_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ Bool { return true diff --git a/packages/at_backupkey_flutter/example/windows/flutter/generated_plugin_registrant.cc b/packages/at_backupkey_flutter/example/windows/flutter/generated_plugin_registrant.cc index 036f08c22..edb3de30d 100644 --- a/packages/at_backupkey_flutter/example/windows/flutter/generated_plugin_registrant.cc +++ b/packages/at_backupkey_flutter/example/windows/flutter/generated_plugin_registrant.cc @@ -7,7 +7,6 @@ #include "generated_plugin_registrant.h" #include -#include #include #include #include @@ -15,8 +14,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { FileSaverPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSaverPlugin")); - FileSelectorWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FileSelectorWindows")); PermissionHandlerWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); SharePlusWindowsPluginCApiRegisterWithRegistrar( diff --git a/packages/at_backupkey_flutter/example/windows/flutter/generated_plugins.cmake b/packages/at_backupkey_flutter/example/windows/flutter/generated_plugins.cmake index ac2736f29..9c958c20f 100644 --- a/packages/at_backupkey_flutter/example/windows/flutter/generated_plugins.cmake +++ b/packages/at_backupkey_flutter/example/windows/flutter/generated_plugins.cmake @@ -4,7 +4,6 @@ list(APPEND FLUTTER_PLUGIN_LIST at_file_saver - file_selector_windows permission_handler_windows share_plus url_launcher_windows diff --git a/packages/at_backupkey_flutter/lib/widgets/backup_key_widget.dart b/packages/at_backupkey_flutter/lib/widgets/backup_key_widget.dart index 055129f6e..7172d5cdd 100644 --- a/packages/at_backupkey_flutter/lib/widgets/backup_key_widget.dart +++ b/packages/at_backupkey_flutter/lib/widgets/backup_key_widget.dart @@ -7,7 +7,7 @@ import 'package:at_backupkey_flutter/utils/size_config.dart'; import 'package:at_backupkey_flutter/utils/strings.dart'; import 'package:at_file_saver/at_file_saver.dart'; import 'package:at_utils/at_logger.dart'; -import 'package:file_selector/file_selector.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:path_provider/path_provider.dart' as path_provider; import 'package:path_provider/path_provider.dart'; @@ -331,10 +331,12 @@ class BackupKeyWidget extends StatelessWidget { }); } } else { - final path = await getSaveLocation(suggestedName: '$atsign${Strings.backupKeyName}'); + final path = await FilePicker.platform.saveFile( + fileName: '$atsign${Strings.backupKeyName}', + ); if (path == null) return; final file = XFile(tempFilePath); - await file.saveTo(path.path); + await file.saveTo(path); if (context.mounted) { showSnackBar( context: context, diff --git a/packages/at_backupkey_flutter/pubspec.yaml b/packages/at_backupkey_flutter/pubspec.yaml index 0c130cc51..cf94082d7 100644 --- a/packages/at_backupkey_flutter/pubspec.yaml +++ b/packages/at_backupkey_flutter/pubspec.yaml @@ -21,11 +21,8 @@ dependencies: at_client_mobile: ^3.2.17 showcaseview: ^3.0.0 device_info_plus: ^10.1.1 - # desktop - dependencies - file_selector: ^1.0.1 - file_selector_macos: ^0.9.3+2 - file_selector_windows: ^0.9.3+1 - file_selector_linux: ^0.9.2+1 + file_picker: ^8.1.2 + dev_dependencies: flutter_test: From 048b7c2a75e70dd80d50fc436545673519402dc5 Mon Sep 17 00:00:00 2001 From: Curtly Critchlow Date: Wed, 11 Sep 2024 10:09:11 -0400 Subject: [PATCH 2/4] chore: updated change log, version number and example app dependencies. --- packages/at_backupkey_flutter/CHANGELOG.md | 5 +++++ packages/at_backupkey_flutter/example/pubspec.yaml | 2 +- packages/at_backupkey_flutter/pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/at_backupkey_flutter/CHANGELOG.md b/packages/at_backupkey_flutter/CHANGELOG.md index 7fb776ee5..0920df18c 100644 --- a/packages/at_backupkey_flutter/CHANGELOG.md +++ b/packages/at_backupkey_flutter/CHANGELOG.md @@ -1,3 +1,8 @@ +## 4.0.16 + +- **FIX**: Replaced the use of file_selector with file_picker +- **CHORE**: Updated dependencies in the example app + ## 4.0.15 - **FIX**: Resolved Static analysis messages diff --git a/packages/at_backupkey_flutter/example/pubspec.yaml b/packages/at_backupkey_flutter/example/pubspec.yaml index 314b7aebc..37c52b62a 100644 --- a/packages/at_backupkey_flutter/example/pubspec.yaml +++ b/packages/at_backupkey_flutter/example/pubspec.yaml @@ -12,7 +12,7 @@ environment: dependencies: at_app_flutter: ^5.2.0 at_client_mobile: ^3.2.17 - at_onboarding_flutter: ^6.1.7 + at_onboarding_flutter: ^6.1.8 cupertino_icons: ^1.0.6 flutter: sdk: flutter diff --git a/packages/at_backupkey_flutter/pubspec.yaml b/packages/at_backupkey_flutter/pubspec.yaml index cf94082d7..0837659aa 100644 --- a/packages/at_backupkey_flutter/pubspec.yaml +++ b/packages/at_backupkey_flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: at_backupkey_flutter description: A Flutter plugin project for saving the backup key of any atSign that is being onboarded with atPlatform apps. The backup key can be used to authenticate in other atPlatform apps. -version: 4.0.15 +version: 4.0.16 homepage: https://docs.atsign.com/ repository: https://github.com/atsign-foundation/at_widgets/tree/trunk/packages/at_backupkey_flutter issue_tracker: https://github.com/atsign-foundation/at_widgets/issues From e035cdf1b47a314f31bd75ab59c92770a53352cd Mon Sep 17 00:00:00 2001 From: Curtly Critchlow Date: Tue, 19 Nov 2024 06:42:47 -0400 Subject: [PATCH 3/4] fix: file picker transition partially completed. --- .../Flutter/GeneratedPluginRegistrant.swift | 2 + .../example/macos/Podfile.lock | 55 ++++++++++++------- .../macos/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../example/macos/Runner/AppDelegate.swift | 2 +- .../macos/Runner/DebugProfile.entitlements | 6 +- .../example/pubspec.yaml | 6 +- .../lib/services/desktop_image_picker.dart | 21 +++---- 8 files changed, 55 insertions(+), 41 deletions(-) diff --git a/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift b/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift index ec77aea7a..845bb0f4c 100644 --- a/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -16,6 +16,7 @@ import path_provider_foundation import share_plus import shared_preferences_foundation import url_launcher_macos +import webview_flutter_wkwebview func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin")) @@ -29,4 +30,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + FLTWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "FLTWebViewFlutterPlugin")) } diff --git a/packages/at_contacts_group_flutter/example/macos/Podfile.lock b/packages/at_contacts_group_flutter/example/macos/Podfile.lock index 8cbb8cefe..0dc2936a6 100644 --- a/packages/at_contacts_group_flutter/example/macos/Podfile.lock +++ b/packages/at_contacts_group_flutter/example/macos/Podfile.lock @@ -9,17 +9,24 @@ PODS: - FlutterMacOS - file_selector_macos (0.0.1): - FlutterMacOS + - flutter_image_compress_macos (1.0.0): + - FlutterMacOS - FlutterMacOS (1.0.0) - package_info_plus (0.0.1): - FlutterMacOS - - path_provider_macos (0.0.1): + - path_provider_foundation (0.0.1): + - Flutter - FlutterMacOS - - share_plus_macos (0.0.1): + - share_plus (0.0.1): - FlutterMacOS - - shared_preferences_macos (0.0.1): + - shared_preferences_foundation (0.0.1): + - Flutter - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS + - webview_flutter_wkwebview (0.0.1): + - Flutter + - FlutterMacOS DEPENDENCIES: - at_file_saver (from `Flutter/ephemeral/.symlinks/plugins/at_file_saver/macos`) @@ -27,12 +34,14 @@ DEPENDENCIES: - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - emoji_picker_flutter (from `Flutter/ephemeral/.symlinks/plugins/emoji_picker_flutter/macos`) - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) + - flutter_image_compress_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) - - share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`) - - shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) + - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) + - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) + - webview_flutter_wkwebview (from `Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin`) EXTERNAL SOURCES: at_file_saver: @@ -45,32 +54,38 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/emoji_picker_flutter/macos file_selector_macos: :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos + flutter_image_compress_macos: + :path: Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos FlutterMacOS: :path: Flutter/ephemeral package_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos - path_provider_macos: - :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos - share_plus_macos: - :path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos - shared_preferences_macos: - :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin + share_plus: + :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos + shared_preferences_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos + webview_flutter_wkwebview: + :path: Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin SPEC CHECKSUMS: at_file_saver: 1fc6ed722f17c7a20ce79cce168d1100fcad4b95 biometric_storage: 43caa6e7ef00e8e19c074216e7e1786dacda9e76 - device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f + device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720 emoji_picker_flutter: 533634326b1c5de9a181ba14b9758e6dfe967a20 - file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9 + file_selector_macos: 54fdab7caa3ac3fc43c9fac4d7d8d231277f8cf2 + flutter_image_compress_macos: c26c3c13ea0f28ae6dea4e139b3292e7729f99f1 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce - path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 - share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4 - shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727 - url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 + package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 + webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4 PODFILE CHECKSUM: 0d3963a09fc94f580682bd88480486da345dc3f0 -COCOAPODS: 1.11.3 +COCOAPODS: 1.14.3 diff --git a/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/project.pbxproj b/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/project.pbxproj index 49e7b09be..1bb2981ae 100644 --- a/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/project.pbxproj @@ -202,7 +202,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { diff --git a/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 048feea4f..7a7ed5134 100644 --- a/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/at_contacts_group_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ Bool { return true diff --git a/packages/at_contacts_group_flutter/example/macos/Runner/DebugProfile.entitlements b/packages/at_contacts_group_flutter/example/macos/Runner/DebugProfile.entitlements index d138bd5b0..0eaccf141 100644 --- a/packages/at_contacts_group_flutter/example/macos/Runner/DebugProfile.entitlements +++ b/packages/at_contacts_group_flutter/example/macos/Runner/DebugProfile.entitlements @@ -6,9 +6,11 @@ com.apple.security.cs.allow-jit - com.apple.security.network.server - com.apple.security.files.user-selected.read-write + com.apple.security.network.client + + com.apple.security.network.server + diff --git a/packages/at_contacts_group_flutter/example/pubspec.yaml b/packages/at_contacts_group_flutter/example/pubspec.yaml index 50042b300..1af1c9420 100644 --- a/packages/at_contacts_group_flutter/example/pubspec.yaml +++ b/packages/at_contacts_group_flutter/example/pubspec.yaml @@ -40,7 +40,8 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - at_onboarding_flutter: ^6.1.7 + at_onboarding_flutter: ^6.1.8 + file_picker: ^8.1.1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 @@ -48,9 +49,6 @@ dependencies: sdk: flutter path_provider: ^2.1.3 -dependency_overrides: - file_picker: ^8.1.1 - dev_dependencies: # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is diff --git a/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart b/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart index 1869a0ceb..674ddd6e5 100644 --- a/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart +++ b/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart @@ -1,25 +1,25 @@ import 'dart:typed_data'; + // ignore: import_of_legacy_library_into_null_safe import 'package:at_contacts_group_flutter/services/navigation_service.dart'; import 'package:at_contacts_group_flutter/widgets/custom_toast.dart'; import 'package:at_utils/at_logger.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:file_selector/file_selector.dart'; import 'package:image_compression/image_compression.dart'; Future desktopImagePicker() async { AtSignLogger atSignLogger = AtSignLogger('desktopImagePicker'); try { - // ignore: omit_local_variable_types - const XTypeGroup typeGroup = XTypeGroup( - label: 'images', - extensions: ['jpg', 'png', 'jpeg'], + final files = await FilePicker.platform.pickFiles( + type: FileType.image, + allowedExtensions: ['jpg', 'png', 'jpeg'], ); - final List files = await openFiles(acceptedTypeGroups: [typeGroup]); - if (files.isEmpty) { + if (files == null || files.count == 0) { return null; } // ignore: omit_local_variable_types - final XFile file = files[0]; + final XFile file = files.xFiles[0]; final input = ImageFile( rawBytes: await file.readAsBytes(), @@ -29,13 +29,10 @@ Future desktopImagePicker() async { final output = compress(ImageFileConfiguration( input: input, config: const Configuration( - jpgQuality: 50, - pngCompression: PngCompression.defaultCompression, - outputType: OutputType.jpg))); + jpgQuality: 50, pngCompression: PngCompression.defaultCompression, outputType: OutputType.jpg))); if (output.sizeInBytes > 100000) { - CustomToast().show('image size cannot exceed 100 kb', - NavService.groupPckgLeftHalfNavKey.currentContext!); + CustomToast().show('image size cannot exceed 100 kb', NavService.groupPckgLeftHalfNavKey.currentContext!); return null; } From d60f00d40e0c8c45d92c23693ac8dc9264469a2a Mon Sep 17 00:00:00 2001 From: Curtly Critchlow Date: Tue, 19 Nov 2024 06:43:43 -0400 Subject: [PATCH 4/4] fix: file picker transition partially completed. --- .../Flutter/GeneratedPluginRegistrant.swift | 2 -- .../example/macos/Podfile.lock | 6 ------ .../example/pubspec.yaml | 2 +- .../lib/services/desktop_image_picker.dart | 20 ++++++++++++------ .../lib/services/group_service.dart | 21 ++++++++++++------- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift b/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift index 845bb0f4c..cc42b6975 100644 --- a/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/packages/at_contacts_group_flutter/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -9,7 +9,6 @@ import at_file_saver import biometric_storage import device_info_plus import emoji_picker_flutter -import file_selector_macos import flutter_image_compress_macos import package_info_plus import path_provider_foundation @@ -23,7 +22,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { BiometricStorageMacOSPlugin.register(with: registry.registrar(forPlugin: "BiometricStorageMacOSPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) - FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/packages/at_contacts_group_flutter/example/macos/Podfile.lock b/packages/at_contacts_group_flutter/example/macos/Podfile.lock index 0dc2936a6..745788c2d 100644 --- a/packages/at_contacts_group_flutter/example/macos/Podfile.lock +++ b/packages/at_contacts_group_flutter/example/macos/Podfile.lock @@ -7,8 +7,6 @@ PODS: - FlutterMacOS - emoji_picker_flutter (0.0.1): - FlutterMacOS - - file_selector_macos (0.0.1): - - FlutterMacOS - flutter_image_compress_macos (1.0.0): - FlutterMacOS - FlutterMacOS (1.0.0) @@ -33,7 +31,6 @@ DEPENDENCIES: - biometric_storage (from `Flutter/ephemeral/.symlinks/plugins/biometric_storage/macos`) - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - emoji_picker_flutter (from `Flutter/ephemeral/.symlinks/plugins/emoji_picker_flutter/macos`) - - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) - flutter_image_compress_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) @@ -52,8 +49,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos emoji_picker_flutter: :path: Flutter/ephemeral/.symlinks/plugins/emoji_picker_flutter/macos - file_selector_macos: - :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos flutter_image_compress_macos: :path: Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos FlutterMacOS: @@ -76,7 +71,6 @@ SPEC CHECKSUMS: biometric_storage: 43caa6e7ef00e8e19c074216e7e1786dacda9e76 device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720 emoji_picker_flutter: 533634326b1c5de9a181ba14b9758e6dfe967a20 - file_selector_macos: 54fdab7caa3ac3fc43c9fac4d7d8d231277f8cf2 flutter_image_compress_macos: c26c3c13ea0f28ae6dea4e139b3292e7729f99f1 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c diff --git a/packages/at_contacts_group_flutter/example/pubspec.yaml b/packages/at_contacts_group_flutter/example/pubspec.yaml index 1af1c9420..0e239e144 100644 --- a/packages/at_contacts_group_flutter/example/pubspec.yaml +++ b/packages/at_contacts_group_flutter/example/pubspec.yaml @@ -41,7 +41,7 @@ dependencies: # the parent directory to use the current plugin's version. path: ../ at_onboarding_flutter: ^6.1.8 - file_picker: ^8.1.1 + # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 diff --git a/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart b/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart index 674ddd6e5..e656652d0 100644 --- a/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart +++ b/packages/at_contacts_group_flutter/lib/services/desktop_image_picker.dart @@ -4,22 +4,30 @@ import 'dart:typed_data'; import 'package:at_contacts_group_flutter/services/navigation_service.dart'; import 'package:at_contacts_group_flutter/widgets/custom_toast.dart'; import 'package:at_utils/at_logger.dart'; -import 'package:file_picker/file_picker.dart'; import 'package:file_selector/file_selector.dart'; import 'package:image_compression/image_compression.dart'; Future desktopImagePicker() async { AtSignLogger atSignLogger = AtSignLogger('desktopImagePicker'); try { - final files = await FilePicker.platform.pickFiles( - type: FileType.image, - allowedExtensions: ['jpg', 'png', 'jpeg'], + // ignore: omit_local_variable_types + const XTypeGroup typeGroup = XTypeGroup( + label: 'images', + extensions: ['jpg', 'png', 'jpeg'], ); - if (files == null || files.count == 0) { + final List files = await openFiles(acceptedTypeGroups: [typeGroup]); + // final files = await FilePicker.platform.pickFiles( + // type: FileType.image, + // allowedExtensions: ['jpg', 'png', 'jpeg'], + // ); + if (files.isEmpty) { return null; } + // if (files == null || files.count == 0) { + // return null; + // } // ignore: omit_local_variable_types - final XFile file = files.xFiles[0]; + final XFile file = files[0]; final input = ImageFile( rawBytes: await file.readAsBytes(), diff --git a/packages/at_contacts_group_flutter/lib/services/group_service.dart b/packages/at_contacts_group_flutter/lib/services/group_service.dart index 5ca4024f3..b1bc3cd87 100644 --- a/packages/at_contacts_group_flutter/lib/services/group_service.dart +++ b/packages/at_contacts_group_flutter/lib/services/group_service.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer'; // ignore: import_of_legacy_library_into_null_safe import 'package:at_client_mobile/at_client_mobile.dart'; @@ -168,11 +169,19 @@ class GroupService { }) async { try { var groupIds = await atContactImpl.listGroupIds(); + // TODO: Delete log + log(groupIds.join(',').toString()); var groupList = []; for (var i = 0; i < groupIds.length; i++) { - var groupDetail = await (getGroupDetail(groupIds[i]!)); - if (groupDetail != null) groupList.add(groupDetail); + try { + var groupDetail = await (getGroupDetail(groupIds[i]!)); + // TODO : delete log + log('Details: ${groupDetail?.displayName}'); + if (groupDetail != null) groupList.add(groupDetail); + } catch (e) { + log(e.toString()); + } } for (AtGroup group in groupList) { @@ -198,6 +207,7 @@ class GroupService { atGroupSink.add(groupList); } } catch (e) { + log(e.toString()); atGroupSink.add([]); } } @@ -283,7 +293,7 @@ class GroupService { var result = await atContactImpl.deleteGroup(group); await getAllGroupsDetails(); //updating group list sink return result; - } catch (e) { + } on Exception catch (e) { atSignLogger.severe('error in deleting group: $e'); return null; } @@ -317,10 +327,7 @@ class GroupService { /// contacts list is already present, we do not fetch it again. if (allContacts.isNotEmpty) { listContact.sort((a, b) { - int? index = a.atSign - .toString() - .substring(1) - .compareTo((b.atSign).toString().substring(1)); + int? index = a.atSign.toString().substring(1).compareTo((b.atSign).toString().substring(1)); return index; });