1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Remove dead code (#1787)

* Remove dead analytics code
This commit is contained in:
Oscar Hinton
2021-04-14 23:43:09 +02:00
committed by GitHub
parent dd6b08bb2c
commit 44463e7bc0
19 changed files with 23 additions and 197 deletions

View File

@@ -2,8 +2,6 @@ import { BrowserApi } from '../browser/browserApi';
import MainBackground from './main.background';
import { Analytics } from 'jslib/misc';
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
@@ -13,8 +11,7 @@ export default class CommandsBackground {
private isVivaldi: boolean;
constructor(private main: MainBackground, private passwordGenerationService: PasswordGenerationService,
private platformUtilsService: PlatformUtilsService, private analytics: Analytics,
private vaultTimeoutService: VaultTimeoutService) {
private platformUtilsService: PlatformUtilsService, private vaultTimeoutService: VaultTimeoutService) {
this.isSafari = this.platformUtilsService.isSafari();
this.isVivaldi = this.platformUtilsService.isVivaldi();
}
@@ -57,11 +54,6 @@ export default class CommandsBackground {
const password = await this.passwordGenerationService.generatePassword(options);
this.platformUtilsService.copyToClipboard(password, { window: window });
this.passwordGenerationService.addHistory(password);
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Generated Password From Command',
});
}
private async autoFillLogin(tab?: any) {
@@ -78,11 +70,6 @@ export default class CommandsBackground {
}
await this.main.collectPageDetailsForContentScript(tab, 'autofill_cmd');
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Autofilled From Command',
});
}
private async openPopup() {
@@ -92,9 +79,5 @@ export default class CommandsBackground {
}
this.main.openPopup();
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Opened Popup From Command',
});
}
}

View File

@@ -2,8 +2,6 @@ import { BrowserApi } from '../browser/browserApi';
import MainBackground from './main.background';
import { Analytics } from 'jslib/misc';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { EventService } from 'jslib/abstractions/event.service';
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
@@ -17,7 +15,7 @@ export default class ContextMenusBackground {
private contextMenus: any;
constructor(private main: MainBackground, private cipherService: CipherService,
private passwordGenerationService: PasswordGenerationService, private analytics: Analytics,
private passwordGenerationService: PasswordGenerationService,
private platformUtilsService: PlatformUtilsService, private vaultTimeoutService: VaultTimeoutService,
private eventService: EventService, private totpService: TotpService) {
this.contextMenus = chrome.contextMenus;
@@ -45,11 +43,6 @@ export default class ContextMenusBackground {
const password = await this.passwordGenerationService.generatePassword(options);
this.platformUtilsService.copyToClipboard(password, { window: window });
this.passwordGenerationService.addHistory(password);
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Generated Password From Context Menu',
});
}
private async cipherAction(info: any) {
@@ -72,29 +65,13 @@ export default class ContextMenusBackground {
}
if (info.parentMenuItemId === 'autofill') {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Autofilled From Context Menu',
});
await this.startAutofillPage(cipher);
} else if (info.parentMenuItemId === 'copy-username') {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Copied Username From Context Menu',
});
this.platformUtilsService.copyToClipboard(cipher.login.username, { window: window });
} else if (info.parentMenuItemId === 'copy-password') {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Copied Password From Context Menu',
});
this.platformUtilsService.copyToClipboard(cipher.login.password, { window: window });
this.eventService.collect(EventType.Cipher_ClientCopiedPassword, cipher.id);
} else if (info.parentMenuItemId === 'copy-totp') {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Copied Totp From Context Menu',
});
const totpValue = await this.totpService.getCode(cipher.login.totp);
this.platformUtilsService.copyToClipboard(totpValue, { window: window });
}

View File

@@ -64,7 +64,6 @@ import { SearchService as SearchServiceAbstraction } from 'jslib/abstractions/se
import { SendService as SendServiceAbstraction } from 'jslib/abstractions/send.service';
import { SystemService as SystemServiceAbstraction } from 'jslib/abstractions/system.service';
import { Analytics } from 'jslib/misc';
import { Utils } from 'jslib/misc/utils';
import { BrowserApi } from '../browser/browserApi';
@@ -123,7 +122,6 @@ export default class MainBackground {
systemService: SystemServiceAbstraction;
eventService: EventServiceAbstraction;
policyService: PolicyServiceAbstraction;
analytics: Analytics;
popupUtilsService: PopupUtilsService;
sendService: SendServiceAbstraction;
fileUploadService: FileUploadServiceAbstraction;
@@ -227,8 +225,6 @@ export default class MainBackground {
this.apiService, this.vaultTimeoutService, () => this.logout(true), this.consoleLogService);
this.environmentService = new EnvironmentService(this.apiService, this.storageService,
this.notificationsService);
this.analytics = new Analytics(window, () => BrowserApi.gaFilter(), this.platformUtilsService,
this.storageService, this.appIdService);
this.popupUtilsService = new PopupUtilsService(this.platformUtilsService);
this.systemService = new SystemService(this.storageService, this.vaultTimeoutService,
this.messagingService, this.platformUtilsService, () => {
@@ -246,18 +242,17 @@ export default class MainBackground {
// Background
this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.cipherService,
this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService,
this.analytics, this.notificationsService, this.systemService, this.vaultTimeoutService,
this.notificationsService, this.systemService, this.vaultTimeoutService,
this.environmentService, this.policyService, this.userService, this.messagingService);
this.nativeMessagingBackground = new NativeMessagingBackground(this.storageService, this.cryptoService, this.cryptoFunctionService,
this.vaultTimeoutService, this.runtimeBackground, this.i18nService, this.userService, this.messagingService, this.appIdService,
this.platformUtilsService);
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService,
this.platformUtilsService, this.analytics, this.vaultTimeoutService);
this.platformUtilsService, this.vaultTimeoutService);
this.tabsBackground = new TabsBackground(this);
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
this.passwordGenerationService, this.analytics, this.platformUtilsService, this.vaultTimeoutService,
this.eventService, this.totpService);
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService, this.passwordGenerationService,
this.platformUtilsService, this.vaultTimeoutService, this.eventService, this.totpService);
this.idleBackground = new IdleBackground(this.vaultTimeoutService, this.storageService,
this.notificationsService);
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService,
@@ -277,7 +272,6 @@ export default class MainBackground {
}
async bootstrap() {
this.analytics.ga('send', 'pageview', '/background.html');
this.containerService.attachToWindow(window);
(this.authService as AuthService).init();

View File

@@ -22,7 +22,6 @@ import { BrowserApi } from '../browser/browserApi';
import MainBackground from './main.background';
import { Analytics } from 'jslib/misc';
import { Utils } from 'jslib/misc/utils';
import { OrganizationUserStatusType } from 'jslib/enums/organizationUserStatusType';
@@ -37,7 +36,7 @@ export default class RuntimeBackground {
constructor(private main: MainBackground, private autofillService: AutofillService,
private cipherService: CipherService, private platformUtilsService: BrowserPlatformUtilsService,
private storageService: StorageService, private i18nService: I18nService,
private analytics: Analytics, private notificationsService: NotificationsService,
private notificationsService: NotificationsService,
private systemService: SystemService, private vaultTimeoutService: VaultTimeoutService,
private environmentService: EnvironmentService, private policyService: PolicyService,
private userService: UserService, private messagingService: MessagingService) {
@@ -247,10 +246,6 @@ export default class RuntimeBackground {
const cipher = await this.cipherService.encrypt(model);
await this.cipherService.saveWithServer(cipher);
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Added Login from Notification Bar',
});
}
}
@@ -279,10 +274,6 @@ export default class RuntimeBackground {
model.login.password = queueMessage.newPassword;
const newCipher = await this.cipherService.encrypt(model);
await this.cipherService.saveWithServer(newCipher);
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Changed Password from Notification Bar',
});
}
}
}
@@ -413,10 +404,6 @@ export default class RuntimeBackground {
await this.setDefaultSettings();
}
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'onInstalled ' + this.onInstalledReason,
});
this.onInstalledReason = null;
}
}, 100);