From 7dfffb7e589d2ec473457a9bd615e546f8ad7a42 Mon Sep 17 00:00:00 2001 From: Steve McNiven-Scott Date: Mon, 11 Dec 2017 10:33:13 -0500 Subject: [PATCH] Remove delegate implimentation, replace with app resume --- src/package-lock.json | 2 +- src/package.json | 2 +- src/store-update.delegate.ts | 15 --------------- src/store-update.ios.ts | 8 +++++--- 4 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 src/store-update.delegate.ts diff --git a/src/package-lock.json b/src/package-lock.json index 41e46084..f61a6828 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -1,6 +1,6 @@ { "name": "nativescript-store-update", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/package.json b/src/package.json index eb0b67d7..695ec4ce 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-store-update", - "version": "1.0.1", + "version": "1.0.2", "description": "Keep your {N} App updated.", "main": "store-update", "typings": "index.d.ts", diff --git a/src/store-update.delegate.ts b/src/store-update.delegate.ts deleted file mode 100644 index 74ef1753..00000000 --- a/src/store-update.delegate.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as app from 'tns-core-modules/application' -import { StoreUpdate } from './' - -export class ForegroundDelegage extends UIResponder implements UIApplicationDelegate { - static ObjCProtocols = [UIApplicationDelegate] - - applicationDidFinishLaunchingWithOptions(): boolean { - StoreUpdate.checkForUpdate() - return true - } - - applicationWillEnterForeground(): void { - StoreUpdate.checkForUpdate() - } -} diff --git a/src/store-update.ios.ts b/src/store-update.ios.ts index bfad560d..2a3439d1 100644 --- a/src/store-update.ios.ts +++ b/src/store-update.ios.ts @@ -4,14 +4,11 @@ import * as utils from 'tns-core-modules/utils/utils' import { AppStoreHelper } from './helpers' import { IAppleStoreResult, IStoreUpdateConfig } from './interfaces' import { StoreUpdateCommon } from './store-update.common' -import { ForegroundDelegage } from './store-update.delegate' export * from './constants' export * from './helpers' export * from './interfaces' -app.ios.delegate = ForegroundDelegage - export class StoreUpdate { private static _common private static _trackViewUrl @@ -26,6 +23,11 @@ export class StoreUpdate { ...config, onConfirmed: StoreUpdate._openStore.bind(StoreUpdate), }) + + //Hook into resume event to check for version + app.on(app.resumeEvent, function (args) { + StoreUpdate.checkForUpdate(); + }); } static checkForUpdate() {