Skip to content
Permalink
Browse files

Switch around setting the useragent when supported. Add popup window …

…flashtest
  • Loading branch information...
Thomas101 committed May 14, 2019
1 parent a589a47 commit d2ca1f6b0e8f29af48da2199f797f359993a3a8e
@@ -55,7 +55,9 @@ class AccountSessionManager extends EventEmitter {
const userState = userStore.getState()
if (userState.wireConfigLatestCVersion()) {
this[privActiveCVersion] = userState.wireConfigLatestCVersion()
app.userAgentFallback = this._replaceUAChromeVersion(app.userAgentFallback, this[privActiveCVersion])
if (app.userAgentFallback) {
app.userAgentFallback = this._replaceUAChromeVersion(app.userAgentFallback, this[privActiveCVersion])
}
}
userStore.listen(this.userStoreUpdated)

@@ -69,7 +71,9 @@ class AccountSessionManager extends EventEmitter {
userStoreUpdated = (userState) => {
if (userState.wireConfigLatestCVersion() !== this[privActiveCVersion]) {
this[privActiveCVersion] = userState.wireConfigLatestCVersion()
app.userAgentFallback = this._replaceUAChromeVersion(app.userAgentFallback, this[privActiveCVersion])
if (app.userAgentFallback) {
app.userAgentFallback = this._replaceUAChromeVersion(app.userAgentFallback, this[privActiveCVersion])
}

this[privManaged].forEach((partitionId) => {
const ses = session.fromPartition(partitionId)
@@ -1,11 +1,12 @@
import { ipcMain, BrowserWindow, webContents } from 'electron'
import { evtMain } from 'AppEvents'
import ContentWindow from 'Windows/ContentWindow'
import ContentPopupWindow from 'Windows/ContentPopupWindow'
import WaveboxWindow from 'Windows/WaveboxWindow'
import AuthWindow from 'Windows/AuthWindow'
import { accountStore } from 'stores/account'
import { WindowOpeningHandler } from '../WindowOpeningEngine'
import { WB_NEW_WINDOW, WB_FOCUS_AUTH_WINDOW } from 'shared/ipcEvents'
import { WB_NEW_WINDOW, WB_NEW_POPUP_WINDOW, WB_FOCUS_AUTH_WINDOW } from 'shared/ipcEvents'
import WINDOW_TYPES from '../WindowTypes'
import WINDOW_BACKING_TYPES from '../WindowBackingTypes'
import ElectronWebContentsWillNavigateShim from 'ElectronTools/ElectronWebContentsWillNavigateShim'
@@ -32,12 +33,14 @@ class MailboxesWindowBehaviour {

evtMain.on(evtMain.WB_TAB_CREATED, this.handleTabCreated)
ipcMain.on(WB_NEW_WINDOW, this.handleOpenIPCWaveboxWindow)
ipcMain.on(WB_NEW_POPUP_WINDOW, this.handleOpenIPCWaveboxPopupWindow)
ipcMain.on(WB_FOCUS_AUTH_WINDOW, this.handleIPCFocusAuthWindow)
}

destroy () {
evtMain.removeListener(evtMain.WB_TAB_CREATED, this.handleTabCreated)
ipcMain.removeListener(WB_NEW_WINDOW, this.handleOpenIPCWaveboxWindow)
ipcMain.removeListener(WB_NEW_POPUP_WINDOW, this.handleOpenIPCWaveboxPopupWindow)
ipcMain.removeListener(WB_FOCUS_AUTH_WINDOW, this.handleIPCFocusAuthWindow)
}

@@ -85,6 +88,24 @@ class MailboxesWindowBehaviour {
}
}

/**
* Opens a new content popup window
* @param evt: the event that fired
* @param body: the arguments from the body
*/
handleOpenIPCWaveboxPopupWindow = (evt, body) => {
if (evt.sender.id === this.webContentsId) {
const contentWindow = new ContentPopupWindow(body.mailboxId && body.serviceId ? {
backing: WINDOW_BACKING_TYPES.MAILBOX_SERVICE,
mailboxId: body.mailboxId,
serviceId: body.serviceId
} : undefined)

const window = BrowserWindow.fromWebContents(evt.sender)
contentWindow.create(body.url, body.windowPreferences, window, body.webPreferences)
}
}

/**
* Focuses an auth window
* @param evt: the event that fired
@@ -268,6 +268,7 @@ class DebugTests {
WB_SHOW_TRAY_WINDOWED,
WB_METRICS_OPEN_MONITOR,
WB_NEW_WINDOW,
WB_NEW_POPUP_WINDOW,
WB_KEYCHAIN_OPEN
} = require('shared/ipcEvents')
const {
@@ -307,6 +308,20 @@ class DebugTests {
console.warn(`${sig} Content Window:FAILED. Needs service`)
}

// Content popup window
console.log(`${sig} Content Popup Window`)
if (service) {
ipcRenderer.send(WB_NEW_POPUP_WINDOW, {
serviceId: service.id,
url: window.atob('aHR0cHM6Ly93YXZlYm94Lmlv'),
partition: service.partitionId,
webPreferences: { partition: service.partitionId }
})
console.log(`${sig} Content Popup Window:opened`)
} else {
console.warn(`${sig} Content Popup Window:FAILED. Needs service`)
}

// Content PDF
console.log(`${sig} PDF Print`)
if (service) {
@@ -17,6 +17,7 @@ module.exports = Object.freeze({

// Window Management
WB_NEW_WINDOW: 'WB_NEW_WINDOW',
WB_NEW_POPUP_WINDOW: 'WB_NEW_POPUP_WINDOW',
WB_FOCUS_AUTH_WINDOW: 'WB_FOCUS_AUTH_WINDOW',
WB_FOCUS_MAILBOXES_WINDOW: 'WB_FOCUS_MAILBOXES_WINDOW',
WB_USER_RECORD_NEXT_WINDOW_OPEN_EVENT: 'WB_USER_RECORD_NEXT_WINDOW_OPEN_EVENT',

0 comments on commit d2ca1f6

Please sign in to comment.
You can’t perform that action at this time.