diff --git a/CHANGELOG.md b/CHANGELOG.md index bebfefc..95ccdd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +## 0.5.0 ## 0.4.0 支持小程序最新依赖 ## 0.3.0 diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java index c2d099e..aa3d195 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java @@ -1,6 +1,7 @@ package com.finogeeks.mop.api.mop; import android.content.Context; +import android.util.Log; import com.finogeeks.lib.applet.client.FinAppClient; import com.finogeeks.mop.api.BaseApi; @@ -12,6 +13,7 @@ import java.util.Map; public class AppletModule extends BaseApi { private final static String TAG = AppletModule.class.getSimpleName(); private Context mContext; + public AppletModule(Context context) { super(context); mContext = context; @@ -22,6 +24,7 @@ public class AppletModule extends BaseApi { super.onCreate(); } + @Override public String[] apis() { return new String[]{"openApplet"}; @@ -30,17 +33,22 @@ public class AppletModule extends BaseApi { @Override public void invoke(String event, Map param, ICallback callback) { if (param.get("appId") == null) { - callback.onFail(new HashMap(){ + callback.onFail(new HashMap() { { - put("info","appId不能为空"); + put("info", "appId不能为空"); } }); return; } String appId = String.valueOf(param.get("appId")); - Map params = (Map)param.get("params"); + Integer sequence = (Integer) param.get("sequence"); + Map params = (Map) param.get("params"); 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 { FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, params); } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index ebd698c..83a574e 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -6,7 +6,7 @@ PODS: - Flutter DEPENDENCIES: - - Flutter (from `.symlinks/flutter/ios`) + - Flutter (from `.symlinks/flutter/ios-release`) - mop (from `.symlinks/plugins/mop/ios`) SPEC REPOS: @@ -15,7 +15,7 @@ SPEC REPOS: EXTERNAL SOURCES: Flutter: - :path: ".symlinks/flutter/ios" + :path: ".symlinks/flutter/ios-release" mop: :path: ".symlinks/plugins/mop/ios" diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..6b30c74 --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + BuildSystemType + Original + PreviewsEnabled + + + diff --git a/example/lib/main.dart b/example/lib/main.dart index 57afd6e..f0e3ed8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -82,7 +82,7 @@ class _MyAppState extends State { ), child: FlatButton( onPressed: () { - Mop.instance.openApplet('5e4d123647edd60001055df1'); + Mop.instance.openApplet('5e4d123647edd60001055df1',sequence: 1); }, child: Text( '打开官方小程序', diff --git a/example/pubspec.lock b/example/pubspec.lock index b178704..3014d7a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,63 +5,63 @@ packages: dependency: transitive description: name: archive - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.2" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.14.11" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.3" flutter: @@ -78,21 +78,21 @@ packages: dependency: transitive description: name: image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.6" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.8" mop: @@ -101,33 +101,33 @@ packages: path: ".." relative: true source: path - version: "0.3.0" + version: "0.4.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.6.4" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0+1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.5" sky_engine: @@ -139,63 +139,63 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.5" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.9.3" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.11" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.8" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.5.0" sdks: diff --git a/ios/Classes/Api/MOP_openApplet.h b/ios/Classes/Api/MOP_openApplet.h index a7fe0a3..a08f479 100644 --- a/ios/Classes/Api/MOP_openApplet.h +++ b/ios/Classes/Api/MOP_openApplet.h @@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MOP_openApplet : MOPBaseApi @property(nonatomic,copy)NSString* appId; +@property(nonatomic,copy)NSNumber* sequence; @property(nonatomic,copy)NSDictionary* params; @end diff --git a/ios/Classes/Api/MOP_openApplet.m b/ios/Classes/Api/MOP_openApplet.m index dd2ec83..3bf7da8 100644 --- a/ios/Classes/Api/MOP_openApplet.m +++ b/ios/Classes/Api/MOP_openApplet.m @@ -16,6 +16,7 @@ UIViewController *currentVC = [MOPTools topViewController]; // 打开小程序 + if (self.sequence == nil) { [[FATClient sharedClient] startRemoteApplet:self.appId startParams:self.params InParentViewController:currentVC completion:^(BOOL result, NSError *error) { NSLog(@"result:%d---error:%@", result, error); if (result){ @@ -24,5 +25,15 @@ 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 diff --git a/lib/mop.dart b/lib/mop.dart index b32f247..e33c5df 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -11,9 +11,11 @@ class Mop { EventChannel _mopEventChannel; int eventId = 0; List> _mopEventQueye = >[]; + factory Mop() { return _instance; } + Mop._internal() { print('mop: _internal'); // init @@ -30,6 +32,7 @@ class Mop { // failure(value); }); } + static Mop get instance => _instance; Future get platformVersion async { @@ -68,7 +71,7 @@ class Mop { /// /// Future openApplet(final String appId, - {final String path, final String query}) async { + {final String path, final String query, final int sequence}) async { Map params; if (path != '') { params = { @@ -78,6 +81,7 @@ class Mop { } else { params = {'appId': appId}; } + if (sequence != null) params["sequence"] = sequence; final Map ret = await _channel.invokeMethod('openApplet', params); return ret; } diff --git a/pubspec.lock b/pubspec.lock index 67a7df1..c57bb09 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,56 +5,56 @@ packages: dependency: transitive description: name: archive - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.2" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.14.11" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" flutter: @@ -71,49 +71,49 @@ packages: dependency: transitive description: name: image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.6" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.8" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.6.4" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0+1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.5" sky_engine: @@ -125,63 +125,63 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.5" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.9.3" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.11" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.8" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.5.0" sdks: diff --git a/pubspec.yaml b/pubspec.yaml index 6610496..2286e24 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: mop description: A Finogeeks MiniProgram Flutter SDK. -version: 0.4.0 +version: 0.5.0 authors: - finogeeks - kang34814