Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Removes unused ui data and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Aug 13, 2017
1 parent c67ce90 commit 36d9141
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 87 deletions.
1 change: 0 additions & 1 deletion app/browser/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ const api = {
updateWindowDebounce(windowId)
})
win.on('focus', () => {
appActions.windowFocused(windowId)
updateWindowDebounce(windowId)
})
win.on('show', () => {
Expand Down
3 changes: 0 additions & 3 deletions app/renderer/components/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,12 @@ class Main extends React.Component {

window.addEventListener('focus', () => {
windowActions.setFocusedFrame(this.props.location, this.props.tabId)
windowActions.onFocus(getCurrentWindowId())
// For whatever reason other elements are preserved but webviews are not.
if (document.activeElement && document.activeElement.tagName === 'BODY') {
webviewActions.setWebviewFocused()
}
}, { passive: true })

windowActions.onFocus(getCurrentWindowId())

// disable dnd by default
window.addEventListener('dragover', function (event) {
Expand Down Expand Up @@ -470,7 +468,6 @@ class Main extends React.Component {
const self = this
window.onblur = () => {
self.resetAltMenuProcessing()
windowActions.onBlur(getCurrentWindowId())
}
}

Expand Down
5 changes: 2 additions & 3 deletions app/renderer/components/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const appActions = require('../../../js/actions/appActions')
// Utils
const cx = require('../../../js/lib/classSet')
const {getPlatformStyles} = require('../../common/lib/platformUtil')
const {isFocused} = require('../currentWindow')

window.appActions = appActions

Expand All @@ -38,10 +39,8 @@ class Window extends React.Component {
}

mergeProps (state, ownProps) {
const currentWindow = state.get('currentWindow')

const props = {}
props.isFocused = currentWindow.getIn(['ui', 'isFocused'])
props.isFocused = isFocused()

return props
}
Expand Down
1 change: 0 additions & 1 deletion app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ module.exports.cleanPerWindowData = (immutablePerWindowData, isShutdown) => {
'braveryPanelDetail',
// Don't restore drag data and clearBrowsingDataPanel's visibility
// This is no longer stored, we can remove this line eventually
['ui', 'isFocused'],
['ui', 'mouseInTitlebar'],
['ui', 'mouseInFrame'],
['ui', 'dragging'],
Expand Down
12 changes: 0 additions & 12 deletions js/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,18 +637,6 @@ const appActions = {
})
},

/**
* Dispatches a message when windowId gains focus
*
* @param {Number} windowId - the unique id of the window
*/
windowFocused: function (windowId) {
dispatch({
actionType: appConstants.APP_WINDOW_FOCUSED,
windowId: windowId
})
},

/**
* Saves current menubar template for use w/ Windows titlebar
* @param {Object} menubarTemplate - JSON used to build the menu
Expand Down
42 changes: 0 additions & 42 deletions js/actions/windowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1077,20 +1077,6 @@ const windowActions = {
})
},

onMaximize: function (windowId) {
dispatch({
actionType: windowConstants.WINDOW_ON_MAXIMIZE,
windowId
})
},

onMinimize: function (windowId) {
dispatch({
actionType: windowConstants.WINDOW_ON_MINIMIZE,
windowId
})
},

// TODO(bridiver) - refactor these as declarative
shouldSetTitle: function (windowId, title) {
dispatch({
Expand Down Expand Up @@ -1135,34 +1121,6 @@ const windowActions = {
})
},

onFocus: function (windowId) {
dispatch({
actionType: windowConstants.WINDOW_ON_FOCUS,
windowId
})
},

onBlur: function (windowId) {
dispatch({
actionType: windowConstants.WINDOW_ON_BLUR,
windowId
})
},

onEnterFullScreen: function (windowId) {
dispatch({
actionType: windowConstants.WINDOW_ON_ENTER_FULL_SCREEN,
windowId
})
},

onExitFullScreen: function (windowId) {
dispatch({
actionType: windowConstants.WINDOW_ON_EXIT_FULL_SCREEN,
windowId
})
},

onLongBackHistory: function (history, left, top, partition, tabId, windowId) {
dispatch({
actionType: windowConstants.WINDOW_ON_GO_BACK_LONG,
Expand Down
1 change: 0 additions & 1 deletion js/constants/appConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const appConstants = {
APP_SET_LOGIN_REQUIRED_DETAIL: _,
APP_SET_LOGIN_RESPONSE_DETAIL: _,
APP_WINDOW_BLURRED: _,
APP_WINDOW_FOCUSED: _,
APP_IDLE_STATE_CHANGED: _,
APP_NETWORK_CONNECTED: _,
APP_NETWORK_DISCONNECTED: _,
Expand Down
6 changes: 0 additions & 6 deletions js/constants/windowConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ const windowConstants = {
WINDOW_TAB_MOUSE_LEAVE: _,
WINDOW_FRAME_MOUSE_ENTER: _,
WINDOW_FRAME_MOUSE_LEAVE: _,
WINDOW_ON_MAXIMIZE: _,
WINDOW_ON_MINIMIZE: _,
WINDOW_ON_FOCUS: _,
WINDOW_ON_BLUR: _,
WINDOW_ON_ENTER_FULL_SCREEN: _,
WINDOW_ON_EXIT_FULL_SCREEN: _,
WINDOW_SHOULD_SET_TITLE: _,
WINDOW_SHOULD_MINIMIZE: _,
WINDOW_SHOULD_MAXIMIZE: _,
Expand Down
18 changes: 0 additions & 18 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,24 +785,6 @@ const doAction = (action) => {
case windowConstants.WINDOW_FRAME_MOUSE_LEAVE:
windowState = windowState.setIn(['ui', 'mouseInFrame'], false)
break
case windowConstants.WINDOW_ON_MAXIMIZE:
windowState = windowState.setIn(['ui', 'isMaximized'], true)
break
case windowConstants.WINDOW_ON_MINIMIZE:
windowState = windowState.setIn(['ui', 'isMaximized'], false)
break
case windowConstants.WINDOW_ON_FOCUS:
windowState = windowState.setIn(['ui', 'isFocused'], true)
break
case windowConstants.WINDOW_ON_BLUR:
windowState = windowState.setIn(['ui', 'isFocused'], false)
break
case windowConstants.WINDOW_ON_ENTER_FULL_SCREEN:
windowState = windowState.setIn(['ui', 'isFullScreen'], true)
break
case windowConstants.WINDOW_ON_EXIT_FULL_SCREEN:
windowState = windowState.setIn(['ui', 'isFullScreen'], false)
break
case windowConstants.WINDOW_ON_CERT_ERROR:
{
const frame = frameStateUtil.getFrameByTabId(windowState, action.tabId) || Immutable.Map()
Expand Down

0 comments on commit 36d9141

Please sign in to comment.