From 0961cb9fc9fda704291d08d90286fd5b39540ee5 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 17 Feb 2020 21:23:02 +0800 Subject: [PATCH] refact:change field name from scheme to source --- .../java/pub/doric/demo/MainActivity.java | 2 +- .../main/java/pub/doric/DoricActivity.java | 6 +++--- .../main/java/pub/doric/DoricFragment.java | 4 ++-- .../java/pub/doric/DoricPanelFragment.java | 8 ++++---- .../pub/doric/loader/DoricAssetJSLoader.java | 8 ++++---- .../pub/doric/loader/DoricHttpJSLoader.java | 8 ++++---- .../doric/loader/DoricJSLoaderManager.java | 6 +++--- .../java/pub/doric/loader/IDoricJSLoader.java | 4 ++-- .../pub/doric/navigator/IDoricNavigator.java | 2 +- .../pub/doric/plugin/NavigatorPlugin.java | 6 +++--- .../java/pub/doric/example/MainActivity.java | 4 ++-- doric-cli/target/iOS/Example/AppDelegate.m | 2 +- doric-cli/target/iOS/Example/SceneDelegate.m | 2 +- doric-iOS/Example/Example/ViewController.m | 2 +- doric-iOS/Pod/Classes/DoricViewController.h | 2 +- doric-iOS/Pod/Classes/DoricViewController.m | 12 ++++++------ .../Pod/Classes/Loader/DoricHttpJSLoader.m | 8 ++++---- .../Pod/Classes/Loader/DoricJSLoaderManager.h | 2 +- .../Pod/Classes/Loader/DoricJSLoaderManager.m | 6 +++--- .../Pod/Classes/Loader/DoricLoaderProtocol.h | 4 ++-- .../Classes/Loader/DoricMainBundleJSLoader.m | 8 ++++---- .../Navigator/DoricNavigatorDelegate.h | 2 +- .../Pod/Classes/Plugin/DoricNavigatorPlugin.m | 6 +++--- doric-iOS/Pod/Classes/Shader/DoricLayouts.m | 19 ------------------- doric-js/bundle/doric-lib.es5.js | 4 ++-- doric-js/bundle/doric-lib.js | 4 ++-- doric-js/bundle/doric-vm.js | 4 ++-- doric-js/index.d.ts | 2 +- doric-js/lib/src/native/navigator.d.ts | 2 +- doric-js/lib/src/native/navigator.js | 4 ++-- doric-js/src/native/navigator.ts | 4 ++-- doric-web/src/navigate/NavigatorPlugin.ts | 6 +++--- 32 files changed, 72 insertions(+), 91 deletions(-) diff --git a/doric-android/app/src/main/java/pub/doric/demo/MainActivity.java b/doric-android/app/src/main/java/pub/doric/demo/MainActivity.java index 52051d9d..21700265 100644 --- a/doric-android/app/src/main/java/pub/doric/demo/MainActivity.java +++ b/doric-android/app/src/main/java/pub/doric/demo/MainActivity.java @@ -106,7 +106,7 @@ public class MainActivity extends AppCompatActivity { @Override public void onClick(View v) { Intent intent = new Intent(tv.getContext(), DemoDebugActivity.class); - intent.putExtra("scheme", "assets://src/" + data[position]); + intent.putExtra("source", "assets://src/" + data[position]); intent.putExtra("alias", data[position]); tv.getContext().startActivity(intent); } diff --git a/doric-android/doric/src/main/java/pub/doric/DoricActivity.java b/doric-android/doric/src/main/java/pub/doric/DoricActivity.java index 80d22371..9611bf45 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricActivity.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricActivity.java @@ -33,7 +33,7 @@ public class DoricActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.doric_activity); if (savedInstanceState == null) { - mDoricFragment = DoricFragment.newInstance(getScheme(), getAlias(), getExtra()); + mDoricFragment = DoricFragment.newInstance(getSource(), getAlias(), getExtra()); getSupportFragmentManager().beginTransaction() .add(R.id.container, mDoricFragment) .commit(); @@ -43,8 +43,8 @@ public class DoricActivity extends AppCompatActivity { /** * @return Scheme for DoricFragment to load. */ - protected String getScheme() { - return getIntent().getStringExtra("scheme"); + protected String getSource() { + return getIntent().getStringExtra("source"); } /** diff --git a/doric-android/doric/src/main/java/pub/doric/DoricFragment.java b/doric-android/doric/src/main/java/pub/doric/DoricFragment.java index 1c84c02e..e24c9c03 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricFragment.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricFragment.java @@ -35,9 +35,9 @@ import androidx.navigation.Navigation; */ public class DoricFragment extends Fragment { - public static DoricFragment newInstance(String scheme, String alias, String extra) { + public static DoricFragment newInstance(String source, String alias, String extra) { Bundle args = new Bundle(); - args.putString("scheme", scheme); + args.putString("source", source); args.putString("alias", alias); args.putString("extra", extra); DoricFragment fragment = new DoricFragment(); diff --git a/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java b/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java index 676eb6b4..03a44986 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java @@ -72,9 +72,9 @@ public class DoricPanelFragment extends Fragment implements IDoricNavigator { } @Override - public void push(String scheme, String alias, String extra) { + public void push(String source, String alias, String extra) { Bundle argument = new Bundle(); - argument.putString("scheme", scheme); + argument.putString("source", source); argument.putString("alias", alias); argument.putString("extra", extra); getNavController() @@ -170,9 +170,9 @@ public class DoricPanelFragment extends Fragment implements IDoricNavigator { } showLoading(); final String alias = argument.getString("alias"); - String scheme = argument.getString("scheme"); + String source = argument.getString("source"); final String extra = argument.getString("extra"); - DoricJSLoaderManager.getInstance().loadJSBundle(scheme).setCallback(new AsyncResult.Callback() { + DoricJSLoaderManager.getInstance().loadJSBundle(source).setCallback(new AsyncResult.Callback() { @Override public void onResult(String result) { doricPanel.config(result, alias, extra); diff --git a/doric-android/doric/src/main/java/pub/doric/loader/DoricAssetJSLoader.java b/doric-android/doric/src/main/java/pub/doric/loader/DoricAssetJSLoader.java index e5dcf844..371db003 100644 --- a/doric-android/doric/src/main/java/pub/doric/loader/DoricAssetJSLoader.java +++ b/doric-android/doric/src/main/java/pub/doric/loader/DoricAssetJSLoader.java @@ -30,14 +30,14 @@ import pub.doric.async.AsyncResult; */ public class DoricAssetJSLoader implements IDoricJSLoader { @Override - public boolean filter(String scheme) { - return scheme.startsWith("assets"); + public boolean filter(String source) { + return source.startsWith("assets"); } @Override - public AsyncResult request(String scheme) { + public AsyncResult request(String source) { AsyncResult result = new AsyncResult<>(); - String assetPath = scheme.substring("assets://".length()); + String assetPath = source.substring("assets://".length()); InputStream inputStream = null; try { AssetManager assetManager = Doric.application().getAssets(); diff --git a/doric-android/doric/src/main/java/pub/doric/loader/DoricHttpJSLoader.java b/doric-android/doric/src/main/java/pub/doric/loader/DoricHttpJSLoader.java index 293320ad..13decfed 100644 --- a/doric-android/doric/src/main/java/pub/doric/loader/DoricHttpJSLoader.java +++ b/doric-android/doric/src/main/java/pub/doric/loader/DoricHttpJSLoader.java @@ -35,14 +35,14 @@ public class DoricHttpJSLoader implements IDoricJSLoader { private OkHttpClient okHttpClient = new OkHttpClient(); @Override - public boolean filter(String scheme) { - return scheme.startsWith("http"); + public boolean filter(String source) { + return source.startsWith("http"); } @Override - public AsyncResult request(String scheme) { + public AsyncResult request(String source) { final AsyncResult ret = new AsyncResult<>(); - okHttpClient.newCall(new Request.Builder().url(scheme).build()).enqueue(new Callback() { + okHttpClient.newCall(new Request.Builder().url(source).build()).enqueue(new Callback() { @Override public void onFailure(@NonNull Call call, @NonNull IOException e) { ret.setError(e); diff --git a/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java b/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java index 9c1522d1..6a1d3f4c 100644 --- a/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java +++ b/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java @@ -52,11 +52,11 @@ public class DoricJSLoaderManager { return Inner.sInstance; } - public AsyncResult loadJSBundle(String scheme) { + public AsyncResult loadJSBundle(String source) { Collection jsLoaders = getJSLoaders(); for (IDoricJSLoader jsLoader : jsLoaders) { - if (jsLoader.filter(scheme)) { - return jsLoader.request(scheme); + if (jsLoader.filter(source)) { + return jsLoader.request(source); } } return new AsyncResult<>(""); diff --git a/doric-android/doric/src/main/java/pub/doric/loader/IDoricJSLoader.java b/doric-android/doric/src/main/java/pub/doric/loader/IDoricJSLoader.java index c26f453f..a3d870de 100644 --- a/doric-android/doric/src/main/java/pub/doric/loader/IDoricJSLoader.java +++ b/doric-android/doric/src/main/java/pub/doric/loader/IDoricJSLoader.java @@ -23,7 +23,7 @@ import pub.doric.async.AsyncResult; * @CreateDate: 2019-11-23 */ public interface IDoricJSLoader { - boolean filter(String scheme); + boolean filter(String source); - AsyncResult request(String scheme); + AsyncResult request(String source); } diff --git a/doric-android/doric/src/main/java/pub/doric/navigator/IDoricNavigator.java b/doric-android/doric/src/main/java/pub/doric/navigator/IDoricNavigator.java index a89c6e99..ef5ee25e 100644 --- a/doric-android/doric/src/main/java/pub/doric/navigator/IDoricNavigator.java +++ b/doric-android/doric/src/main/java/pub/doric/navigator/IDoricNavigator.java @@ -21,7 +21,7 @@ package pub.doric.navigator; * @CreateDate: 2019-11-23 */ public interface IDoricNavigator { - void push(String scheme, String alias, String extra); + void push(String source, String alias, String extra); void pop(); } diff --git a/doric-android/doric/src/main/java/pub/doric/plugin/NavigatorPlugin.java b/doric-android/doric/src/main/java/pub/doric/plugin/NavigatorPlugin.java index cb28c162..3ea06317 100644 --- a/doric-android/doric/src/main/java/pub/doric/plugin/NavigatorPlugin.java +++ b/doric-android/doric/src/main/java/pub/doric/plugin/NavigatorPlugin.java @@ -46,8 +46,8 @@ public class NavigatorPlugin extends DoricJavaPlugin { if (navigator != null) { try { JSObject jsObject = jsDecoder.decode().asObject(); - String scheme = jsObject.getProperty("scheme").asString().value(); - String alias = scheme; + String source = jsObject.getProperty("source").asString().value(); + String alias = source; String extra = ""; JSValue config = jsObject.getProperty("config"); if (config.isObject()) { @@ -60,7 +60,7 @@ public class NavigatorPlugin extends DoricJavaPlugin { extra = extraJS.asString().value(); } } - navigator.push(jsObject.getProperty("scheme").asString().value(), + navigator.push(jsObject.getProperty("source").asString().value(), alias, extra ); diff --git a/doric-cli/target/android/app/src/main/java/pub/doric/example/MainActivity.java b/doric-cli/target/android/app/src/main/java/pub/doric/example/MainActivity.java index 46bbe75a..2845d8b5 100644 --- a/doric-cli/target/android/app/src/main/java/pub/doric/example/MainActivity.java +++ b/doric-cli/target/android/app/src/main/java/pub/doric/example/MainActivity.java @@ -15,8 +15,8 @@ public class MainActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { - String scheme = "assets://src/" + BUNDLE_NAME + ".js"; - getIntent().putExtra("scheme", scheme); + String source = "assets://src/" + BUNDLE_NAME + ".js"; + getIntent().putExtra("source", scheme); getIntent().putExtra("alias", BUNDLE_NAME); this.getSupportFragmentManager().beginTransaction().add(R.id.root, new DoricFragment()).commit(); } diff --git a/doric-cli/target/iOS/Example/AppDelegate.m b/doric-cli/target/iOS/Example/AppDelegate.m index ef9da07b..6944e754 100644 --- a/doric-cli/target/iOS/Example/AppDelegate.m +++ b/doric-cli/target/iOS/Example/AppDelegate.m @@ -17,7 +17,7 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSString *bundleName = @"__$__"; - DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] + DoricViewController *doricViewController = [[DoricViewController alloc] initWithSource:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName extra:@""]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; diff --git a/doric-cli/target/iOS/Example/SceneDelegate.m b/doric-cli/target/iOS/Example/SceneDelegate.m index 57d201a6..9654750d 100644 --- a/doric-cli/target/iOS/Example/SceneDelegate.m +++ b/doric-cli/target/iOS/Example/SceneDelegate.m @@ -8,7 +8,7 @@ @implementation SceneDelegate - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { UIWindowScene *windowScene = (UIWindowScene *) scene; NSString *bundleName = @"__$__"; - DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] + DoricViewController *doricViewController = [[DoricViewController alloc] initWithSource:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName extra:@""]; doricViewController.view.backgroundColor = [UIColor whiteColor]; diff --git a/doric-iOS/Example/Example/ViewController.m b/doric-iOS/Example/Example/ViewController.m index 1116f9ed..fd047ef1 100644 --- a/doric-iOS/Example/Example/ViewController.m +++ b/doric-iOS/Example/Example/ViewController.m @@ -77,7 +77,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } NSString *file = self.demoFilePaths[(NSUInteger) indexPath.row]; DoricViewController *doricViewController = [[DoricViewController alloc] - initWithScheme:[NSString stringWithFormat:@"assets://src/%@", file] + initWithSource:[NSString stringWithFormat:@"assets://src/%@", file] alias:self.demoFilePaths[(NSUInteger) indexPath.row] extra:nil ]; diff --git a/doric-iOS/Pod/Classes/DoricViewController.h b/doric-iOS/Pod/Classes/DoricViewController.h index f7fa75ba..2efeea1f 100644 --- a/doric-iOS/Pod/Classes/DoricViewController.h +++ b/doric-iOS/Pod/Classes/DoricViewController.h @@ -32,5 +32,5 @@ extern NSString *const DORIC_MASK_RETRY; @property(nonatomic, strong) UIView *loadingView; @property(nonatomic, strong) UIView *errorView; -- (instancetype)initWithScheme:(NSString *)scheme alias:(NSString *)alias extra:(NSString *)extra; +- (instancetype)initWithSource:(NSString *)source alias:(NSString *)alias extra:(NSString *)extra; @end diff --git a/doric-iOS/Pod/Classes/DoricViewController.m b/doric-iOS/Pod/Classes/DoricViewController.m index d97549bf..3b7749ac 100644 --- a/doric-iOS/Pod/Classes/DoricViewController.m +++ b/doric-iOS/Pod/Classes/DoricViewController.m @@ -29,16 +29,16 @@ @interface DoricViewController () @property(nonatomic) BOOL navBarHidden; @property(nonatomic, strong) UIImage *navBarImage; @property(nonatomic, strong) UIView *maskView; -@property(nonatomic, copy) NSString *scheme; +@property(nonatomic, copy) NSString *source; @property(nonatomic, copy) NSString *alias; @property(nonatomic, copy) NSString *extra; @end @implementation DoricViewController -- (instancetype)initWithScheme:(NSString *)scheme alias:(NSString *)alias extra:(NSString *)extra { +- (instancetype)initWithSource:(NSString *)source alias:(NSString *)alias extra:(NSString *)extra { if (self = [super init]) { self.edgesForExtendedLayout = UIRectEdgeNone; - _scheme = scheme; + _source = source; _alias = alias; _extra = extra; _doricPanel = [DoricPanel new]; @@ -105,8 +105,8 @@ - (void)viewWillLayoutSubviews { self.doricPanel.view.height = self.view.height; } -- (void)doric_navigator_push:(NSString *)scheme alias:(NSString *)alias animated:(BOOL)animated extra:(NSString *)extra { - DoricViewController *viewController = [[DoricViewController alloc] initWithScheme:scheme alias:alias extra:extra]; +- (void)doric_navigator_push:(NSString *)source alias:(NSString *)alias animated:(BOOL)animated extra:(NSString *)extra { + DoricViewController *viewController = [[DoricViewController alloc] initWithSource:source alias:alias extra:extra]; [self.navigationController pushViewController:viewController animated:animated]; } @@ -180,7 +180,7 @@ - (void)hideMask { - (void)loadJSBundle { [self showLoading]; - DoricAsyncResult *result = [DoricJSLoaderManager.instance request:self.scheme]; + DoricAsyncResult *result = [DoricJSLoaderManager.instance request:self.source]; result.resultCallback = ^(NSString *result) { dispatch_async(dispatch_get_main_queue(), ^{ [self hideMask]; diff --git a/doric-iOS/Pod/Classes/Loader/DoricHttpJSLoader.m b/doric-iOS/Pod/Classes/Loader/DoricHttpJSLoader.m index d9bd6a2c..cdead746 100644 --- a/doric-iOS/Pod/Classes/Loader/DoricHttpJSLoader.m +++ b/doric-iOS/Pod/Classes/Loader/DoricHttpJSLoader.m @@ -22,13 +22,13 @@ @implementation DoricHttpJSLoader -- (BOOL)filter:(NSString *)scheme { - return [scheme hasPrefix:@"http"]; +- (BOOL)filter:(NSString *)source { + return [source hasPrefix:@"http"]; } -- (DoricAsyncResult *)request:(NSString *)scheme { +- (DoricAsyncResult *)request:(NSString *)source { DoricAsyncResult *ret = [DoricAsyncResult new]; - NSURL *URL = [NSURL URLWithString:scheme]; + NSURL *URL = [NSURL URLWithString:source]; NSURLRequest *request = [NSURLRequest requestWithURL:URL]; [[[NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]] dataTaskWithRequest:request diff --git a/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.h b/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.h index efbf2846..575acb94 100644 --- a/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.h +++ b/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.h @@ -29,5 +29,5 @@ - (void)addJSLoader:(id )loader; -- (DoricAsyncResult *)request:(NSString *)scheme; +- (DoricAsyncResult *)request:(NSString *)source; @end diff --git a/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m b/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m index 41cf0fc5..111a81a8 100644 --- a/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m +++ b/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m @@ -55,11 +55,11 @@ - (void)addJSLoader:(id )loader { }]; } -- (DoricAsyncResult *)request:(NSString *)scheme { +- (DoricAsyncResult *)request:(NSString *)source { __block DoricAsyncResult *ret; [self.loaders enumerateObjectsUsingBlock:^(id obj, BOOL *stop) { - if ([obj filter:scheme]) { - ret = [obj request:scheme]; + if ([obj filter:source]) { + ret = [obj request:source]; *stop = YES; } }]; diff --git a/doric-iOS/Pod/Classes/Loader/DoricLoaderProtocol.h b/doric-iOS/Pod/Classes/Loader/DoricLoaderProtocol.h index b3b509f0..6b742dda 100644 --- a/doric-iOS/Pod/Classes/Loader/DoricLoaderProtocol.h +++ b/doric-iOS/Pod/Classes/Loader/DoricLoaderProtocol.h @@ -21,7 +21,7 @@ #import "DoricAsyncResult.h" @protocol DoricLoaderProtocol -- (BOOL)filter:(NSString *)scheme; +- (BOOL)filter:(NSString *)source; -- (DoricAsyncResult *)request:(NSString *)scheme; +- (DoricAsyncResult *)request:(NSString *)source; @end \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Loader/DoricMainBundleJSLoader.m b/doric-iOS/Pod/Classes/Loader/DoricMainBundleJSLoader.m index 63663098..6a6da103 100644 --- a/doric-iOS/Pod/Classes/Loader/DoricMainBundleJSLoader.m +++ b/doric-iOS/Pod/Classes/Loader/DoricMainBundleJSLoader.m @@ -21,14 +21,14 @@ @implementation DoricMainBundleJSLoader -- (BOOL)filter:(NSString *)scheme { - return [scheme hasPrefix:@"assets"]; +- (BOOL)filter:(NSString *)source { + return [source hasPrefix:@"assets"]; } -- (DoricAsyncResult *)request:(NSString *)scheme { +- (DoricAsyncResult *)request:(NSString *)source { DoricAsyncResult *ret = [DoricAsyncResult new]; NSString *path = [[NSBundle mainBundle] bundlePath]; - NSString *fullPath = [path stringByAppendingPathComponent:[scheme substringFromIndex:@"assets://".length]]; + NSString *fullPath = [path stringByAppendingPathComponent:[source substringFromIndex:@"assets://".length]]; NSError *error; NSString *jsContent = [NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:&error]; if (error) { diff --git a/doric-iOS/Pod/Classes/Navigator/DoricNavigatorDelegate.h b/doric-iOS/Pod/Classes/Navigator/DoricNavigatorDelegate.h index aafc8c6a..c2e3a3bb 100644 --- a/doric-iOS/Pod/Classes/Navigator/DoricNavigatorDelegate.h +++ b/doric-iOS/Pod/Classes/Navigator/DoricNavigatorDelegate.h @@ -20,7 +20,7 @@ #import @protocol DoricNavigatorDelegate -- (void)doric_navigator_push:(NSString *)scheme alias:(NSString *)alias animated:(BOOL)animated extra:(NSString *)extra; +- (void)doric_navigator_push:(NSString *)source alias:(NSString *)alias animated:(BOOL)animated extra:(NSString *)extra; - (void)doric_navigator_pop:(BOOL)animated; @end diff --git a/doric-iOS/Pod/Classes/Plugin/DoricNavigatorPlugin.m b/doric-iOS/Pod/Classes/Plugin/DoricNavigatorPlugin.m index 16689502..536d8c8c 100644 --- a/doric-iOS/Pod/Classes/Plugin/DoricNavigatorPlugin.m +++ b/doric-iOS/Pod/Classes/Plugin/DoricNavigatorPlugin.m @@ -24,8 +24,8 @@ @implementation DoricNavigatorPlugin - (void)push:(NSDictionary *)params { dispatch_async(dispatch_get_main_queue(), ^{ BOOL animated = YES; - NSString *scheme = params[@"scheme"]; - NSString *alias = scheme; + NSString *source = params[@"source"]; + NSString *alias = source; NSDictionary *config = params[@"config"]; if (config) { if (config[@"animated"]) { @@ -36,7 +36,7 @@ - (void)push:(NSDictionary *)params { alias = config[@"alias"]; } } - [self.doricContext.navigator doric_navigator_push:scheme alias:alias animated:animated extra:config[@"extra"]]; + [self.doricContext.navigator doric_navigator_push:source alias:alias animated:animated extra:config[@"extra"]]; }); } diff --git a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m index c2e6a1ae..2c3ea3a6 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m @@ -463,22 +463,3 @@ - (void)layoutSelf:(CGSize)targetSize { } } @end - - -DoricVLayoutView *vLayout(NSArray <__kindof UIView *> *views) { - DoricVLayoutView *layout = [[DoricVLayoutView alloc] initWithFrame:CGRectZero]; - for (__kindof UIView *uiView in views) { - [layout addSubview:uiView]; - } - layout.layoutConfig = [[DoricLayoutConfig alloc] initWithWidth:DoricLayoutWrapContent height:DoricLayoutWrapContent]; - return layout; -} - -DoricHLayoutView *hLayout(NSArray <__kindof UIView *> *views) { - DoricHLayoutView *layout = [[DoricHLayoutView alloc] initWithFrame:CGRectZero]; - for (__kindof UIView *uiView in views) { - [layout addSubview:uiView]; - } - layout.layoutConfig = [[DoricLayoutConfig alloc] initWithWidth:DoricLayoutWrapContent height:DoricLayoutWrapContent]; - return layout; -} diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index 46ae1595..011d3cb8 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -2504,12 +2504,12 @@ function navbar(context) { function navigator(context) { return { - push: function (scheme, config) { + push: function (source, config) { if (config && config.extra) { config.extra = JSON.stringify(config.extra); } return context.callNative('navigator', 'push', { - scheme: scheme, config: config + source: source, config: config }); }, pop: function (animated) { diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index 01929ef9..5753d71d 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -1879,12 +1879,12 @@ function navbar(context) { function navigator(context) { return { - push: (scheme, config) => { + push: (source, config) => { if (config && config.extra) { config.extra = JSON.stringify(config.extra); } return context.callNative('navigator', 'push', { - scheme, config + source, config }); }, pop: (animated = true) => { diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index 2245660b..1499ef3c 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -3338,12 +3338,12 @@ function navbar(context) { function navigator(context) { return { - push: (scheme, config) => { + push: (source, config) => { if (config && config.extra) { config.extra = JSON.stringify(config.extra); } return context.callNative('navigator', 'push', { - scheme, config + source, config }); }, pop: (animated = true) => { diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index 5e8c47d3..e95669e0 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -754,7 +754,7 @@ declare module 'doric/lib/src/native/navbar' { declare module 'doric/lib/src/native/navigator' { import { BridgeContext } from "doric/lib/src/runtime/global"; export function navigator(context: BridgeContext): { - push: (scheme: string, config?: { + push: (source: string, config?: { alias?: string | undefined; animated?: boolean | undefined; extra?: object | undefined; diff --git a/doric-js/lib/src/native/navigator.d.ts b/doric-js/lib/src/native/navigator.d.ts index b6a14f91..54dc1336 100644 --- a/doric-js/lib/src/native/navigator.d.ts +++ b/doric-js/lib/src/native/navigator.d.ts @@ -1,6 +1,6 @@ import { BridgeContext } from "../runtime/global"; export declare function navigator(context: BridgeContext): { - push: (scheme: string, config?: { + push: (source: string, config?: { alias?: string | undefined; animated?: boolean | undefined; extra?: object | undefined; diff --git a/doric-js/lib/src/native/navigator.js b/doric-js/lib/src/native/navigator.js index 91ae0d5b..fd73b7a9 100644 --- a/doric-js/lib/src/native/navigator.js +++ b/doric-js/lib/src/native/navigator.js @@ -1,11 +1,11 @@ export function navigator(context) { return { - push: (scheme, config) => { + push: (source, config) => { if (config && config.extra) { config.extra = JSON.stringify(config.extra); } return context.callNative('navigator', 'push', { - scheme, config + source, config }); }, pop: (animated = true) => { diff --git a/doric-js/src/native/navigator.ts b/doric-js/src/native/navigator.ts index 818a700e..ffe26b92 100644 --- a/doric-js/src/native/navigator.ts +++ b/doric-js/src/native/navigator.ts @@ -17,7 +17,7 @@ import { BridgeContext } from "../runtime/global" export function navigator(context: BridgeContext) { return { - push: (scheme: string, config?: { + push: (source: string, config?: { alias?: string, animated?: boolean, extra?: object, @@ -26,7 +26,7 @@ export function navigator(context: BridgeContext) { (config as any).extra = JSON.stringify(config.extra) } return context.callNative('navigator', 'push', { - scheme, config + source, config }) }, pop: (animated = true) => { diff --git a/doric-web/src/navigate/NavigatorPlugin.ts b/doric-web/src/navigate/NavigatorPlugin.ts index d36144da..3438585a 100644 --- a/doric-web/src/navigate/NavigatorPlugin.ts +++ b/doric-web/src/navigate/NavigatorPlugin.ts @@ -6,7 +6,7 @@ export class NavigatorPlugin extends DoricPlugin { navigation: NavigationElement | undefined = document.getElementsByTagName('doric-navigation')[0] as (NavigationElement | undefined) push(args: { - scheme: string, + source: string, config?: { alias?: string, extra?: string, @@ -14,8 +14,8 @@ export class NavigatorPlugin extends DoricPlugin { }) { if (this.navigation) { const div = new DoricElement - div.src = args.scheme - div.alias = args.config?.alias || args.scheme + div.src = args.source + div.alias = args.config?.alias || args.source this.navigation.push(div) return Promise.resolve() } else {