default lock options to "on restart"

This commit is contained in:
Kyle Spearrin 2018-01-17 22:42:31 -05:00
parent c942dd3410
commit 4a34f9be59
1 changed files with 11 additions and 1 deletions

View File

@ -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<number>(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') {