Remove more old safari app extension logic
This commit is contained in:
parent
02acf0786b
commit
0f2c4b4a59
|
@ -20,7 +20,7 @@ export default class CommandsBackground {
|
|||
}
|
||||
|
||||
async init() {
|
||||
if (this.isSafari || this.isVivaldi) {
|
||||
if (this.isVivaldi) {
|
||||
BrowserApi.messageListener('commands.background', async (msg: any, sender: any, sendResponse: any) => {
|
||||
if (msg.command === 'keyboardShortcutTriggered' && msg.shortcut) {
|
||||
await this.processCommand(msg.shortcut, sender);
|
||||
|
|
|
@ -155,7 +155,7 @@ export default class MainBackground {
|
|||
async () => {
|
||||
if (this.nativeMessagingBackground != null) {
|
||||
const promise = this.nativeMessagingBackground.getResponse();
|
||||
|
||||
|
||||
try {
|
||||
await this.nativeMessagingBackground.send({command: 'biometricUnlock'});
|
||||
} catch (e) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { CipherView } from 'jslib/models/view/cipherView';
|
|||
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
||||
import { LoginView } from 'jslib/models/view/loginView';
|
||||
|
||||
import { AuthService } from 'jslib/abstractions/auth.service';
|
||||
import { AutofillService } from '../services/abstractions/autofill.service';
|
||||
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
|
@ -12,17 +11,13 @@ import { ConstantsService } from 'jslib/services/constants.service';
|
|||
import { EnvironmentService } from 'jslib/abstractions/environment.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { NotificationsService } from 'jslib/abstractions/notifications.service';
|
||||
import { PopupUtilsService } from '../popup/services/popup-utils.service';
|
||||
import { StateService } from 'jslib/abstractions/state.service';
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
import { SyncService } from 'jslib/abstractions/sync.service';
|
||||
import { SystemService } from 'jslib/abstractions/system.service';
|
||||
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
||||
|
||||
import { BrowserApi } from '../browser/browserApi';
|
||||
|
||||
import MainBackground from './main.background';
|
||||
import { NativeMessagingBackground } from './nativeMessaging.background';
|
||||
|
||||
import { Analytics } from 'jslib/misc';
|
||||
import { Utils } from 'jslib/misc/utils';
|
||||
|
@ -31,7 +26,6 @@ export default class RuntimeBackground {
|
|||
private runtime: any;
|
||||
private autofillTimeout: any;
|
||||
private pageDetailsToAutoFill: any[] = [];
|
||||
private isSafari: boolean;
|
||||
private onInstalledReason: string = null;
|
||||
|
||||
constructor(private main: MainBackground, private autofillService: AutofillService,
|
||||
|
@ -40,15 +34,12 @@ export default class RuntimeBackground {
|
|||
private analytics: Analytics, private notificationsService: NotificationsService,
|
||||
private systemService: SystemService, private vaultTimeoutService: VaultTimeoutService,
|
||||
private environmentService: EnvironmentService) {
|
||||
this.isSafari = this.platformUtilsService.isSafari();
|
||||
this.runtime = this.isSafari ? {} : chrome.runtime;
|
||||
this.runtime = chrome.runtime;
|
||||
|
||||
// onInstalled listener must be wired up before anything else, so we do it in the ctor
|
||||
if (!this.isSafari) {
|
||||
this.runtime.onInstalled.addListener((details: any) => {
|
||||
this.onInstalledReason = details.reason;
|
||||
});
|
||||
}
|
||||
this.runtime.onInstalled.addListener((details: any) => {
|
||||
this.onInstalledReason = details.reason;
|
||||
});
|
||||
}
|
||||
|
||||
async init() {
|
||||
|
@ -388,20 +379,6 @@ export default class RuntimeBackground {
|
|||
}
|
||||
|
||||
private async checkOnInstalled() {
|
||||
if (this.isSafari) {
|
||||
const installedVersion = await this.storageService.get<string>(ConstantsService.installedVersionKey);
|
||||
if (installedVersion == null) {
|
||||
this.onInstalledReason = 'install';
|
||||
} else if (BrowserApi.getApplicationVersion() !== installedVersion) {
|
||||
this.onInstalledReason = 'update';
|
||||
}
|
||||
|
||||
if (this.onInstalledReason != null) {
|
||||
await this.storageService.save(ConstantsService.installedVersionKey,
|
||||
BrowserApi.getApplicationVersion());
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(async () => {
|
||||
if (this.onInstalledReason != null) {
|
||||
if (this.onInstalledReason === 'install') {
|
||||
|
|
|
@ -19,14 +19,13 @@ export class SafariApp {
|
|||
}
|
||||
|
||||
static sendMessageToApp(command: string, data: any = null, resolveNow = false): Promise<any> {
|
||||
debugger;
|
||||
if (!BrowserApi.isSafariApi) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
const now = new Date();
|
||||
const messageId = now.getTime().toString() + '_' + Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
||||
(browser as any).runtime.sendNativeMessage("com.bitwarden.desktop", {
|
||||
(browser as any).runtime.sendNativeMessage('com.bitwarden.desktop', {
|
||||
id: messageId,
|
||||
command: command,
|
||||
data: data,
|
||||
|
@ -51,7 +50,6 @@ export class SafariApp {
|
|||
}
|
||||
if ((message.id == null || message.id === '') && message.command === 'app_message') {
|
||||
try {
|
||||
debugger;
|
||||
const msg = JSON.parse(message.data);
|
||||
SafariApp.sendMessageToListeners(msg, {
|
||||
id: 'app_message',
|
||||
|
|
|
@ -63,7 +63,7 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!isSafari && this.selectedProviderType === TwoFactorProviderType.Email &&
|
||||
if (this.selectedProviderType === TwoFactorProviderType.Email &&
|
||||
this.popupUtilsService.inPopup(window)) {
|
||||
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('popup2faCloseMessage'),
|
||||
null, this.i18nService.t('yes'), this.i18nService.t('no'));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<ng-container *ngIf="show">
|
||||
<ng-container>
|
||||
<button (click)="expand()" appA11yTitle="{{'popOutNewWindow' | i18n}}">
|
||||
<i class="fa fa-external-link fa-rotate-270 fa-lg fa-fw" aria-hidden="true"></i>
|
||||
</button>
|
||||
|
|
|
@ -22,8 +22,7 @@ export class PopOutComponent implements OnInit {
|
|||
|
||||
ngOnInit() {
|
||||
if (this.show) {
|
||||
this.show = !this.platformUtilsService.isSafari();
|
||||
if (this.show && this.popupUtilsService.inSidebar(window) && this.platformUtilsService.isFirefox()) {
|
||||
if (this.popupUtilsService.inSidebar(window) && this.platformUtilsService.isFirefox()) {
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<header>
|
||||
<div class="left" *ngIf="showLeftHeader">
|
||||
<div class="left">
|
||||
<app-pop-out [show]="!inSidebar"></app-pop-out>
|
||||
<button type="button" appBlurClick (click)="refresh()" appA11yTitle="{{'refresh' | i18n}}" *ngIf="inSidebar">
|
||||
<i class="fa fa-retweet fa-lg fa-fw" aria-hidden="true"></i>
|
||||
|
|
|
@ -49,7 +49,6 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
|||
hostname: string;
|
||||
searchText: string;
|
||||
inSidebar = false;
|
||||
showLeftHeader = false;
|
||||
searchTypeSearch = false;
|
||||
loaded = false;
|
||||
|
||||
|
@ -68,7 +67,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.showLeftHeader = this.searchTypeSearch = !this.platformUtilsService.isSafari();
|
||||
this.searchTypeSearch = !this.platformUtilsService.isSafari();
|
||||
this.inSidebar = this.popupUtilsService.inSidebar(window);
|
||||
|
||||
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<header>
|
||||
<div class="left" *ngIf="showLeftHeader">
|
||||
<div class="left">
|
||||
<app-pop-out></app-pop-out>
|
||||
</div>
|
||||
<div class="search">
|
||||
|
|
|
@ -92,8 +92,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
|||
|
||||
async ngOnInit() {
|
||||
this.searchTypeSearch = !this.platformUtilsService.isSafari();
|
||||
this.showLeftHeader = !this.platformUtilsService.isSafari() &&
|
||||
!(this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox());
|
||||
this.showLeftHeader = !(this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox());
|
||||
this.stateService.remove('CiphersComponent');
|
||||
|
||||
this.broadcasterService.subscribe(ComponentId, (message: any) => {
|
||||
|
|
Loading…
Reference in New Issue