From 48abc87e0c3de98dc5090e765d0f538cef64e603 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 9 Jul 2018 09:12:41 -0400 Subject: [PATCH] update device type enums --- jslib | 2 +- src/popup/settings/settings.component.ts | 12 +++++----- .../browserPlatformUtils.service.spec.ts | 12 +++++----- src/services/browserPlatformUtils.service.ts | 24 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/jslib b/jslib index 8ac3450d9e..621a6d1524 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 8ac3450d9eee10c54bc35dd931a70bf82f97d0a5 +Subproject commit 621a6d1524a4053725a54b9688364ea97958eefa diff --git a/src/popup/settings/settings.component.ts b/src/popup/settings/settings.component.ts index b71661379b..92e86ecbcd 100644 --- a/src/popup/settings/settings.component.ts +++ b/src/popup/settings/settings.component.ts @@ -21,17 +21,17 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StorageService } from 'jslib/abstractions/storage.service'; const RateUrls = { - [DeviceType.Chrome]: + [DeviceType.ChromeExtension]: 'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews', - [DeviceType.Firefox]: + [DeviceType.FirefoxExtension]: 'https://addons.mozilla.org/en-US/firefox/addon/bitwarden-password-manager/#reviews', - [DeviceType.Opera]: + [DeviceType.OperaExtension]: 'https://addons.opera.com/en/extensions/details/bitwarden-free-password-manager/#feedback-container', - [DeviceType.Edge]: + [DeviceType.EdgeExtension]: 'https://www.microsoft.com/store/p/bitwarden-free-password-manager/9p6kxl0svnnl', - [DeviceType.Vivaldi]: + [DeviceType.VivaldiExtension]: 'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews', - [DeviceType.Safari]: + [DeviceType.SafariExtension]: 'https://itunes.apple.com/app/bitwarden-password-manager/id1137397744', }; diff --git a/src/services/browserPlatformUtils.service.spec.ts b/src/services/browserPlatformUtils.service.spec.ts index 41f83c95d3..f1db61a19e 100644 --- a/src/services/browserPlatformUtils.service.spec.ts +++ b/src/services/browserPlatformUtils.service.spec.ts @@ -57,7 +57,7 @@ describe('Browser Utils Service', () => { }); const browserPlatformUtilsService = new BrowserPlatformUtilsService(null); - expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Chrome); + expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.ChromeExtension); }); it('should detect firefox', () => { @@ -67,7 +67,7 @@ describe('Browser Utils Service', () => { }); const browserPlatformUtilsService = new BrowserPlatformUtilsService(null); - expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Firefox); + expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.FirefoxExtension); }); it('should detect opera', () => { @@ -82,7 +82,7 @@ describe('Browser Utils Service', () => { }); const browserPlatformUtilsService = new BrowserPlatformUtilsService(null); - expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Opera); + expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.OperaExtension); }); it('should detect edge', () => { @@ -92,7 +92,7 @@ describe('Browser Utils Service', () => { }); const browserPlatformUtilsService = new BrowserPlatformUtilsService(null); - expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Edge); + expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.EdgeExtension); }); it('should detect safari', () => { @@ -107,7 +107,7 @@ describe('Browser Utils Service', () => { }); const browserPlatformUtilsService = new BrowserPlatformUtilsService(null); - expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Safari); + expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.SafariExtension); }); it('should detect vivaldi', () => { @@ -117,7 +117,7 @@ describe('Browser Utils Service', () => { }); const browserPlatformUtilsService = new BrowserPlatformUtilsService(null); - expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Vivaldi); + expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.VivaldiExtension); }); }); }); diff --git a/src/services/browserPlatformUtils.service.ts b/src/services/browserPlatformUtils.service.ts index 3fa3161917..ae313a8766 100644 --- a/src/services/browserPlatformUtils.service.ts +++ b/src/services/browserPlatformUtils.service.ts @@ -63,19 +63,19 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService } if (navigator.userAgent.indexOf(' Firefox/') !== -1 || navigator.userAgent.indexOf(' Gecko/') !== -1) { - this.deviceCache = DeviceType.Firefox; + this.deviceCache = DeviceType.FirefoxExtension; } else if ((!!(window as any).opr && !!opr.addons) || !!(window as any).opera || navigator.userAgent.indexOf(' OPR/') >= 0) { - this.deviceCache = DeviceType.Opera; + this.deviceCache = DeviceType.OperaExtension; } else if (navigator.userAgent.indexOf(' Edge/') !== -1) { - this.deviceCache = DeviceType.Edge; + this.deviceCache = DeviceType.EdgeExtension; } else if (navigator.userAgent.indexOf(' Vivaldi/') !== -1) { - this.deviceCache = DeviceType.Vivaldi; + this.deviceCache = DeviceType.VivaldiExtension; } else if ((window as any).safari && navigator.userAgent.indexOf(' Safari/') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) { - this.deviceCache = DeviceType.Safari; + this.deviceCache = DeviceType.SafariExtension; } else if ((window as any).chrome && navigator.userAgent.indexOf(' Chrome/') !== -1) { - this.deviceCache = DeviceType.Chrome; + this.deviceCache = DeviceType.ChromeExtension; } return this.deviceCache; @@ -86,27 +86,27 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService } isFirefox(): boolean { - return this.getDevice() === DeviceType.Firefox; + return this.getDevice() === DeviceType.FirefoxExtension; } isChrome(): boolean { - return this.getDevice() === DeviceType.Chrome; + return this.getDevice() === DeviceType.ChromeExtension; } isEdge(): boolean { - return this.getDevice() === DeviceType.Edge; + return this.getDevice() === DeviceType.EdgeExtension; } isOpera(): boolean { - return this.getDevice() === DeviceType.Opera; + return this.getDevice() === DeviceType.OperaExtension; } isVivaldi(): boolean { - return this.getDevice() === DeviceType.Vivaldi; + return this.getDevice() === DeviceType.VivaldiExtension; } isSafari(): boolean { - return this.getDevice() === DeviceType.Safari; + return this.getDevice() === DeviceType.SafariExtension; } isIE(): boolean {