|
|
@@ -42,25 +42,34 @@ class FlutterPageLaunchUtil private constructor() {
|
|
|
args: Map<String, Serializable?> = mapOf<String, Serializable>(),
|
|
|
offAll: Boolean = false
|
|
|
) {
|
|
|
- val context = ContextUtil.getContext()
|
|
|
- val flutterEngine = FlutterEngineHolder.getFlutterEngine()
|
|
|
+// val context = ContextUtil.getContext()
|
|
|
+// val flutterEngine = FlutterEngineHolder.getFlutterEngine()
|
|
|
|
|
|
// 构建参数
|
|
|
val params = buildParams(path, args, offAll)
|
|
|
|
|
|
// 如果Activity存在,直接通过MethodChannel跳转Flutter页面
|
|
|
val currentActivity = ActivityProvider.get().currentActivity
|
|
|
- if (currentActivity != null && flutterEngine != null) {
|
|
|
- // 如果App在后台,则将App移动到前台
|
|
|
- if (AppMonitor.get().isAppBackground) {
|
|
|
- ActivityUtil.moveToFront(context)
|
|
|
- }
|
|
|
- // 再通知Flutter进行页面跳转
|
|
|
- JumpHostAppPageUtil.jumpAppPage(params, flutterEngine)
|
|
|
- } else {
|
|
|
- // 如果没有Activity,则通过原生Activity跳转
|
|
|
- val intent = buildIntent(params, offAll)
|
|
|
+ val newTask = ActivityUtil.isDestroy(currentActivity)
|
|
|
+
|
|
|
+// if (currentActivity != null && flutterEngine != null) {
|
|
|
+// // 如果App在后台,则将App移动到前台
|
|
|
+// if (AppMonitor.get().isAppBackground) {
|
|
|
+// ActivityUtil.moveToFront(context)
|
|
|
+// }
|
|
|
+// // 再通知Flutter进行页面跳转
|
|
|
+// JumpHostAppPageUtil.jumpAppPage(params, flutterEngine)
|
|
|
+// } else {
|
|
|
+// // 如果没有Activity,则通过原生Activity跳转
|
|
|
+// val intent = buildIntent(params, offAll)
|
|
|
+// Utils.getApp().startActivity(intent)
|
|
|
+// }
|
|
|
+
|
|
|
+ val intent = buildIntent(params, offAll, newTask)
|
|
|
+ if (newTask) {
|
|
|
Utils.getApp().startActivity(intent)
|
|
|
+ } else {
|
|
|
+ currentActivity.startActivity(intent)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -92,11 +101,11 @@ class FlutterPageLaunchUtil private constructor() {
|
|
|
*/
|
|
|
private fun buildIntent(
|
|
|
params: Map<String, Serializable?> = mapOf<String, Serializable>(),
|
|
|
- offAll: Boolean = false
|
|
|
+ offAll: Boolean = false,
|
|
|
+ newTask: Boolean = false
|
|
|
): Intent {
|
|
|
val intent: Intent = IntentUtils.getLaunchAppIntent(Utils.getApp().packageName)
|
|
|
- val currentActivity = ActivityProvider.get().currentActivity
|
|
|
- if (currentActivity == null) {
|
|
|
+ if (newTask) {
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
}
|
|
|
if (offAll) {
|