增加运行时版本显示

master
kangxuyao 2020-07-22 15:30:54 +08:00
parent 1dab12441e
commit 0a25869196
6 changed files with 76 additions and 1 deletions

View File

@ -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'
}

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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

View File

@ -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

View File

@ -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
///