From 68069af2b673408446fb11109d76d3e713807638 Mon Sep 17 00:00:00 2001 From: gaoyunfei Date: Fri, 9 Dec 2022 11:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.gradle | 4 +-- .../com/finogeeks/mop/utils/AppletUtils.java | 33 +++++++------------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index f2d636a..2a58dab 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -91,6 +91,6 @@ kapt { } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.finogeeks.lib:finapplet:2.38.10-alpha20221207v05' - implementation 'com.finogeeks.mop:plugins:2.38.10-alpha20221207v05' + implementation 'com.finogeeks.lib:finapplet:2.38.10-alpha20221209v01' + implementation 'com.finogeeks.mop:plugins:2.38.10-alpha20221209v01' } \ No newline at end of file diff --git a/android/src/main/java/com/finogeeks/mop/utils/AppletUtils.java b/android/src/main/java/com/finogeeks/mop/utils/AppletUtils.java index 8c3d6ab..6306111 100644 --- a/android/src/main/java/com/finogeeks/mop/utils/AppletUtils.java +++ b/android/src/main/java/com/finogeeks/mop/utils/AppletUtils.java @@ -1,38 +1,29 @@ package com.finogeeks.mop.utils; -import android.app.PendingIntent; import android.content.Context; -import android.content.Intent; -import android.text.TextUtils; import com.finogeeks.lib.applet.client.FinAppClient; +import com.finogeeks.lib.applet.client.FinAppProcessClient; +import com.finogeeks.lib.applet.main.FinAppHomeActivity; import com.finogeeks.mop.interfaces.ICallback; public class AppletUtils { public static void moveCurrentAppletToFront(Context context, ICallback callback) { try { - String currentAppletId = FinAppClient.INSTANCE.getAppletApiManager().getCurrentAppletId(); - if (currentAppletId == null || TextUtils.isEmpty(currentAppletId)) { - if (callback != null) { - callback.onFail(null); + if (FinAppClient.INSTANCE.isFinAppProcess(context)) { + FinAppHomeActivity activity = (FinAppHomeActivity) FinAppProcessClient.INSTANCE.getAppletProcessActivity(); + if (activity != null) { + activity.moveTaskToFront(); } - return; - } - String activityName = FinAppClient.INSTANCE.getAppletApiManager().getAppletActivityName(currentAppletId); - if (activityName == null) { - if (callback != null) { - callback.onFail(null); + } else { + String currentAppletId = FinAppClient.INSTANCE.getAppletApiManager().getCurrentAppletId(); + if (currentAppletId != null) { + FinAppClient.INSTANCE.getAppletApiManager().moveTaskToFront(currentAppletId); } - return; } - if (activityName.contains("@")) { - activityName = activityName.substring(0, activityName.indexOf("@")); + if (callback != null) { + callback.onSuccess(null); } - Intent intent = new Intent(context, Class.forName(activityName)); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - PendingIntent pendingIntent = PendingIntent.getActivities(context, 0, new Intent[]{intent}, 0); - pendingIntent.send(); - callback.onSuccess(null); } catch (Exception e) { e.printStackTrace(); if (callback != null) {