From 00d303ac367470fd71b944867ce518020efbac92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lollipopkit=F0=9F=8F=B3=EF=B8=8F=E2=80=8D=E2=9A=A7?= =?UTF-8?q?=EF=B8=8F?= <10864310+lollipopkit@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:37:19 +0800 Subject: [PATCH] fix: editing pref store (#618) --- ios/Podfile.lock | 102 +++----------------- lib/view/page/home/appbar.dart | 12 ++- lib/view/page/setting/platform/android.dart | 12 ++- macos/Podfile.lock | 6 ++ 4 files changed, 35 insertions(+), 97 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6920f9484..faa97a545 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,68 +1,18 @@ PODS: + - app_links (0.0.2): + - Flutter + - camera_avfoundation (0.0.1): + - Flutter - file_picker (0.0.1): - Flutter - Flutter (1.0.0) - - flutter_background_service_ios (0.0.3): - - Flutter - flutter_native_splash (0.0.1): - Flutter - - GoogleDataTransport (9.4.1): - - GoogleUtilities/Environment (~> 7.7) - - nanopb (< 2.30911.0, >= 2.30908.0) - - PromisesObjC (< 3.0, >= 1.2) - - GoogleMLKit/BarcodeScanning (6.0.0): - - GoogleMLKit/MLKitCore - - MLKitBarcodeScanning (~> 5.0.0) - - GoogleMLKit/MLKitCore (6.0.0): - - MLKitCommon (~> 11.0.0) - - GoogleToolboxForMac/Defines (4.2.1) - - GoogleToolboxForMac/Logger (4.2.1): - - GoogleToolboxForMac/Defines (= 4.2.1) - - "GoogleToolboxForMac/NSData+zlib (4.2.1)": - - GoogleToolboxForMac/Defines (= 4.2.1) - - GoogleUtilities/Environment (7.13.3): - - GoogleUtilities/Privacy - - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.13.3): - - GoogleUtilities/Environment - - GoogleUtilities/Privacy - - GoogleUtilities/Privacy (7.13.3) - - GoogleUtilities/UserDefaults (7.13.3): - - GoogleUtilities/Logger - - GoogleUtilities/Privacy - - GoogleUtilitiesComponents (1.1.0): - - GoogleUtilities/Logger - - GTMSessionFetcher/Core (3.5.0) - icloud_storage (0.0.1): - Flutter - local_auth_darwin (0.0.1): - Flutter - FlutterMacOS - - MLImage (1.0.0-beta5) - - MLKitBarcodeScanning (5.0.0): - - MLKitCommon (~> 11.0) - - MLKitVision (~> 7.0) - - MLKitCommon (11.0.0): - - GoogleDataTransport (< 10.0, >= 9.4.1) - - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) - - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" - - GoogleUtilities/UserDefaults (< 8.0, >= 7.13.0) - - GoogleUtilitiesComponents (~> 1.0) - - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) - - MLKitVision (7.0.0): - - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) - - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" - - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) - - MLImage (= 1.0.0-beta5) - - MLKitCommon (~> 11.0) - - mobile_scanner (5.1.1): - - Flutter - - GoogleMLKit/BarcodeScanning (~> 6.0.0) - - nanopb (2.30910.0): - - nanopb/decode (= 2.30910.0) - - nanopb/encode (= 2.30910.0) - - nanopb/decode (2.30910.0) - - nanopb/encode (2.30910.0) - package_info_plus (0.4.5): - Flutter - path_provider_foundation (0.0.1): @@ -70,7 +20,6 @@ PODS: - FlutterMacOS - plain_notification_token (0.0.1): - Flutter - - PromisesObjC (2.4.0) - share_plus (0.0.1): - Flutter - shared_preferences_foundation (0.0.1): @@ -86,13 +35,13 @@ PODS: - Flutter DEPENDENCIES: + - app_links (from `.symlinks/plugins/app_links/ios`) + - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - - flutter_background_service_ios (from `.symlinks/plugins/flutter_background_service_ios/ios`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - icloud_storage (from `.symlinks/plugins/icloud_storage/ios`) - local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`) - - mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - plain_notification_token (from `.symlinks/plugins/plain_notification_token/ios`) @@ -103,36 +52,21 @@ DEPENDENCIES: - watch_connectivity (from `.symlinks/plugins/watch_connectivity/ios`) - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) -SPEC REPOS: - trunk: - - GoogleDataTransport - - GoogleMLKit - - GoogleToolboxForMac - - GoogleUtilities - - GoogleUtilitiesComponents - - GTMSessionFetcher - - MLImage - - MLKitBarcodeScanning - - MLKitCommon - - MLKitVision - - nanopb - - PromisesObjC - EXTERNAL SOURCES: + app_links: + :path: ".symlinks/plugins/app_links/ios" + camera_avfoundation: + :path: ".symlinks/plugins/camera_avfoundation/ios" file_picker: :path: ".symlinks/plugins/file_picker/ios" Flutter: :path: Flutter - flutter_background_service_ios: - :path: ".symlinks/plugins/flutter_background_service_ios/ios" flutter_native_splash: :path: ".symlinks/plugins/flutter_native_splash/ios" icloud_storage: :path: ".symlinks/plugins/icloud_storage/ios" local_auth_darwin: :path: ".symlinks/plugins/local_auth_darwin/darwin" - mobile_scanner: - :path: ".symlinks/plugins/mobile_scanner/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: @@ -153,28 +87,16 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" SPEC CHECKSUMS: + app_links: e7a6750a915a9e161c58d91bc610e8cd1d4d0ad0 + camera_avfoundation: dd002b0330f4981e1bbcb46ae9b62829237459a4 file_picker: c79185e70b9b45728cde2a8d8da454e0cb43f287 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_background_service_ios: e30e0d3ee69e4cee66272d0c78eacd48c2e94aac flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778 - GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a - GoogleMLKit: 97ac7af399057e99182ee8edfa8249e3226a4065 - GoogleToolboxForMac: d1a2cbf009c453f4d6ded37c105e2f67a32206d8 - GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 - GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe - GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 icloud_storage: d9ac7a33ced81df08ba7ea1bf3099cc0ee58f60a local_auth_darwin: 66e40372f1c29f383a314c738c7446e2f7fdadc3 - MLImage: 1824212150da33ef225fbd3dc49f184cf611046c - MLKitBarcodeScanning: 10ca0845a6d15f2f6e911f682a1998b68b973e8b - MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1 - MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1 - mobile_scanner: 8564358885a9253c43f822435b70f9345c87224f - nanopb: 438bc412db1928dac798aa6fd75726007be04262 package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 plain_notification_token: b36467dc91939a7b6754267c701bbaca14996ee1 - PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe diff --git a/lib/view/page/home/appbar.dart b/lib/view/page/home/appbar.dart index e0b4a06b2..6d51ddebd 100644 --- a/lib/view/page/home/appbar.dart +++ b/lib/view/page/home/appbar.dart @@ -8,7 +8,7 @@ final class _AppBar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { return SizedBox( - height: paddingTop, + height: preferredSize.height, child: isIOS ? const Center(child: Text(BuildData.name, style: UIs.text15Bold)) : null, @@ -16,5 +16,11 @@ final class _AppBar extends StatelessWidget implements PreferredSizeWidget { } @override - Size get preferredSize => Size.fromHeight(paddingTop); -} + Size get preferredSize { + final height = switch (Pfs.type) { + Pfs.macos => paddingTop + (CustomAppBar.sysStatusBarHeight ?? 0), + _ => paddingTop, + }; + return Size.fromHeight(height); + } +} \ No newline at end of file diff --git a/lib/view/page/setting/platform/android.dart b/lib/view/page/setting/platform/android.dart index 2ce809beb..6151fe04a 100644 --- a/lib/view/page/setting/platform/android.dart +++ b/lib/view/page/setting/platform/android.dart @@ -11,6 +11,8 @@ class AndroidSettingsPage extends StatefulWidget { State createState() => _AndroidSettingsPageState(); } +const _homeWidgetPrefPrefix = 'widget_'; + class _AndroidSettingsPageState extends State { @override Widget build(BuildContext context) { @@ -39,11 +41,13 @@ class _AndroidSettingsPageState extends State { try { final keysDel = old.keys.toSet().difference(map.keys.toSet()); for (final key in keysDel) { + if (!key.startsWith(_homeWidgetPrefPrefix)) continue; PrefStore.remove(key); } - map.forEach((key, value) { - PrefStore.set(key, value); - }); + for (final entry in map.entries) { + if (!entry.key.startsWith(_homeWidgetPrefPrefix)) continue; + PrefStore.set(entry.key, entry.value); + } context.showSnackBar(libL10n.success); } catch (e) { context.showSnackBar(e.toString()); @@ -64,7 +68,7 @@ class _AndroidSettingsPageState extends State { } final result = await KvEditor.route.go( context, - KvEditorArgs(data: data, prefix: 'widget_'), + KvEditorArgs(data: data, prefix: _homeWidgetPrefPrefix), ); if (result != null) { _saveWidgetSP(result, data); diff --git a/macos/Podfile.lock b/macos/Podfile.lock index c26542cab..58fca6cf9 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,4 +1,6 @@ PODS: + - app_links (1.0.0): + - FlutterMacOS - dynamic_color (0.0.2): - FlutterMacOS - FlutterMacOS (1.0.0) @@ -27,6 +29,7 @@ PODS: - FlutterMacOS DEPENDENCIES: + - app_links (from `Flutter/ephemeral/.symlinks/plugins/app_links/macos`) - dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - icloud_storage (from `Flutter/ephemeral/.symlinks/plugins/icloud_storage/macos`) @@ -41,6 +44,8 @@ DEPENDENCIES: - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) EXTERNAL SOURCES: + app_links: + :path: Flutter/ephemeral/.symlinks/plugins/app_links/macos dynamic_color: :path: Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos FlutterMacOS: @@ -67,6 +72,7 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos SPEC CHECKSUMS: + app_links: 10e0a0ab602ffaf34d142cd4862f29d34b303b2a dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 icloud_storage: 33b05299e26d1391d724da8d62860e702380a1cd