Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit b77ecff

Browse files
Alexander Vakrilovrosen-vladimirov
Alexander Vakrilov
authored andcommitted
refactor: fix deprecated APIs (#954)
* refactor: fix onCreate() deprecated API call * chore: update apps
1 parent 874e4f8 commit b77ecff

File tree

9 files changed

+9
-30
lines changed

9 files changed

+9
-30
lines changed

‎demo/AngularApp/app/activity.android.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Activity extends androidx.appcompat.app.AppCompatActivity {
1414
setActivityCallbacks(this);
1515
}
1616

17-
this._callbacks.onCreate(this, savedInstanceState, super.onCreate);
17+
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(),super.onCreate);
1818
}
1919

2020
protected onSaveInstanceState(outState: any): void { // android.os.Bundle

‎demo/AngularApp/app/main.ts‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
11
// this import should be first in order to load some required settings (like globals and reflect-metadata)
22
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
3-
import { AppOptions } from "nativescript-angular/platform-common";
4-
53
import { AppModule } from "./app.module";
64

7-
let options: AppOptions = {};
8-
9-
if (module["hot"]) {
10-
options.hmrOptions = {
11-
moduleTypeFactory: () => AppModule,
12-
livesyncCallback: (platformReboot) => {
13-
setTimeout(platformReboot, 0);
14-
},
15-
}
16-
17-
module["hot"].accept(["./app.module"], () => {
18-
// Currently the context is needed only for application style modules.
19-
const moduleContext = {};
20-
global["hmrRefresh"](moduleContext);
21-
});
22-
}
23-
24-
// A traditional NativeScript application starts by initializing global objects, setting up global CSS rules, creating, and navigating to the main page.
25-
// Angular applications need to take care of their own initialization: modules, components, directives, routes, DI providers.
26-
// A NativeScript Angular app needs to make both paradigms work together, so we provide a wrapper platform object, platformNativeScriptDynamic,
27-
// that sets up a NativeScript application and can bootstrap the Angular framework.
28-
platformNativeScriptDynamic(options).bootstrapModule(AppModule);
5+
platformNativeScriptDynamic().bootstrapModule(AppModule);

‎demo/AngularApp/webpack.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = env => {
6262
const tsConfigName = "tsconfig.tns.json";
6363
const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`;
6464
const entryPath = `.${sep}${entryModule}`;
65-
const entries = { bundle: entryPath };
65+
const entries = { bundle: entryPath,application: "./application.android" };
6666
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
6767
if (platform === "ios" && !areCoreModulesExternal) {
6868
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";

‎demo/JavaScriptApp/app/activity.android.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ androidx.appcompat.app.AppCompatActivity.extend("org.myApp.MainActivity", {
1010
if(!this._callbacks) {
1111
frame.setActivityCallbacks(this);
1212
}
13-
this._callbacks.onCreate(this, savedInstanceState, superProto.onCreate);
13+
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(),superProto.onCreate);
1414
},
1515
onSaveInstanceState: function(outState) {
1616
this._callbacks.onSaveInstanceState(this, outState, superProto.onSaveInstanceState);

‎demo/JavaScriptApp/app/app-root.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Frame defaultPage="main-page" />

‎demo/JavaScriptApp/app/app.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ purpose of the file is to pass control to the app’s first module.
66

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

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

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

‎demo/TypeScriptApp/app/activity.android.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Activity extends androidx.appcompat.app.AppCompatActivity {
1313
setActivityCallbacks(this);
1414
}
1515

16-
this._callbacks.onCreate(this, savedInstanceState, super.onCreate);
16+
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(),super.onCreate);
1717
}
1818

1919
protected onSaveInstanceState(outState: any): void { // android.os.Bundle

‎demo/TypeScriptApp/app/app-root.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Frame defaultPage="main-page" />

‎demo/TypeScriptApp/app/app.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ purpose of the file is to pass control to the app’s first module.
66

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

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

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /