增加国密配置

master
kangxuyao 2020-05-19 16:42:10 +08:00
parent 01be3d6e8a
commit 0cc86db64d
6 changed files with 30 additions and 11 deletions

View File

@ -1,6 +1,7 @@
package com.finogeeks.mop.api.mop; package com.finogeeks.mop.api.mop;
import android.content.Context; import android.content.Context;
import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.finogeeks.lib.applet.client.FinAppClient; import com.finogeeks.lib.applet.client.FinAppClient;
@ -25,6 +26,7 @@ public class BaseModule extends BaseApi {
super.onCreate(); super.onCreate();
} }
@Override @Override
public String[] apis() { public String[] apis() {
return new String[]{"initialize"}; return new String[]{"initialize"};
@ -41,6 +43,10 @@ public class BaseModule extends BaseApi {
String secret = String.valueOf(param.get("secret")); String secret = String.valueOf(param.get("secret"));
String apiServer = "https://mp.finogeeks.com"; String apiServer = "https://mp.finogeeks.com";
String apiPrefix = "/api/v1/mop/"; String apiPrefix = "/api/v1/mop/";
String cryptType = (String) param.get("cryptType");
if (cryptType == null || cryptType.isEmpty()) {
cryptType = "MD5";
}
if (param.get("apiServer") != null) { if (param.get("apiServer") != null) {
apiServer = String.valueOf(param.get("apiServer")); apiServer = String.valueOf(param.get("apiServer"));
} }
@ -56,7 +62,7 @@ public class BaseModule extends BaseApi {
.setApiUrl(apiServer) .setApiUrl(apiServer)
.setApiPrefix(apiPrefix) .setApiPrefix(apiPrefix)
.setGlideWithJWT(false) .setGlideWithJWT(false)
.setEncryptionType("SM") .setEncryptionType(cryptType)
.build(); .build();
// SDKSDK // SDKSDK
FinCallback<Object> cb = new FinCallback<Object>() { FinCallback<Object> cb = new FinCallback<Object>() {

View File

@ -1,5 +1,7 @@
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' # platform :ios, '9.0'
source 'https://git.finogeeks.club/finoapp-ios/FinPods'
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.

View File

@ -1,29 +1,29 @@
PODS: PODS:
- FinApplet (2.1.5) - FinApplet (2.1.23)
- Flutter (1.0.0) - Flutter (1.0.0)
- mop (0.1.0): - mop (0.1.0):
- FinApplet (= 2.1.5) - FinApplet (= 2.1.23)
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios-release`) - Flutter (from `.symlinks/flutter/ios`)
- mop (from `.symlinks/plugins/mop/ios`) - mop (from `.symlinks/plugins/mop/ios`)
SPEC REPOS: SPEC REPOS:
https://github.com/CocoaPods/Specs.git: https://git.finogeeks.club/finoapp-ios/FinPods:
- FinApplet - FinApplet
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: ".symlinks/flutter/ios-release" :path: ".symlinks/flutter/ios"
mop: mop:
:path: ".symlinks/plugins/mop/ios" :path: ".symlinks/plugins/mop/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
FinApplet: adb43373a01ff90832969b1534d40c08344063f6 FinApplet: 07bc56d96ae61b2be792d018ad6e5ed552ab12a2
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
mop: c0e0dfb65c6a482e47f0fffc9a6576d88e7636b5 mop: 58cfcfae42ce2110fe981ed8ff65587d27855030
PODFILE CHECKSUM: b66559db98de00d11e349a06f9e603856ed75d6e PODFILE CHECKSUM: fa591ea0d89752dd0191ae3f82c83db034678e82
COCOAPODS: 1.9.1 COCOAPODS: 1.9.1

View File

@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic,copy)NSString* secret; @property(nonatomic,copy)NSString* secret;
@property(nonatomic,copy)NSString* apiServer; @property(nonatomic,copy)NSString* apiServer;
@property(nonatomic,copy)NSString* apiPrefix; @property(nonatomic,copy)NSString* apiPrefix;
@property(nonatomic,copy)NSString* cryptType;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -25,6 +25,14 @@
FATConfig *config = [FATConfig configWithAppSecret:self.secret appKey:self.appkey]; FATConfig *config = [FATConfig configWithAppSecret:self.secret appKey:self.appkey];
config.apiServer = [self.apiServer copy]; config.apiServer = [self.apiServer copy];
config.apiPrefix = [self.apiPrefix copy]; config.apiPrefix = [self.apiPrefix copy];
if([self.cryptType isEqualToString: @"SM"])
{
config.cryptType = FATApiCryptTypeSM;
}
else
{
config.cryptType = FATApiCryptTypeMD5;
}
NSError* error = nil; NSError* error = nil;
[[FATClient sharedClient] initWithConfig:config error:&error]; [[FATClient sharedClient] initWithConfig:config error:&error];
if (error) { if (error) {

View File

@ -66,15 +66,17 @@ class Mop {
/// [secret] is required. it can be getted from mp.finogeeks.com /// [secret] is required. it can be getted from mp.finogeeks.com
/// [apiServer] is optional. the mop server address. default is https://mp.finogeek.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 /// [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, 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', { final Map ret = await _channel.invokeMethod('initialize', {
'appkey': appkey, 'appkey': appkey,
'secret': secret, 'secret': secret,
'apiServer': apiServer, 'apiServer': apiServer,
'apiPrefix': apiPrefix 'apiPrefix': apiPrefix,
'cryptType': cryptType
}); });
return ret; return ret;
} }