diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-01-15 15:53:55 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-01-15 15:53:55 +0100 |
| commit | c3933d569efe1196b9814abffe3ea7f00491df02 (patch) | |
| tree | f13df8ad96640e570b364b823ab769a5fa1b3fd3 | |
| parent | 3cb1cb236bf049822b1e28a6007a23f4c49bce15 (diff) | |
| parent | c5700162a5e86682e4246257a1446bd2cf1524b9 (diff) | |
| download | mullvadvpn-c3933d569efe1196b9814abffe3ea7f00491df02.tar.xz mullvadvpn-c3933d569efe1196b9814abffe3ea7f00491df02.zip | |
Merge branch 'logging-xp'
| -rw-r--r-- | app/app.js | 2 | ||||
| -rw-r--r-- | app/containers/AccountPage.js | 4 | ||||
| -rw-r--r-- | app/containers/AdvancedSettingsPage.js | 2 | ||||
| -rw-r--r-- | app/containers/ConnectPage.js | 4 | ||||
| -rw-r--r-- | app/containers/LoginPage.js | 4 | ||||
| -rw-r--r-- | app/containers/SelectLocationPage.js | 2 | ||||
| -rw-r--r-- | app/containers/SettingsPage.js | 4 | ||||
| -rw-r--r-- | app/containers/SupportPage.js | 6 | ||||
| -rw-r--r-- | app/lib/backend.js | 2 | ||||
| -rw-r--r-- | app/lib/jsonrpc-ws-ipc.js | 2 | ||||
| -rw-r--r-- | app/lib/platform.android.js | 14 | ||||
| -rw-r--r-- | app/lib/platform.js | 14 | ||||
| -rw-r--r-- | app/main.js | 2 |
13 files changed, 37 insertions, 25 deletions
diff --git a/app/app.js b/app/app.js index 3a9d6c0294..6e9272e88b 100644 --- a/app/app.js +++ b/app/app.js @@ -6,7 +6,7 @@ import { Provider } from 'react-redux'; import { ConnectedRouter } from 'react-router-redux'; import { createMemoryHistory } from 'history'; import { webFrame, ipcRenderer } from 'electron'; -import log from 'electron-log'; +import { log } from './lib/platform'; import makeRoutes from './routes'; import configureStore from './redux/store'; import { Backend, BackendError } from './lib/backend'; diff --git a/app/containers/AccountPage.js b/app/containers/AccountPage.js index 4ef7de5d83..d4fdf92b3a 100644 --- a/app/containers/AccountPage.js +++ b/app/containers/AccountPage.js @@ -6,7 +6,7 @@ import { push } from 'react-router-redux'; import Account from '../components/Account'; import accountActions from '../redux/account/actions'; import { links } from '../config'; -import { open } from '../lib/platform'; +import { openLink } from '../lib/platform'; import type { ReduxState, ReduxDispatch } from '../redux/store'; import type { SharedRouteProps } from '../routes'; @@ -22,7 +22,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => onClose: () => { pushHistory('/settings'); }, - onBuyMore: () => open(links['purchase']) + onBuyMore: () => openLink(links['purchase']) }; }; diff --git a/app/containers/AdvancedSettingsPage.js b/app/containers/AdvancedSettingsPage.js index 6f456abcea..a1ca7d5a66 100644 --- a/app/containers/AdvancedSettingsPage.js +++ b/app/containers/AdvancedSettingsPage.js @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { push } from 'react-router-redux'; import { AdvancedSettings } from '../components/AdvancedSettings'; import RelaySettingsBuilder from '../lib/relay-settings-builder'; -import log from 'electron-log'; +import { log } from '../lib/platform'; import type { ReduxState, ReduxDispatch } from '../redux/store'; import type { SharedRouteProps } from '../routes'; diff --git a/app/containers/ConnectPage.js b/app/containers/ConnectPage.js index 6bcfc40cfe..d9f3bd81e7 100644 --- a/app/containers/ConnectPage.js +++ b/app/containers/ConnectPage.js @@ -6,7 +6,7 @@ import { push } from 'react-router-redux'; import { links } from '../config'; import Connect from '../components/Connect'; import connectActions from '../redux/connection/actions'; -import { open } from '../lib/platform'; +import { openLink } from '../lib/platform'; import type { ReduxState, ReduxDispatch } from '../redux/store'; import type { SharedRouteProps } from '../routes'; @@ -40,7 +40,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => onDisconnect: () => { disconnect(backend); }, - onExternalLink: (type) => open(links[type]), + onExternalLink: (type) => openLink(links[type]), }; }; diff --git a/app/containers/LoginPage.js b/app/containers/LoginPage.js index bf1a7fdc70..52fac166fa 100644 --- a/app/containers/LoginPage.js +++ b/app/containers/LoginPage.js @@ -6,7 +6,7 @@ import { push } from 'react-router-redux'; import Login from '../components/Login'; import accountActions from '../redux/account/actions'; import { links } from '../config'; -import { open } from '../lib/platform'; +import { openLink } from '../lib/platform'; import type { ReduxState, ReduxDispatch } from '../redux/store'; import type { SharedRouteProps } from '../routes'; @@ -26,7 +26,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => onFirstChangeAfterFailure: () => { resetLoginError(); }, - onExternalLink: (type) => open(links[type]), + onExternalLink: (type) => openLink(links[type]), onAccountTokenChange: (token) => { updateAccountToken(token); }, diff --git a/app/containers/SelectLocationPage.js b/app/containers/SelectLocationPage.js index ae06ec7fd6..b5e12eb4ef 100644 --- a/app/containers/SelectLocationPage.js +++ b/app/containers/SelectLocationPage.js @@ -5,7 +5,7 @@ import { bindActionCreators } from 'redux'; import { push } from 'react-router-redux'; import SelectLocation from '../components/SelectLocation'; import RelaySettingsBuilder from '../lib/relay-settings-builder'; -import log from 'electron-log'; +import { log } from '../lib/platform'; import type { ReduxState, ReduxDispatch } from '../redux/store'; import type { SharedRouteProps } from '../routes'; diff --git a/app/containers/SettingsPage.js b/app/containers/SettingsPage.js index bfe30ee566..3612b099b5 100644 --- a/app/containers/SettingsPage.js +++ b/app/containers/SettingsPage.js @@ -5,7 +5,7 @@ import { bindActionCreators } from 'redux'; import { push } from 'react-router-redux'; import Settings from '../components/Settings'; import { links } from '../config'; -import { open, exit } from '../lib/platform'; +import { openLink, exit } from '../lib/platform'; import type { ReduxState, ReduxDispatch } from '../redux/store'; import type { SharedRouteProps } from '../routes'; @@ -20,7 +20,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, _props: SharedRouteProps) = onViewSupport: () => pushHistory('/settings/support'), onViewPreferences: () => pushHistory('/settings/preferences'), onViewAdvancedSettings: () => pushHistory('/settings/advanced'), - onExternalLink: (type) => open(links[type]), + onExternalLink: (type) => openLink(links[type]), }; }; diff --git a/app/containers/SupportPage.js b/app/containers/SupportPage.js index d482c94637..1681ffd943 100644 --- a/app/containers/SupportPage.js +++ b/app/containers/SupportPage.js @@ -1,7 +1,7 @@ // @flow -import log from 'electron-log'; -import { shell, ipcRenderer } from 'electron'; +import { log, openItem } from '../lib/platform'; +import { ipcRenderer } from 'electron'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { push } from 'react-router-redux'; @@ -59,7 +59,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, _props: SharedRouteProps) = }); }, - onViewLog: (path) => shell.openItem(path), + onViewLog: (path) => openItem(path), onSend: (email, message, savedReport) => { diff --git a/app/lib/backend.js b/app/lib/backend.js index 62babdf4b6..cd14adb045 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -1,6 +1,6 @@ // @flow -import log from 'electron-log'; +import { log } from '../lib/platform'; import EventEmitter from 'events'; import { IpcFacade, RealIpc } from './ipc-facade'; import accountActions from '../redux/account/actions'; diff --git a/app/lib/jsonrpc-ws-ipc.js b/app/lib/jsonrpc-ws-ipc.js index 909b4b0775..002a146606 100644 --- a/app/lib/jsonrpc-ws-ipc.js +++ b/app/lib/jsonrpc-ws-ipc.js @@ -2,7 +2,7 @@ import jsonrpc from 'jsonrpc-lite'; import uuid from 'uuid'; -import log from 'electron-log'; +import { log } from '../lib/platform'; export type UnansweredRequest = { resolve: (mixed) => void, diff --git a/app/lib/platform.android.js b/app/lib/platform.android.js index d7bd39b867..fe7fd533f2 100644 --- a/app/lib/platform.android.js +++ b/app/lib/platform.android.js @@ -1,13 +1,19 @@ // @flow -import { BackHandler } from 'react-native'; -import { Linking } from 'react-native'; +import { BackHandler, Linking } from 'react-native'; +import { MobileAppBridge } from 'NativeModules'; + +const log = console.log; const exit = () => { BackHandler.exitApp(); }; -const open = (link: string) => { +const openLink = (link: string) => { Linking.openURL(link); }; -export {exit, open}; +const openItem = (path: string) => { + MobileAppBridge.openItem(path); +}; + +export { log, exit, openLink, openItem }; diff --git a/app/lib/platform.js b/app/lib/platform.js index 66e5a099ba..2b078b8bb6 100644 --- a/app/lib/platform.js +++ b/app/lib/platform.js @@ -1,13 +1,19 @@ // @flow -import { remote } from 'electron'; -import { shell } from 'electron'; +import { remote, shell } from 'electron'; +import electronLog from 'electron-log'; + +const log = electronLog; const exit = () => { remote.app.quit(); }; -const open = (link: string) => { +const openLink = (link: string) => { shell.openExternal(link); }; -export {exit, open}; +const openItem = (path: string) => { + shell.openItem(path); +}; + +export { log, exit, openLink, openItem }; diff --git a/app/main.js b/app/main.js index b2612de4d9..f754f71634 100644 --- a/app/main.js +++ b/app/main.js @@ -2,7 +2,7 @@ import path from 'path'; import fs from 'fs'; import mkdirp from 'mkdirp'; -import log from 'electron-log'; +import { log } from './lib/platform'; import { app, BrowserWindow, ipcMain, Tray, Menu, nativeImage } from 'electron'; import TrayIconManager from './lib/tray-icon-manager'; import ElectronSudo from 'electron-sudo'; |
