Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

refactor: fix deprecated APIs #954

Merged
merged 2 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/AngularApp/app/activity.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Activity extends androidx.appcompat.app.AppCompatActivity {
setActivityCallbacks(this);
}

this._callbacks.onCreate(this, savedInstanceState, super.onCreate);
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(), super.onCreate);
}

protected onSaveInstanceState(outState: any): void { // android.os.Bundle
Expand Down
25 changes: 1 addition & 24 deletions demo/AngularApp/app/main.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
// this import should be first in order to load some required settings (like globals and reflect-metadata)
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { AppOptions } from "nativescript-angular/platform-common";

import { AppModule } from "./app.module";

let options: AppOptions = {};

if (module["hot"]) {
options.hmrOptions = {
moduleTypeFactory: () => AppModule,
livesyncCallback: (platformReboot) => {
setTimeout(platformReboot, 0);
},
}

module["hot"].accept(["./app.module"], () => {
// Currently the context is needed only for application style modules.
const moduleContext = {};
global["hmrRefresh"](moduleContext);
});
}

// A traditional NativeScript application starts by initializing global objects, setting up global CSS rules, creating, and navigating to the main page.
// Angular applications need to take care of their own initialization: modules, components, directives, routes, DI providers.
// A NativeScript Angular app needs to make both paradigms work together, so we provide a wrapper platform object, platformNativeScriptDynamic,
// that sets up a NativeScript application and can bootstrap the Angular framework.
platformNativeScriptDynamic(options).bootstrapModule(AppModule);
platformNativeScriptDynamic().bootstrapModule(AppModule);
2 changes: 1 addition & 1 deletion demo/AngularApp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = env => {
const tsConfigName = "tsconfig.tns.json";
const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`;
const entryPath = `.${sep}${entryModule}`;
const entries = { bundle: entryPath };
const entries = { bundle: entryPath, application: "./application.android" };
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
if (platform === "ios" && !areCoreModulesExternal) {
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
Expand Down
2 changes: 1 addition & 1 deletion demo/JavaScriptApp/app/activity.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ androidx.appcompat.app.AppCompatActivity.extend("org.myApp.MainActivity", {
if(!this._callbacks) {
frame.setActivityCallbacks(this);
}
this._callbacks.onCreate(this, savedInstanceState, superProto.onCreate);
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(), superProto.onCreate);
},
onSaveInstanceState: function(outState) {
this._callbacks.onSaveInstanceState(this, outState, superProto.onSaveInstanceState);
Expand Down
1 change: 1 addition & 0 deletions demo/JavaScriptApp/app/app-root.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Frame defaultPage="main-page" />
2 changes: 1 addition & 1 deletion demo/JavaScriptApp/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ purpose of the file is to pass control to the app’s first module.

var application = require("tns-core-modules/application");

application.start({ moduleName: "main-page" });
application.run({ moduleName: "app-root" });

/*
Do not place any code after the application has been started as it will not
Expand Down
2 changes: 1 addition & 1 deletion demo/TypeScriptApp/app/activity.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Activity extends androidx.appcompat.app.AppCompatActivity {
setActivityCallbacks(this);
}

this._callbacks.onCreate(this, savedInstanceState, super.onCreate);
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(), super.onCreate);
}

protected onSaveInstanceState(outState: any): void { // android.os.Bundle
Expand Down
1 change: 1 addition & 0 deletions demo/TypeScriptApp/app/app-root.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Frame defaultPage="main-page" />
2 changes: 1 addition & 1 deletion demo/TypeScriptApp/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ purpose of the file is to pass control to the app’s first module.

import * as app from 'tns-core-modules/application';

app.start({ moduleName: 'main-page' });
app.run({ moduleName: "app-root" });

/*
Do not place any code after the application has been started as it will not
Expand Down