Skip to content

Commit 2c95cbe

Browse files
authored
Merge pull request #384 from NativeScript/niliev/fix
removed deprecated APIs
2 parents 10a1bd2 + 4024a5e commit 2c95cbe

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

app/ng-framework-modules-category/application/app-using-android-specifics/app-using-android-specifics.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export class AppUsingAndroidExampleComponent {
2626
let packageName = androidApp.packageName; // The package ID e.g. org.nativescript.nativescriptsdkexamplesng
2727
let nativeApp = androidApp.nativeApp; // The native APplication reference
2828
let foregroundActivity = androidApp.foregroundActivity; // The current Activity reference
29-
let currentContext = androidApp.currentContext; // The current Android context
3029
let context = androidApp.context; console.log(context); // The current Android context
3130
// << app-class-properties
3231

app/ng-framework-modules-category/application/app-using-ios-specifics/app-using-ios-specifics.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Component } from "@angular/core";
22
import { android as androidApp, ios as iosApp } from "tns-core-modules/application";
3-
import { ios as iosUtils } from "tns-core-modules/utils/utils";
43

54
@Component({
65
moduleId: module.id,
@@ -33,13 +32,13 @@ export class AppUsingIosExampleComponent {
3332
this.batteryLife = 0;
3433

3534
// >> app-ios-observer-code
36-
iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryMonitoringEnabled = true;
37-
this.batteryLife = +(iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryLevel * 100);
35+
UIDevice.currentDevice.batteryMonitoringEnabled = true;
36+
this.batteryLife = +(UIDevice.currentDevice.batteryLevel * 100);
3837

3938
let that = this;
4039
let observer = iosApp.addNotificationObserver(UIDeviceBatteryLevelDidChangeNotification,
4140
function onReceiveCallback(notification: NSNotification) {
42-
that.batteryLife = +(iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryLevel * 100);
41+
that.batteryLife = +(UIDevice.currentDevice.batteryLevel * 100);
4342
});
4443
// << app-ios-observer-code
4544

0 commit comments

Comments
 (0)