|
|
@@ -23,15 +23,8 @@ class FlutterPageLaunchUtil private constructor() {
|
|
|
) {
|
|
|
val flutterEngine = FlutterEngineHolder.getFlutterEngine()
|
|
|
if (flutterEngine != null) {
|
|
|
- val params = mutableMapOf<String, Serializable?>()
|
|
|
- // 添加跳转来源
|
|
|
- params.put(FlutterHostConstants.KEY_JUMP_SOURCE, "keyboard_android")
|
|
|
- // 添加Flutter路由路径
|
|
|
- params.put(FlutterHostConstants.KEY_PATH, path)
|
|
|
- // 添加跳转参数
|
|
|
- params.put(FlutterHostConstants.KEY_ARGS, JsonUtil.toJson(args))
|
|
|
- // 是否跳转到新页面后,并清除上层的所有页面
|
|
|
- params.put(FlutterHostConstants.OFF_ALL, offAll)
|
|
|
+ // 构建参数
|
|
|
+ val params = buildParams(path, args, offAll)
|
|
|
// 再通知Flutter进行页面跳转
|
|
|
JumpHostAppPageUtil.jumpAppPage(params, flutterEngine)
|
|
|
}
|
|
|
@@ -52,15 +45,8 @@ class FlutterPageLaunchUtil private constructor() {
|
|
|
val context = ContextUtil.getContext()
|
|
|
val flutterEngine = FlutterEngineHolder.getFlutterEngine()
|
|
|
|
|
|
- val params = mutableMapOf<String, Serializable?>()
|
|
|
- // 添加跳转来源
|
|
|
- params.put(FlutterHostConstants.KEY_JUMP_SOURCE, "keyboard_android")
|
|
|
- // 添加Flutter路由路径
|
|
|
- params.put(FlutterHostConstants.KEY_PATH, path)
|
|
|
- // 添加跳转参数
|
|
|
- params.put(FlutterHostConstants.KEY_ARGS, JsonUtil.toJson(args))
|
|
|
- // 是否跳转到新页面后,并清除上层的所有页面
|
|
|
- params.put(FlutterHostConstants.OFF_ALL, offAll)
|
|
|
+ // 构建参数
|
|
|
+ val params = buildParams(path, args, offAll)
|
|
|
|
|
|
// 如果Activity存在,直接通过MethodChannel跳转Flutter页面
|
|
|
val currentActivity = ActivityProvider.get().currentActivity
|
|
|
@@ -79,6 +65,29 @@ class FlutterPageLaunchUtil private constructor() {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 构建跳转参数
|
|
|
+ */
|
|
|
+ private fun buildParams(
|
|
|
+ path: String,
|
|
|
+ args: Map<String, Serializable?>,
|
|
|
+ offAll: Boolean
|
|
|
+ ): Map<String, Serializable?> {
|
|
|
+ val params = mutableMapOf<String, Serializable?>()
|
|
|
+ // 添加跳转来源
|
|
|
+ params.put(
|
|
|
+ FlutterHostConstants.KEY_JUMP_SOURCE,
|
|
|
+ FlutterHostConstants.JUMP_SOURCE_ANDROID
|
|
|
+ )
|
|
|
+ // 添加Flutter路由路径
|
|
|
+ params.put(FlutterHostConstants.KEY_PATH, path)
|
|
|
+ // 添加跳转参数
|
|
|
+ params.put(FlutterHostConstants.KEY_ARGS, JsonUtil.toJson(args))
|
|
|
+ // 是否跳转到新页面后,并清除上层的所有页面
|
|
|
+ params.put(FlutterHostConstants.OFF_ALL, offAll)
|
|
|
+ return params
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 构建Intent
|
|
|
*/
|
|
|
private fun buildIntent(
|