Skip to content

Commit 35e60ec

Browse files
Remove usage of the deprecated utils.ios.getter function #9
1 parent c25f605 commit 35e60ec

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
2-
.vscode
2+
.vscode
3+
node_modules

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# NativeScript Insomnia
22

3+
[![NPM version][npm-image]][npm-url]
4+
[![Downloads][downloads-image]][npm-url]
5+
[![Twitter Follow][twitter-image]][twitter-url]
6+
7+
[npm-image]:http://img.shields.io/npm/v/nativescript-insomnia.svg
8+
[npm-url]:https://npmjs.org/package/nativescript-insomnia
9+
[downloads-image]:http://img.shields.io/npm/dm/nativescript-insomnia.svg
10+
[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
11+
[twitter-url]:https://twitter.com/eddyverbruggen
12+
313
## Demo app (Angular)
414
This plugin is part of the [plugin showcase app](https://github.com/EddyVerbruggen/nativescript-pluginshowcase/tree/master/app/ar) I built using Angular.
515

insomnia.ios.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
var utils = require("tns-core-modules/utils/utils");
2-
31
exports.keepAwake = function () {
42
return new Promise(function (resolve, reject) {
53
try {
6-
var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);
4+
var app = UIApplication.sharedApplication;
75
if (!app.idleTimerDisabled) {
86
app.idleTimerDisabled = true;
97
}
@@ -18,7 +16,7 @@ exports.keepAwake = function () {
1816
exports.allowSleepAgain = function () {
1917
return new Promise(function (resolve, reject) {
2018
try {
21-
var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);
19+
var app = UIApplication.sharedApplication;
2220
if (app.idleTimerDisabled) {
2321
app.idleTimerDisabled = false;
2422
}

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-insomnia",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "Make the screen not dim (and eventually lock the device) while Insomnia is active",
55
"main": "insomnia",
66
"typings": "index.d.ts",
@@ -25,5 +25,9 @@
2525
"author": "Eddy Verbruggen <[email protected]> (https://github.com/EddyVerbruggen)",
2626
"license": "MIT",
2727
"bugs": "https://github.com/eddyverbruggen/nativescript-insomnia/issues",
28-
"homepage": "https://github.com/eddyverbruggen/nativescript-insomnia"
28+
"homepage": "https://github.com/eddyverbruggen/nativescript-insomnia",
29+
"devDependencies": {
30+
"tns-core-modules": "~5.4.2",
31+
"tns-platform-declarations": "~5.4.2"
32+
}
2933
}

0 commit comments

Comments
 (0)