update device type enums

This commit is contained in:
Kyle Spearrin 2018-07-09 09:12:41 -04:00
parent 7b84a2e597
commit 48abc87e0c
4 changed files with 25 additions and 25 deletions

2
jslib

@ -1 +1 @@
Subproject commit 8ac3450d9eee10c54bc35dd931a70bf82f97d0a5
Subproject commit 621a6d1524a4053725a54b9688364ea97958eefa

View File

@ -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',
};

View File

@ -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);
});
});
});

View File

@ -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 {