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 {
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 {
private final String BUNDLE_NAME = "__$__";
private DoricFragment doricFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
String scheme = "assets://" + BUNDLE_NAME + ".js";
this.doricFragment = DoricFragment.newInstance(scheme, BUNDLE_NAME);
this.getSupportFragmentManager().beginTransaction().add(R.id.root, this.doricFragment).commit();
}
}
@Override
public void onBackPressed() {
if (this.doricFragment.canPop()) {
this.doricFragment.pop();
} else {
super.onBackPressed();
String scheme = "assets://src/" + BUNDLE_NAME + ".js";
getIntent().putExtra("scheme", scheme);
getIntent().putExtra("alias", BUNDLE_NAME);
this.getSupportFragmentManager().beginTransaction().add(R.id.root, new DoricFragment()).commit();
}
}
}

View File

@ -7,7 +7,7 @@
//
#import "AppDelegate.h"
#import <Doric/Doric.h>
#import <DoricCore/Doric.h>
@interface AppDelegate ()
@end
@ -17,7 +17,9 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
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]];
UINavigationController *navVC = [[UINavigationController
alloc] initWithRootViewController:doricViewController];

View File

@ -1,5 +1,5 @@
#import "SceneDelegate.h"
#import <Doric/Doric.h>
#import <DoricCore/Doric.h>
@interface SceneDelegate ()
@end
@ -8,7 +8,9 @@ @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] alias:bundleName];
DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName]
alias:bundleName
extra:@""];
doricViewController.view.backgroundColor = [UIColor whiteColor];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController];
self.window = [[UIWindow alloc] initWithWindowScene:windowScene];