增加运行时版本显示
parent
1dab12441e
commit
0a25869196
|
@ -91,6 +91,6 @@ kapt {
|
|||
}
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.finogeeks.lib:finapplet:2.8.77'
|
||||
implementation 'com.finogeeks.lib:finapplet:2.9.2'
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.finogeeks.mop.api.mop.AppletManageModule;
|
|||
import com.finogeeks.mop.api.mop.AppletModule;
|
||||
import com.finogeeks.mop.api.mop.BaseModule;
|
||||
import com.finogeeks.mop.api.mop.ExtensionApiModule;
|
||||
import com.finogeeks.mop.api.mop.VersionModule;
|
||||
import com.finogeeks.mop.interfaces.Event;
|
||||
import com.finogeeks.mop.interfaces.IApi;
|
||||
|
||||
|
@ -67,6 +68,7 @@ public class ApisManager {
|
|||
add(new AppletManageModule(activity));
|
||||
add(new AppletHandlerModule(activity));
|
||||
add(new ExtensionApiModule(activity));
|
||||
add(new VersionModule(activity));
|
||||
}
|
||||
|
||||
private void add(IApi api) {
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.finogeeks.mop.api.mop;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.finogeeks.lib.applet.BuildConfig;
|
||||
import com.finogeeks.mop.api.BaseApi;
|
||||
import com.finogeeks.mop.interfaces.ICallback;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class VersionModule extends BaseApi {
|
||||
|
||||
public VersionModule(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] apis() {
|
||||
return new String[]{"sdkVersion"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(String event, Map param, ICallback callback) {
|
||||
callback.onSuccess(BuildConfig.VERSION_NAME);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// MOP_sdkVersion.h
|
||||
// mop
|
||||
//
|
||||
// Created by 康旭耀 on 2020/7/22.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MOPBaseApi.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MOP_sdkVersion : MOPBaseApi
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// MOP_sdkVersion.m
|
||||
// mop
|
||||
//
|
||||
// Created by 康旭耀 on 2020/7/22.
|
||||
//
|
||||
|
||||
#import "MOP_sdkVersion.h"
|
||||
#import <FinApplet/FinApplet.h>
|
||||
|
||||
@implementation MOP_sdkVersion
|
||||
|
||||
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel
|
||||
{
|
||||
NSLog(@"sdkVersion");
|
||||
NSString *version = [[FATClient sharedClient] version];
|
||||
success(version);
|
||||
}
|
||||
|
||||
@end
|
|
@ -129,6 +129,15 @@ class Mop {
|
|||
return await _channel.invokeMethod("clearApplets");
|
||||
}
|
||||
|
||||
///
|
||||
/// 获取运行时版本号
|
||||
///
|
||||
Future<String> sdkVersion() async {
|
||||
return await _channel
|
||||
.invokeMapMethod("sdkVersion")
|
||||
.then((value) => value["data"]);
|
||||
}
|
||||
|
||||
///
|
||||
/// register handler to provide custom info or behaviour
|
||||
/// 注册小程序事件处理
|
||||
|
|
Loading…
Reference in New Issue