Browse Source

Merge pull request #489 from gre/remove-touchbar

remove touchbar feature. reconsider post mvp
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
34b3153aba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/components/layout/Default.js
  2. 74
      src/main/app.js

7
src/components/layout/Default.js

@ -2,7 +2,6 @@
import React, { Fragment, Component } from 'react'
import { compose } from 'redux'
import { ipcRenderer } from 'electron'
import styled from 'styled-components'
import { Route, withRouter } from 'react-router'
import { translate } from 'react-i18next'
@ -39,12 +38,6 @@ class Default extends Component<Props> {
window.requestAnimationFrame(() => (this._timeout = setTimeout(() => window.onAppReady(), 300)))
}
componentWillReceiveProps(nextProps: Props) {
if (process.platform === 'darwin' && nextProps.location !== this.props.location) {
ipcRenderer.send('touch-bar-update', { clear: true })
}
}
componentDidUpdate(prevProps) {
if (this.props.location !== prevProps.location) {
if (this._scrollContainer) {

74
src/main/app.js

@ -1,15 +1,11 @@
// @flow
import { app, BrowserWindow, Menu, screen, TouchBar, ipcMain } from 'electron'
import { app, BrowserWindow, Menu, screen } from 'electron'
import debounce from 'lodash/debounce'
import menu from 'main/menu'
import db from 'helpers/db'
import { MODAL_RECEIVE, MODAL_SEND } from 'config/constants'
const { TouchBarButton, TouchBarGroup, TouchBarLabel } = TouchBar
// necessary to prevent win from being garbage collected
let mainWindow = null
@ -59,70 +55,6 @@ const saveWindowSettings = window => {
)
}
function configureTouchBar(w) {
const defaultItems = [
new TouchBarButton({
label: 'Send funds',
click: () =>
w.webContents.send('msg', {
type: 'dispatch',
data: { type: 'MODAL_OPEN', payload: { name: MODAL_SEND } },
}),
}),
new TouchBarButton({
label: 'Receive funds',
click: () =>
w.webContents.send('msg', {
type: 'dispatch',
data: { type: 'MODAL_OPEN', payload: { name: MODAL_RECEIVE } },
}),
}),
]
w.setTouchBar(new TouchBar(defaultItems))
ipcMain.on('touch-bar-update', (e, d) => {
if (d.clear) {
w.setTouchBar(new TouchBar(defaultItems))
return
}
const items = [
new TouchBarLabel({
textColor: d.color,
label: d.text,
}),
]
if (d.balance.currency) {
items.push(
new TouchBarLabel({
textColor: d.color,
label: d.balance.currency,
}),
)
}
if (d.balance.counterValue) {
items.push(
new TouchBarLabel({
textColor: d.color,
label: d.balance.counterValue,
}),
)
}
w.setTouchBar(
new TouchBar([
...defaultItems,
new TouchBarGroup({
items,
}),
]),
)
})
}
const defaultWindowOptions = {
backgroundColor: '#fff',
webPreferences: {
@ -191,10 +123,6 @@ function createMainWindow() {
})
})
if (process.platform === 'darwin') {
configureTouchBar(window)
}
return window
}

Loading…
Cancel
Save