1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

adjust enum names for added browser types

This commit is contained in:
Kyle Spearrin 2018-07-09 09:04:47 -04:00
parent 8ac3450d9e
commit 621a6d1524
4 changed files with 39 additions and 26 deletions

View File

@ -31,14 +31,14 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
if (!this.deviceCache) { if (!this.deviceCache) {
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
this.deviceCache = DeviceType.Windows; this.deviceCache = DeviceType.WindowsDesktop;
break; break;
case 'darwin': case 'darwin':
this.deviceCache = DeviceType.MacOs; this.deviceCache = DeviceType.MacOsDesktop;
break; break;
case 'linux': case 'linux':
default: default:
this.deviceCache = DeviceType.Linux; this.deviceCache = DeviceType.LinuxDesktop;
break; break;
} }
} }

View File

@ -1,12 +1,23 @@
export enum DeviceType { export enum DeviceType {
Chrome = 2, Android = 0,
Firefox = 3, iOS = 1,
Opera = 4, ChromeExtension = 2,
Edge = 5, FirefoxExtension = 3,
Windows = 6, OperaExtension = 4,
MacOs = 7, EdgeExtension = 5,
Linux = 8, WindowsDesktop = 6,
Vivaldi = 19, MacOsDesktop = 7,
Safari = 20, LinuxDesktop = 8,
Web = 21, ChromeBrowser = 9,
FirefoxBrowser = 10,
OperaBrowser = 11,
EdgeBrowser = 12,
IEBrowser = 13,
UnknownBrowser = 14,
AndroidAmazon = 15,
UWP = 16,
SafariBrowser = 17,
VivaldiBrowser = 18,
VivaldiExtension = 19,
SafariExtension = 20,
} }

View File

@ -9,16 +9,15 @@ import { DeviceType } from '../enums/deviceType';
const GaObj = 'ga'; const GaObj = 'ga';
export const AnalyticsIds = { export const AnalyticsIds = {
[DeviceType.Chrome]: 'UA-81915606-6', [DeviceType.ChromeExtension]: 'UA-81915606-6',
[DeviceType.Firefox]: 'UA-81915606-7', [DeviceType.FirefoxExtension]: 'UA-81915606-7',
[DeviceType.Opera]: 'UA-81915606-8', [DeviceType.OperaExtension]: 'UA-81915606-8',
[DeviceType.Edge]: 'UA-81915606-9', [DeviceType.EdgeExtension]: 'UA-81915606-9',
[DeviceType.Vivaldi]: 'UA-81915606-15', [DeviceType.VivaldiExtension]: 'UA-81915606-15',
[DeviceType.Safari]: 'UA-81915606-16', [DeviceType.SafariExtension]: 'UA-81915606-16',
[DeviceType.Windows]: 'UA-81915606-17', [DeviceType.WindowsDesktop]: 'UA-81915606-17',
[DeviceType.Linux]: 'UA-81915606-19', [DeviceType.LinuxDesktop]: 'UA-81915606-19',
[DeviceType.MacOs]: 'UA-81915606-18', [DeviceType.MacOsDesktop]: 'UA-81915606-18',
[DeviceType.Web]: 'UA-81915606-3',
}; };
export class Analytics { export class Analytics {

View File

@ -85,9 +85,12 @@ export class ApiService implements ApiServiceAbstraction {
private logoutCallback: (expired: boolean) => Promise<void>) { private logoutCallback: (expired: boolean) => Promise<void>) {
const device = platformUtilsService.getDevice(); const device = platformUtilsService.getDevice();
this.deviceType = device.toString(); this.deviceType = device.toString();
this.isWebClient = device === DeviceType.Web; this.isWebClient = device === DeviceType.IEBrowser || device === DeviceType.ChromeBrowser ||
this.isDesktopClient = device === DeviceType.Windows || device === DeviceType.MacOs || device === DeviceType.EdgeBrowser || device === DeviceType.FirefoxBrowser ||
device === DeviceType.Linux; device === DeviceType.OperaBrowser || device === DeviceType.SafariBrowser ||
device === DeviceType.UnknownBrowser || device === DeviceType.VivaldiBrowser;
this.isDesktopClient = device === DeviceType.WindowsDesktop || device === DeviceType.MacOsDesktop ||
device === DeviceType.LinuxDesktop;
} }
setUrls(urls: EnvironmentUrls): void { setUrls(urls: EnvironmentUrls): void {