From 4a34f9be5946499f193fa26e10d15b9ed0d552fb Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 17 Jan 2018 22:42:31 -0500 Subject: [PATCH] default lock options to "on restart" --- src/background/runtime.background.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 7dfc405c9b..e85fca8e08 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -272,9 +272,10 @@ export default class RuntimeBackground { if (reason === 'install') { BrowserApi.createNewTab(gettingStartedUrl); + await this.setDefaultSettings(); } } else if (this.runtime.onInstalled) { - this.runtime.onInstalled.addListener((details: any) => { + this.runtime.onInstalled.addListener(async (details: any) => { (window as any).ga('send', { hitType: 'event', eventAction: 'onInstalled ' + details.reason, @@ -282,11 +283,20 @@ export default class RuntimeBackground { if (details.reason === 'install') { BrowserApi.createNewTab(gettingStartedUrl); + await this.setDefaultSettings(); } }); } } + private async setDefaultSettings() { + // Default lock options to "on restart". + const currentLockOption = await this.storageService.get(ConstantsService.lockOptionKey); + if (currentLockOption == null) { + await this.storageService.save(ConstantsService.lockOptionKey, -1); + } + } + private async getDataForTab(tab: any, responseCommand: string) { const responseData: any = {}; if (responseCommand === 'notificationBarDataResponse') {