增加国密配置
parent
01be3d6e8a
commit
0cc86db64d
|
@ -1,6 +1,7 @@
|
|||
package com.finogeeks.mop.api.mop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.finogeeks.lib.applet.client.FinAppClient;
|
||||
|
@ -25,6 +26,7 @@ public class BaseModule extends BaseApi {
|
|||
super.onCreate();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] apis() {
|
||||
return new String[]{"initialize"};
|
||||
|
@ -41,6 +43,10 @@ public class BaseModule extends BaseApi {
|
|||
String secret = String.valueOf(param.get("secret"));
|
||||
String apiServer = "https://mp.finogeeks.com";
|
||||
String apiPrefix = "/api/v1/mop/";
|
||||
String cryptType = (String) param.get("cryptType");
|
||||
if (cryptType == null || cryptType.isEmpty()) {
|
||||
cryptType = "MD5";
|
||||
}
|
||||
if (param.get("apiServer") != null) {
|
||||
apiServer = String.valueOf(param.get("apiServer"));
|
||||
}
|
||||
|
@ -56,7 +62,7 @@ public class BaseModule extends BaseApi {
|
|||
.setApiUrl(apiServer)
|
||||
.setApiPrefix(apiPrefix)
|
||||
.setGlideWithJWT(false)
|
||||
.setEncryptionType("SM")
|
||||
.setEncryptionType(cryptType)
|
||||
.build();
|
||||
// SDK初始化结果回调,用于接收SDK初始化状态
|
||||
FinCallback<Object> cb = new FinCallback<Object>() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
source 'https://git.finogeeks.club/finoapp-ios/FinPods'
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
PODS:
|
||||
- FinApplet (2.1.5)
|
||||
- FinApplet (2.1.23)
|
||||
- Flutter (1.0.0)
|
||||
- mop (0.1.0):
|
||||
- FinApplet (= 2.1.5)
|
||||
- FinApplet (= 2.1.23)
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `.symlinks/flutter/ios-release`)
|
||||
- Flutter (from `.symlinks/flutter/ios`)
|
||||
- mop (from `.symlinks/plugins/mop/ios`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/CocoaPods/Specs.git:
|
||||
https://git.finogeeks.club/finoapp-ios/FinPods:
|
||||
- FinApplet
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: ".symlinks/flutter/ios-release"
|
||||
:path: ".symlinks/flutter/ios"
|
||||
mop:
|
||||
:path: ".symlinks/plugins/mop/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
FinApplet: adb43373a01ff90832969b1534d40c08344063f6
|
||||
FinApplet: 07bc56d96ae61b2be792d018ad6e5ed552ab12a2
|
||||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||
mop: c0e0dfb65c6a482e47f0fffc9a6576d88e7636b5
|
||||
mop: 58cfcfae42ce2110fe981ed8ff65587d27855030
|
||||
|
||||
PODFILE CHECKSUM: b66559db98de00d11e349a06f9e603856ed75d6e
|
||||
PODFILE CHECKSUM: fa591ea0d89752dd0191ae3f82c83db034678e82
|
||||
|
||||
COCOAPODS: 1.9.1
|
||||
|
|
|
@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property(nonatomic,copy)NSString* secret;
|
||||
@property(nonatomic,copy)NSString* apiServer;
|
||||
@property(nonatomic,copy)NSString* apiPrefix;
|
||||
@property(nonatomic,copy)NSString* cryptType;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -25,6 +25,14 @@
|
|||
FATConfig *config = [FATConfig configWithAppSecret:self.secret appKey:self.appkey];
|
||||
config.apiServer = [self.apiServer copy];
|
||||
config.apiPrefix = [self.apiPrefix copy];
|
||||
if([self.cryptType isEqualToString: @"SM"])
|
||||
{
|
||||
config.cryptType = FATApiCryptTypeSM;
|
||||
}
|
||||
else
|
||||
{
|
||||
config.cryptType = FATApiCryptTypeMD5;
|
||||
}
|
||||
NSError* error = nil;
|
||||
[[FATClient sharedClient] initWithConfig:config error:&error];
|
||||
if (error) {
|
||||
|
|
|
@ -66,15 +66,17 @@ class Mop {
|
|||
/// [secret] is required. it can be getted from mp.finogeeks.com
|
||||
/// [apiServer] is optional. the mop server address. default is https://mp.finogeek.com
|
||||
/// [apiPrefix] is optional. the mop server prefix. default is /api/v1/mop
|
||||
/// [cryptType] is optional. cryptType, should be MD5/SM
|
||||
///
|
||||
///
|
||||
Future<Map> initialize(String appkey, String secret,
|
||||
{String apiServer, String apiPrefix}) async {
|
||||
{String apiServer, String apiPrefix, String cryptType}) async {
|
||||
final Map ret = await _channel.invokeMethod('initialize', {
|
||||
'appkey': appkey,
|
||||
'secret': secret,
|
||||
'apiServer': apiServer,
|
||||
'apiPrefix': apiPrefix
|
||||
'apiPrefix': apiPrefix,
|
||||
'cryptType': cryptType
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue