mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-25 16:59:17 +01:00
update device type enums
This commit is contained in:
parent
7b84a2e597
commit
48abc87e0c
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit 8ac3450d9eee10c54bc35dd931a70bf82f97d0a5
|
Subproject commit 621a6d1524a4053725a54b9688364ea97958eefa
|
@ -21,17 +21,17 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
|||||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||||
|
|
||||||
const RateUrls = {
|
const RateUrls = {
|
||||||
[DeviceType.Chrome]:
|
[DeviceType.ChromeExtension]:
|
||||||
'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews',
|
'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',
|
'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',
|
'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',
|
'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',
|
'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',
|
'https://itunes.apple.com/app/bitwarden-password-manager/id1137397744',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ describe('Browser Utils Service', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
||||||
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Chrome);
|
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.ChromeExtension);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should detect firefox', () => {
|
it('should detect firefox', () => {
|
||||||
@ -67,7 +67,7 @@ describe('Browser Utils Service', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
||||||
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Firefox);
|
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.FirefoxExtension);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should detect opera', () => {
|
it('should detect opera', () => {
|
||||||
@ -82,7 +82,7 @@ describe('Browser Utils Service', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
||||||
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Opera);
|
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.OperaExtension);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should detect edge', () => {
|
it('should detect edge', () => {
|
||||||
@ -92,7 +92,7 @@ describe('Browser Utils Service', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
||||||
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Edge);
|
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.EdgeExtension);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should detect safari', () => {
|
it('should detect safari', () => {
|
||||||
@ -107,7 +107,7 @@ describe('Browser Utils Service', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
||||||
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Safari);
|
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.SafariExtension);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should detect vivaldi', () => {
|
it('should detect vivaldi', () => {
|
||||||
@ -117,7 +117,7 @@ describe('Browser Utils Service', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
||||||
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Vivaldi);
|
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.VivaldiExtension);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -63,19 +63,19 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (navigator.userAgent.indexOf(' Firefox/') !== -1 || navigator.userAgent.indexOf(' Gecko/') !== -1) {
|
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 ||
|
} else if ((!!(window as any).opr && !!opr.addons) || !!(window as any).opera ||
|
||||||
navigator.userAgent.indexOf(' OPR/') >= 0) {
|
navigator.userAgent.indexOf(' OPR/') >= 0) {
|
||||||
this.deviceCache = DeviceType.Opera;
|
this.deviceCache = DeviceType.OperaExtension;
|
||||||
} else if (navigator.userAgent.indexOf(' Edge/') !== -1) {
|
} else if (navigator.userAgent.indexOf(' Edge/') !== -1) {
|
||||||
this.deviceCache = DeviceType.Edge;
|
this.deviceCache = DeviceType.EdgeExtension;
|
||||||
} else if (navigator.userAgent.indexOf(' Vivaldi/') !== -1) {
|
} 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 &&
|
} else if ((window as any).safari && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
||||||
navigator.userAgent.indexOf('Chrome') === -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) {
|
} else if ((window as any).chrome && navigator.userAgent.indexOf(' Chrome/') !== -1) {
|
||||||
this.deviceCache = DeviceType.Chrome;
|
this.deviceCache = DeviceType.ChromeExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.deviceCache;
|
return this.deviceCache;
|
||||||
@ -86,27 +86,27 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
|||||||
}
|
}
|
||||||
|
|
||||||
isFirefox(): boolean {
|
isFirefox(): boolean {
|
||||||
return this.getDevice() === DeviceType.Firefox;
|
return this.getDevice() === DeviceType.FirefoxExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
isChrome(): boolean {
|
isChrome(): boolean {
|
||||||
return this.getDevice() === DeviceType.Chrome;
|
return this.getDevice() === DeviceType.ChromeExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
isEdge(): boolean {
|
isEdge(): boolean {
|
||||||
return this.getDevice() === DeviceType.Edge;
|
return this.getDevice() === DeviceType.EdgeExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
isOpera(): boolean {
|
isOpera(): boolean {
|
||||||
return this.getDevice() === DeviceType.Opera;
|
return this.getDevice() === DeviceType.OperaExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
isVivaldi(): boolean {
|
isVivaldi(): boolean {
|
||||||
return this.getDevice() === DeviceType.Vivaldi;
|
return this.getDevice() === DeviceType.VivaldiExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSafari(): boolean {
|
isSafari(): boolean {
|
||||||
return this.getDevice() === DeviceType.Safari;
|
return this.getDevice() === DeviceType.SafariExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
isIE(): boolean {
|
isIE(): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user