From acf9c5446321353d7ab2c82142ef7a1834b5f861 Mon Sep 17 00:00:00 2001 From: yangbingqiao Date: Fri, 3 Sep 2021 12:26:19 +0800 Subject: [PATCH] =?UTF-8?q?Flutter=E7=AB=AF=E5=92=8CAndroid=E7=AB=AF?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0removeUsedApplet=20api;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/finogeeks/mop/api/mop/AppletManageModule.java | 10 +++++++++- lib/mop.dart | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java index cd287af..216c4ae 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java @@ -19,7 +19,7 @@ public class AppletManageModule extends BaseApi { @Override public String[] apis() { - return new String[]{"currentApplet", "closeAllApplets", "clearApplets"}; + return new String[]{"currentApplet", "closeAllApplets", "clearApplets", "removeUsedApplet"}; } @Override @@ -49,6 +49,14 @@ public class AppletManageModule extends BaseApi { } else if (event.equals("clearApplets")) { FinAppClient.INSTANCE.getAppletApiManager().clearApplets(); callback.onSuccess(null); + } else if (event.equals("removeUsedApplet")) { + if (param.containsKey("appId") && param.get("appId") instanceof String) { + String appId = (String) param.get("appId"); + FinAppClient.INSTANCE.getAppletApiManager().removeUsedApplet(appId); + callback.onSuccess(null); + } else { + callback.onFail(null); + } } } } diff --git a/lib/mop.dart b/lib/mop.dart index e422084..e155152 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:math'; import 'package:flutter/services.dart'; import 'package:mop/api.dart'; @@ -156,6 +155,12 @@ class Mop { return await _channel.invokeMethod("clearApplets"); } + /// 清除指定的小程序本体缓存 + Future removeUsedApplet(String appId) async { + Map params = {'appId': appId}; + return await _channel.invokeMethod("removeUsedApplet", params); + } + /// /// 获取运行时版本号 ///