feat:update cli target files

This commit is contained in:
pengfei.zhou 2019-12-23 17:59:19 +08:00 committed by osborn
parent c1776f6f25
commit 667c233d63
4 changed files with 13 additions and 18 deletions

View File

@ -20,7 +20,7 @@ android {
sourceSets { sourceSets {
main { main {
assets.srcDirs = [project.getRootDir().getParent() + "/js/bundle/src"] assets.srcDirs = [project.getRootDir().getParent() + "/js/bundle"]
} }
} }

View File

@ -9,25 +9,16 @@ import pub.doric.DoricFragment;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private final String BUNDLE_NAME = "__$__"; private final String BUNDLE_NAME = "__$__";
private DoricFragment doricFragment;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
if (savedInstanceState == null) { if (savedInstanceState == null) {
String scheme = "assets://" + BUNDLE_NAME + ".js"; String scheme = "assets://src/" + BUNDLE_NAME + ".js";
this.doricFragment = DoricFragment.newInstance(scheme, BUNDLE_NAME); getIntent().putExtra("scheme", scheme);
this.getSupportFragmentManager().beginTransaction().add(R.id.root, this.doricFragment).commit(); getIntent().putExtra("alias", BUNDLE_NAME);
} this.getSupportFragmentManager().beginTransaction().add(R.id.root, new DoricFragment()).commit();
}
@Override
public void onBackPressed() {
if (this.doricFragment.canPop()) {
this.doricFragment.pop();
} else {
super.onBackPressed();
} }
} }
} }

View File

@ -7,7 +7,7 @@
// //
#import "AppDelegate.h" #import "AppDelegate.h"
#import <Doric/Doric.h> #import <DoricCore/Doric.h>
@interface AppDelegate () @interface AppDelegate ()
@end @end
@ -17,7 +17,9 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString *bundleName = @"__$__"; NSString *bundleName = @"__$__";
DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName]; DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName]
alias:bundleName
extra:@""];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UINavigationController *navVC = [[UINavigationController UINavigationController *navVC = [[UINavigationController
alloc] initWithRootViewController:doricViewController]; alloc] initWithRootViewController:doricViewController];

View File

@ -1,5 +1,5 @@
#import "SceneDelegate.h" #import "SceneDelegate.h"
#import <Doric/Doric.h> #import <DoricCore/Doric.h>
@interface SceneDelegate () @interface SceneDelegate ()
@end @end
@ -8,7 +8,9 @@ @implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
UIWindowScene *windowScene = (UIWindowScene *) scene; UIWindowScene *windowScene = (UIWindowScene *) scene;
NSString *bundleName = @"__$__"; NSString *bundleName = @"__$__";
DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName]; DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName]
alias:bundleName
extra:@""];
doricViewController.view.backgroundColor = [UIColor whiteColor]; doricViewController.view.backgroundColor = [UIColor whiteColor];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController];
self.window = [[UIWindow alloc] initWithWindowScene:windowScene]; self.window = [[UIWindow alloc] initWithWindowScene:windowScene];