From 6fe2ed0cec68dc4a9695a7fcbd0d5d15d33b1358 Mon Sep 17 00:00:00 2001 From: wanghualei Date: Sat, 19 Jun 2021 13:39:56 +0800 Subject: [PATCH] =?UTF-8?q?update=20init=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mop.dart | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/mop.dart b/lib/mop.dart index 0b30f08..30fbd31 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -9,6 +9,19 @@ typedef MopEventErrorCallback = void Function(dynamic event); typedef ExtensionApiHandler = Future Function(dynamic params); +class ServerConfig { + String appkey; + String secret; + String apiServer; + String apiPrefix; + String cryptType; + + ServerConfig(this.appkey, this.secret, this.apiServer, this.apiPrefix, this.cryptType); + + Map toJson() => + {'appkey': appkey, 'secret': secret, 'apiServer': apiServer, 'apiPrefix': apiPrefix, 'cryptType':cryptType}; +} + class Mop { static final Mop _instance = new Mop._internal(); MethodChannel _channel; @@ -74,7 +87,8 @@ class Mop { String apiPrefix, String cryptType, bool disablePermission, - String userId}) async { + String userId, + List serverConfigs}) async { final Map ret = await _channel.invokeMethod('initialize', { 'appkey': appkey, 'secret': secret, @@ -82,7 +96,8 @@ class Mop { 'apiPrefix': apiPrefix, 'cryptType': cryptType, 'disablePermission': disablePermission, - 'userId': userId + 'userId': userId, + 'serverConfigs',serverConfigs.map((e) => e.toJson()) }); return ret; }