From 0cc86db64d41e6b1f721cebb09e46d220786fabe Mon Sep 17 00:00:00 2001 From: kangxuyao Date: Tue, 19 May 2020 16:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9B=BD=E5=AF=86=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/finogeeks/mop/api/mop/BaseModule.java | 8 +++++++- example/ios/Podfile | 2 ++ example/ios/Podfile.lock | 16 ++++++++-------- ios/Classes/Api/MOP_initialize.h | 1 + ios/Classes/Api/MOP_initialize.m | 8 ++++++++ lib/mop.dart | 6 ++++-- 6 files changed, 30 insertions(+), 11 deletions(-) diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java index 6803319..08b326b 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java @@ -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 cb = new FinCallback() { diff --git a/example/ios/Podfile b/example/ios/Podfile index f4824c8..b62db64 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -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. diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 554cb53..4c17a8b 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -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 diff --git a/ios/Classes/Api/MOP_initialize.h b/ios/Classes/Api/MOP_initialize.h index 66850c3..4738795 100644 --- a/ios/Classes/Api/MOP_initialize.h +++ b/ios/Classes/Api/MOP_initialize.h @@ -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 diff --git a/ios/Classes/Api/MOP_initialize.m b/ios/Classes/Api/MOP_initialize.m index ff785e5..a7610b2 100644 --- a/ios/Classes/Api/MOP_initialize.m +++ b/ios/Classes/Api/MOP_initialize.m @@ -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) { diff --git a/lib/mop.dart b/lib/mop.dart index cdb0821..d27cb5a 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -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 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; }