Merge branch 'master' of github.com:finogeeks/mop-flutter-sdk

master
developer 2020-04-01 15:19:43 +08:00
commit e594a959db
12 changed files with 102 additions and 59 deletions

View File

@ -1,3 +1,4 @@
## 0.5.0
## 0.4.0 ## 0.4.0
## 0.3.0 ## 0.3.0

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 com.finogeeks.lib.applet.client.FinAppClient; import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.mop.api.BaseApi; import com.finogeeks.mop.api.BaseApi;
@ -12,6 +13,7 @@ import java.util.Map;
public class AppletModule extends BaseApi { public class AppletModule extends BaseApi {
private final static String TAG = AppletModule.class.getSimpleName(); private final static String TAG = AppletModule.class.getSimpleName();
private Context mContext; private Context mContext;
public AppletModule(Context context) { public AppletModule(Context context) {
super(context); super(context);
mContext = context; mContext = context;
@ -22,6 +24,7 @@ public class AppletModule extends BaseApi {
super.onCreate(); super.onCreate();
} }
@Override @Override
public String[] apis() { public String[] apis() {
return new String[]{"openApplet"}; return new String[]{"openApplet"};
@ -30,17 +33,22 @@ public class AppletModule extends BaseApi {
@Override @Override
public void invoke(String event, Map param, ICallback callback) { public void invoke(String event, Map param, ICallback callback) {
if (param.get("appId") == null) { if (param.get("appId") == null) {
callback.onFail(new HashMap(){ callback.onFail(new HashMap() {
{ {
put("info","appId不能为空"); put("info", "appId不能为空");
} }
}); });
return; return;
} }
String appId = String.valueOf(param.get("appId")); String appId = String.valueOf(param.get("appId"));
Map<String,String> params = (Map)param.get("params"); Integer sequence = (Integer) param.get("sequence");
Map<String, String> params = (Map) param.get("params");
if (params == null) { if (params == null) {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId); if (sequence == null) {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId);
} else {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, sequence, null);
}
} else { } else {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, params); FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, params);
} }

View File

@ -6,7 +6,7 @@ PODS:
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios`) - Flutter (from `.symlinks/flutter/ios-release`)
- mop (from `.symlinks/plugins/mop/ios`) - mop (from `.symlinks/plugins/mop/ios`)
SPEC REPOS: SPEC REPOS:
@ -15,7 +15,7 @@ SPEC REPOS:
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: ".symlinks/flutter/ios" :path: ".symlinks/flutter/ios-release"
mop: mop:
:path: ".symlinks/plugins/mop/ios" :path: ".symlinks/plugins/mop/ios"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -82,7 +82,7 @@ class _MyAppState extends State<MyApp> {
), ),
child: FlatButton( child: FlatButton(
onPressed: () { onPressed: () {
Mop.instance.openApplet('5e4d123647edd60001055df1'); Mop.instance.openApplet('5e4d123647edd60001055df1',sequence: 1);
}, },
child: Text( child: Text(
'打开官方小程序', '打开官方小程序',

View File

@ -5,63 +5,63 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.11" version: "2.0.11"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.2" version: "1.5.2"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.2" version: "1.1.2"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.14.11" version: "1.14.11"
convert: convert:
dependency: transitive dependency: transitive
description: description:
name: convert name: convert
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
flutter: flutter:
@ -78,21 +78,21 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.6" version: "0.12.6"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.8" version: "1.1.8"
mop: mop:
@ -101,33 +101,33 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "0.3.0" version: "0.4.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.6.4" version: "1.6.4"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0+1" version: "1.8.0+1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.5" version: "2.0.5"
sky_engine: sky_engine:
@ -139,63 +139,63 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.5" version: "1.5.5"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.9.3" version: "1.9.3"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.11" version: "0.2.11"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
xml: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.5.0" version: "3.5.0"
sdks: sdks:

View File

@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface MOP_openApplet : MOPBaseApi @interface MOP_openApplet : MOPBaseApi
@property(nonatomic,copy)NSString* appId; @property(nonatomic,copy)NSString* appId;
@property(nonatomic,copy)NSNumber* sequence;
@property(nonatomic,copy)NSDictionary* params; @property(nonatomic,copy)NSDictionary* params;
@end @end

View File

@ -16,6 +16,7 @@
UIViewController *currentVC = [MOPTools topViewController]; UIViewController *currentVC = [MOPTools topViewController];
// //
if (self.sequence == nil) {
[[FATClient sharedClient] startRemoteApplet:self.appId startParams:self.params InParentViewController:currentVC completion:^(BOOL result, NSError *error) { [[FATClient sharedClient] startRemoteApplet:self.appId startParams:self.params InParentViewController:currentVC completion:^(BOOL result, NSError *error) {
NSLog(@"result:%d---error:%@", result, error); NSLog(@"result:%d---error:%@", result, error);
if (result){ if (result){
@ -24,5 +25,15 @@
failure(error.description); failure(error.description);
} }
}]; }];
}else{
[[FATClient sharedClient] startRemoteApplet:self.appId sequence:self.sequence startParams:self.params InParentViewController:currentVC transitionStyle:FATTranstionStylePush completion:^(BOOL result, NSError *error) {
NSLog(@"result:%d---error:%@", result, error);
if (result){
success(@{});
}else {
failure(error.description);
}
}];
}
} }
@end @end

View File

@ -11,9 +11,11 @@ class Mop {
EventChannel _mopEventChannel; EventChannel _mopEventChannel;
int eventId = 0; int eventId = 0;
List<Map<String, dynamic>> _mopEventQueye = <Map<String, dynamic>>[]; List<Map<String, dynamic>> _mopEventQueye = <Map<String, dynamic>>[];
factory Mop() { factory Mop() {
return _instance; return _instance;
} }
Mop._internal() { Mop._internal() {
print('mop: _internal'); print('mop: _internal');
// init // init
@ -30,6 +32,7 @@ class Mop {
// failure(value); // failure(value);
}); });
} }
static Mop get instance => _instance; static Mop get instance => _instance;
Future<String> get platformVersion async { Future<String> get platformVersion async {
@ -68,7 +71,7 @@ class Mop {
/// ///
/// ///
Future<Map> openApplet(final String appId, Future<Map> openApplet(final String appId,
{final String path, final String query}) async { {final String path, final String query, final int sequence}) async {
Map<String, Object> params; Map<String, Object> params;
if (path != '') { if (path != '') {
params = { params = {
@ -78,6 +81,7 @@ class Mop {
} else { } else {
params = {'appId': appId}; params = {'appId': appId};
} }
if (sequence != null) params["sequence"] = sequence;
final Map ret = await _channel.invokeMethod('openApplet', params); final Map ret = await _channel.invokeMethod('openApplet', params);
return ret; return ret;
} }

View File

@ -5,56 +5,56 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.11" version: "2.0.11"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.2" version: "1.5.2"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.2" version: "1.1.2"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.14.11" version: "1.14.11"
convert: convert:
dependency: transitive dependency: transitive
description: description:
name: convert name: convert
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
flutter: flutter:
@ -71,49 +71,49 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.6" version: "0.12.6"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.8" version: "1.1.8"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.6.4" version: "1.6.4"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0+1" version: "1.8.0+1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.5" version: "2.0.5"
sky_engine: sky_engine:
@ -125,63 +125,63 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.5" version: "1.5.5"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.9.3" version: "1.9.3"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.11" version: "0.2.11"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
xml: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.5.0" version: "3.5.0"
sdks: sdks:

View File

@ -1,6 +1,6 @@
name: mop name: mop
description: A Finogeeks MiniProgram Flutter SDK. description: A Finogeeks MiniProgram Flutter SDK.
version: 0.4.0 version: 0.5.0
authors: authors:
- finogeeks <finogeeks.mop@gmail.com> - finogeeks <finogeeks.mop@gmail.com>
- kang34814 <kang34814@gmail.com> - kang34814 <kang34814@gmail.com>