本地版本

master
gaoyunfei 2022-12-09 11:16:46 +08:00
parent abb51a0364
commit 68069af2b6
2 changed files with 14 additions and 23 deletions

View File

@ -91,6 +91,6 @@ kapt {
} }
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.finogeeks.lib:finapplet:2.38.10-alpha20221207v05' implementation 'com.finogeeks.lib:finapplet:2.38.10-alpha20221209v01'
implementation 'com.finogeeks.mop:plugins:2.38.10-alpha20221207v05' implementation 'com.finogeeks.mop:plugins:2.38.10-alpha20221209v01'
} }

View File

@ -1,38 +1,29 @@
package com.finogeeks.mop.utils; package com.finogeeks.mop.utils;
import android.app.PendingIntent;
import android.content.Context; 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.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppProcessClient;
import com.finogeeks.lib.applet.main.FinAppHomeActivity;
import com.finogeeks.mop.interfaces.ICallback; import com.finogeeks.mop.interfaces.ICallback;
public class AppletUtils { public class AppletUtils {
public static void moveCurrentAppletToFront(Context context, ICallback<Object> callback) { public static void moveCurrentAppletToFront(Context context, ICallback<Object> callback) {
try { try {
if (FinAppClient.INSTANCE.isFinAppProcess(context)) {
FinAppHomeActivity activity = (FinAppHomeActivity) FinAppProcessClient.INSTANCE.getAppletProcessActivity();
if (activity != null) {
activity.moveTaskToFront();
}
} else {
String currentAppletId = FinAppClient.INSTANCE.getAppletApiManager().getCurrentAppletId(); String currentAppletId = FinAppClient.INSTANCE.getAppletApiManager().getCurrentAppletId();
if (currentAppletId == null || TextUtils.isEmpty(currentAppletId)) { if (currentAppletId != null) {
FinAppClient.INSTANCE.getAppletApiManager().moveTaskToFront(currentAppletId);
}
}
if (callback != null) { if (callback != null) {
callback.onFail(null);
}
return;
}
String activityName = FinAppClient.INSTANCE.getAppletApiManager().getAppletActivityName(currentAppletId);
if (activityName == null) {
if (callback != null) {
callback.onFail(null);
}
return;
}
if (activityName.contains("@")) {
activityName = activityName.substring(0, activityName.indexOf("@"));
}
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); callback.onSuccess(null);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
if (callback != null) { if (callback != null) {