浏览代码

[feat]添加键盘跳转主客户端逻辑

Destiny 7 月之前
父节点
当前提交
5fe6fc2fef

+ 4 - 0
ios/AiKeyboard/Info.plist

@@ -2,6 +2,10 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>LSApplicationQueriesSchemes</key>
+	<array>
+		<string>com.qihuan.zhuiaijianpan</string>
+	</array>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSApplicationQueriesSchemes</key>

+ 7 - 0
ios/Podfile

@@ -134,4 +134,11 @@ post_install do |installer|
          end
     end
   end
+  installer.generated_projects.each do |project|
+    project.targets.each do |target|
+        target.build_configurations.each do |config|
+            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
+         end
+    end
+  end
 end

+ 3 - 2
ios/Runner.xcodeproj/xcshareddata/xcschemes/AiKeyboard.xcscheme

@@ -2,7 +2,7 @@
 <Scheme
    LastUpgradeVersion = "1500"
    wasCreatedForAppExtension = "YES"
-   version = "1.7">
+   version = "2.0">
    <BuildAction
       parallelizeBuildables = "YES"
       buildImplicitDependencies = "YES">
@@ -49,6 +49,7 @@
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"
+      askForAppToLaunch = "Yes"
       useCustomWorkingDirectory = "NO"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
@@ -63,7 +64,7 @@
             BlueprintName = "Runner"
             ReferencedContainer = "container:Runner.xcodeproj">
          </BuildableReference>
-      </BuildableProductRunnable>
+      </MacroExpansion>
    </LaunchAction>
    <ProfileAction
       buildConfiguration = "Release"

+ 0 - 36
lib/data/repository/account_repository.dart

@@ -273,42 +273,6 @@ class AccountRepository {
     }
   }
 
-  // 保存token到ios端
-  Future<void> saveAuthToken(String token) async {
-    // 通知iOS键盘扩展
-    if (Platform.isIOS) {
-      const MethodChannel channel = MethodChannel('keyboard_ios');
-      channel.invokeMethod('saveAuthToken', {'token': token});
-    }
-  }
-
-  // 保存token到ios端
-  Future<void> clearAuthToken() async {
-    // 通知iOS键盘扩展
-    if (Platform.isIOS) {
-      const MethodChannel channel = MethodChannel('keyboard_ios');
-      channel.invokeMethod('clearAuthToken');
-    }
-  }
-
-  // 保存token到ios端
-  Future<void> saveAuthToken(String token) async {
-    // 通知iOS键盘扩展
-    if (Platform.isIOS) {
-      const MethodChannel channel = MethodChannel('keyboard_ios');
-      channel.invokeMethod('saveAuthToken', {'token': token});
-    }
-  }
-
-  // 保存token到ios端
-  Future<void> clearAuthToken() async {
-    // 通知iOS键盘扩展
-    if (Platform.isIOS) {
-      const MethodChannel channel = MethodChannel('keyboard_ios');
-      channel.invokeMethod('clearAuthToken');
-    }
-  }
-
   // 意见反馈
   Future<void> complaintSubmit(String? phone, String content) {
     return atmobApi

+ 32 - 0
lib/utils/navitigation_handler.dart

@@ -0,0 +1,32 @@
+import 'package:flutter/services.dart';
+import 'package:get/get.dart';
+import 'package:keyboard/module/login/login_page.dart';
+import 'package:keyboard/module/store/store_page.dart';
+
+class NavigationHandler {
+  static final NavigationHandler _instance = NavigationHandler._internal();
+  factory NavigationHandler() => _instance;
+  NavigationHandler._internal();
+
+  static const MethodChannel _channel = MethodChannel('keyboard_ios');
+
+  static void initialize() {
+    _channel.setMethodCallHandler(_handleMethod);
+  }
+
+  static Future<dynamic> _handleMethod(MethodCall call) async {
+    switch (call.method) {
+      case 'navigateToLogin':
+        LoginPage.start();
+        break;
+      case 'navigateToMember':
+        StorePage.start();
+        break;
+      default:
+        throw PlatformException(
+          code: 'Unimplemented',
+          details: '未实现的方法: ${call.method}',
+        );
+    }
+  }
+}