From 9c00dc8a5482a4cd50f075ed12d46d4b16e65909 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Fri, 17 Feb 2023 18:57:16 +0800 Subject: [PATCH] try to solve `file_picker` on ios --- ios/Podfile | 5 +++ ios/Podfile.lock | 51 ++-------------------------- ios/Runner.xcodeproj/project.pbxproj | 12 +++---- ios/Runner/Info.plist | 16 ++++++--- lib/core/utils/misc.dart | 6 ++++ lib/data/res/build_data.dart | 9 +++-- lib/view/page/private_key/edit.dart | 9 ++--- 7 files changed, 37 insertions(+), 71 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index 88359b22..4b7f1ab0 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -27,6 +27,11 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe flutter_ios_podfile_setup +# Used for flutter lib "file_picker" +Pod::PICKER_MEDIA = false +Pod::PICKER_AUDIO = false +Pod::PICKER_DOCUMENT = false + target 'Runner' do use_frameworks! use_modular_headers! diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8e1f917c..6aca1e61 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,39 +1,7 @@ PODS: - countly_flutter (22.09.0): - Flutter - - DKImagePickerController/Core (4.3.4): - - DKImagePickerController/ImageDataManager - - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.3.4) - - DKImagePickerController/PhotoGallery (4.3.4): - - DKImagePickerController/Core - - DKPhotoGallery - - DKImagePickerController/Resource (4.3.4) - - DKPhotoGallery (0.0.17): - - DKPhotoGallery/Core (= 0.0.17) - - DKPhotoGallery/Model (= 0.0.17) - - DKPhotoGallery/Preview (= 0.0.17) - - DKPhotoGallery/Resource (= 0.0.17) - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Core (0.0.17): - - DKPhotoGallery/Model - - DKPhotoGallery/Preview - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Model (0.0.17): - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Preview (0.0.17): - - DKPhotoGallery/Model - - DKPhotoGallery/Resource - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Resource (0.0.17): - - SDWebImage - - SwiftyGif - file_picker (0.0.1): - - DKImagePickerController/PhotoGallery - Flutter - Flutter (1.0.0) - flutter_native_splash (0.0.1): @@ -43,12 +11,8 @@ PODS: - FlutterMacOS - r_upgrade (0.0.1): - Flutter - - SDWebImage (5.15.2): - - SDWebImage/Core (= 5.15.2) - - SDWebImage/Core (5.15.2) - share_plus (0.0.1): - Flutter - - SwiftyGif (5.4.4) - url_launcher_ios (0.0.1): - Flutter @@ -62,13 +26,6 @@ DEPENDENCIES: - share_plus (from `.symlinks/plugins/share_plus/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) -SPEC REPOS: - trunk: - - DKImagePickerController - - DKPhotoGallery - - SDWebImage - - SwiftyGif - EXTERNAL SOURCES: countly_flutter: :path: ".symlinks/plugins/countly_flutter/ios" @@ -89,18 +46,14 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: countly_flutter: 135f1a4930f8e26ba223a14201d3f265ea7b4c83 - DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac - DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 - file_picker: ce3938a0df3cc1ef404671531facef740d03f920 + file_picker: ec55172937ec2d774460eb4538bad01df0171d81 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114 - SDWebImage: 8ab87d4b3e5cc4927bd47f78db6ceb0b94442577 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 - SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2 -PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 +PODFILE CHECKSUM: 2b69360f043c9ddaf997545332dc5203c4792a49 COCOAPODS: 1.11.3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 18a9c1a4..5c2ea065 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -356,7 +356,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 221; + CURRENT_PROJECT_VERSION = 223; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -364,7 +364,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.221; + MARKETING_VERSION = 1.0.223; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -486,7 +486,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 221; + CURRENT_PROJECT_VERSION = 223; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -494,7 +494,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.221; + MARKETING_VERSION = 1.0.223; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -510,7 +510,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 221; + CURRENT_PROJECT_VERSION = 223; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -518,7 +518,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.221; + MARKETING_VERSION = 1.0.223; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 2e70e0ba..cf3cd419 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -47,8 +47,16 @@ zh CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - - + + UIApplicationSupportsIndirectInputEvents + + UIBackgroundModes + + fetch + + LSSupportsOpeningDocumentsInPlace + + ITSAppUsesNonExemptEncryption + + diff --git a/lib/core/utils/misc.dart b/lib/core/utils/misc.dart index 8f082323..b09e8c6a 100644 --- a/lib/core/utils/misc.dart +++ b/lib/core/utils/misc.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:share_plus/share_plus.dart'; @@ -26,3 +27,8 @@ Future shareFiles(BuildContext context, List filePaths) async { void copy(String text) { Clipboard.setData(ClipboardData(text: text)); } + +Future pickOneFile() async { + final result = await FilePicker.platform.pickFiles(type: FileType.any); + return result?.files.single.path; +} diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index e80adea5..67785fab 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,9 +2,8 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 221; - static const String engine = - "Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (8 days ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n"; - static const String buildAt = "2023-02-17 15:57:59.844806"; - static const int modifications = 2; + static const int build = 223; + static const String engine = "Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (8 days ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n"; + static const String buildAt = "2023-02-17 18:51:44.086252"; + static const int modifications = 7; } diff --git a/lib/view/page/private_key/edit.dart b/lib/view/page/private_key/edit.dart index eca22a01..6ec416ce 100644 --- a/lib/view/page/private_key/edit.dart +++ b/lib/view/page/private_key/edit.dart @@ -2,11 +2,11 @@ import 'dart:io'; import 'package:after_layout/after_layout.dart'; import 'package:dartssh2/dartssh2.dart'; -import 'package:file_picker/file_picker.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:toolbox/core/extension/numx.dart'; +import 'package:toolbox/core/utils/misc.dart'; import 'package:toolbox/data/res/misc.dart'; import '../../../core/utils/ui.dart'; @@ -97,12 +97,7 @@ class _PrivateKeyEditPageState extends State ), TextButton( onPressed: () async { - final result = await FilePicker.platform.pickFiles(); - if (result == null) { - return; - } - - final path = result.files.single.path; + final path = await pickOneFile(); if (path == null) { showSnackBar(context, const Text('path is null')); return;