diff --git a/android/app/src/main/kotlin/com/saitong/voitrans/MainActivity.kt b/android/app/src/main/kotlin/com/saitong/voitrans/MainActivity.kt index 135cbbf48..0e6d18281 100644 --- a/android/app/src/main/kotlin/com/saitong/voitrans/MainActivity.kt +++ b/android/app/src/main/kotlin/com/saitong/voitrans/MainActivity.kt @@ -145,7 +145,15 @@ class MainActivity: FlutterActivity() { val pluginRegistry = flutterEngine.plugins // 只有在插件未注册时才调用 GeneratedPluginRegistrant - if (!pluginRegistry.has(io.flutter.plugins.pathprovider.PathProviderPlugin::class.java)) { + @Suppress("UNCHECKED_CAST") + val pathProviderClass = try { + Class.forName("io.flutter.plugins.pathprovider.PathProviderPlugin") + as Class + } catch (e: ClassNotFoundException) { + null + } + + if (pathProviderClass == null || !pluginRegistry.has(pathProviderClass)) { Log.d(TAG, "📦 注册 Flutter 插件") super.configureFlutterEngine(flutterEngine) GeneratedPluginRegistrant.registerWith(flutterEngine) diff --git a/ios/Podfile b/ios/Podfile index 41d32f019..1eddcd398 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,8 +1,6 @@ # Define a global platform for your project platform :ios, '16.0' -$FirebaseSDKVersion = '11.13.0' - # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -40,6 +38,31 @@ target 'Runner' do end post_install do |installer| + # ---- Auto patch: bridge symlink for swift_sdk_local ---- + # local_plugins/chat_api/ios/chat_api/Package.swift 用 path 引用 + # `../../../swift_sdk_local`。Flutter 会把 chat_api 软链进 + # ios/Flutter/ephemeral/Packages/.packages/chat_api,SwiftPM 解析这条相对路径时 + # 用的是软链路径,会去 ios/Flutter/ephemeral/swift_sdk_local 找包。 + # 这里建一条桥接软链让它能找到 local_plugins/swift_sdk_local。 + ephemeral_dir = File.expand_path('Flutter/ephemeral', __dir__) + if Dir.exist?(ephemeral_dir) + bridge_link = File.join(ephemeral_dir, 'swift_sdk_local') + bridge_target = '../../../local_plugins/swift_sdk_local' + # 已存在且指向正确就跳过;否则重建 + needs_create = true + if File.symlink?(bridge_link) + current = File.readlink(bridge_link) + needs_create = (current != bridge_target) + File.delete(bridge_link) if needs_create + elsif File.exist?(bridge_link) + raise "[Podfile patch] #{bridge_link} 已存在但不是软链,无法替换;请手动处理" + end + if needs_create + File.symlink(bridge_target, bridge_link) + puts "[Podfile patch] Created swift_sdk_local bridge symlink: #{bridge_link} -> #{bridge_target}" + end + end + # ---- Auto patch: bump FlutterGeneratedPluginSwiftPackage iOS platform ---- # Flutter 生成的中介包总是写死 .iOS("12.0"),与 Podfile 中的 # platform :ios, '16.0' 不一致,会报 diff --git a/pubspec.yaml b/pubspec.yaml index 7b5226d12..147103f89 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,7 +50,7 @@ dependencies: package_info_plus: ^8.3.0 file_picker: ^10.2.0 haptic_feedback: ^0.5.1+1 - tencentcloud_cos_sdk_plugin: ^1.2.3 + tencentcloud_cos_sdk_plugin: 1.2.8 photo_view: ^0.15.0 window_size: git: