1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

adjustments for edge 18 workarounds

This commit is contained in:
Kyle Spearrin 2018-10-03 08:26:46 -04:00
parent adb3dc78ee
commit 815ef17d02
6 changed files with 27 additions and 14 deletions

View File

@ -6,7 +6,6 @@ export class BrowserApi {
static isFirefoxOnAndroid: boolean = navigator.userAgent.indexOf('Firefox/') !== -1 && static isFirefoxOnAndroid: boolean = navigator.userAgent.indexOf('Firefox/') !== -1 &&
navigator.userAgent.indexOf('Android') !== -1; navigator.userAgent.indexOf('Android') !== -1;
static isEdge18: boolean = navigator.userAgent.indexOf(' Edge/18.') !== -1; static isEdge18: boolean = navigator.userAgent.indexOf(' Edge/18.') !== -1;
static backgroundPageCache: any = null;
static async getTabFromCurrentWindowId(): Promise<any> { static async getTabFromCurrentWindowId(): Promise<any> {
if (BrowserApi.isChromeApi) { if (BrowserApi.isChromeApi) {
@ -135,12 +134,7 @@ export class BrowserApi {
} }
static getBackgroundPage(): any { static getBackgroundPage(): any {
if (BrowserApi.isEdge18) { if (BrowserApi.isChromeApi) {
if (BrowserApi.backgroundPageCache == null) {
BrowserApi.backgroundPageCache = browser.extension.getBackgroundPage();
}
return BrowserApi.backgroundPageCache;
} else if (BrowserApi.isChromeApi) {
return chrome.extension.getBackgroundPage(); return chrome.extension.getBackgroundPage();
} else if (BrowserApi.isSafariApi) { } else if (BrowserApi.isSafariApi) {
return safari.extension.globalPage.contentWindow; return safari.extension.globalPage.contentWindow;

View File

@ -138,7 +138,7 @@ export class AppComponent implements OnInit {
} }
getState(outlet: RouterOutlet) { getState(outlet: RouterOutlet) {
return outlet.activatedRouteData.state; return BrowserApi.isEdge18 ? null : outlet.activatedRouteData.state;
} }
private async recordActivity() { private async recordActivity() {

View File

@ -56,8 +56,8 @@ export class PopOutComponent implements OnInit {
chrome.windows.create({ chrome.windows.create({
url: href, url: href,
type: 'popup', type: 'popup',
width: bodyRect.width + 60, width: bodyRect.width ? bodyRect.width + 60 : 375,
height: bodyRect.height, height: bodyRect.height || 600,
}); });
if (this.popupUtilsService.inPopup(window)) { if (this.popupUtilsService.inPopup(window)) {

View File

@ -329,6 +329,12 @@ header {
} }
} }
} }
&.tabs-3 {
ul li {
width: 33.33%;
}
}
} }
app-root { app-root {

View File

@ -1,8 +1,8 @@
<div class="tab-page"> <div class="tab-page">
<router-outlet></router-outlet> <router-outlet></router-outlet>
<nav class="tabs"> <nav class="tabs" [ngClass]="{'tabs-3': !showCurrentTab}">
<ul> <ul>
<li routerLinkActive="active"> <li routerLinkActive="active" *ngIf="showCurrentTab">
<a routerLink="current" title="{{'currentTab' | i18n}}"> <a routerLink="current" title="{{'currentTab' | i18n}}">
<i class="fa fa-folder fa-2x"></i>{{'tab' | i18n}} <i class="fa fa-folder fa-2x"></i>{{'tab' | i18n}}
</a> </a>

View File

@ -1,7 +1,20 @@
import { Component } from '@angular/core'; import {
Component,
OnInit,
} from '@angular/core';
import { PopupUtilsService } from './services/popup-utils.service';
@Component({ @Component({
selector: 'app-tabs', selector: 'app-tabs',
templateUrl: 'tabs.component.html', templateUrl: 'tabs.component.html',
}) })
export class TabsComponent { } export class TabsComponent implements OnInit {
showCurrentTab: boolean = true;
constructor(private popupUtilsService: PopupUtilsService) { }
ngOnInit() {
this.showCurrentTab = !this.popupUtilsService.inPopout(window);
}
}