Fix upgrading and start on history
This commit is contained in:
parent
89e91c6d8a
commit
fb3d366fe0
4 changed files with 16 additions and 6 deletions
|
@ -6,6 +6,7 @@ import {
|
||||||
selectUpgradeDownloadItem,
|
selectUpgradeDownloadItem,
|
||||||
selectUpgradeFilename,
|
selectUpgradeFilename,
|
||||||
selectPageTitle,
|
selectPageTitle,
|
||||||
|
selectCurrentPath,
|
||||||
} from 'selectors/app'
|
} from 'selectors/app'
|
||||||
|
|
||||||
const {remote, ipcRenderer, shell} = require('electron');
|
const {remote, ipcRenderer, shell} = require('electron');
|
||||||
|
@ -16,6 +17,11 @@ const fs = remote.require('fs');
|
||||||
|
|
||||||
export function doNavigate(path) {
|
export function doNavigate(path) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
|
const state = getState()
|
||||||
|
const previousPath = selectCurrentPath(state)
|
||||||
|
const previousTitle = selectPageTitle(state)
|
||||||
|
history.pushState(state, previousTitle, previousPath);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.NAVIGATE,
|
type: types.NAVIGATE,
|
||||||
data: {
|
data: {
|
||||||
|
@ -23,8 +29,8 @@ export function doNavigate(path) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const state = getState()
|
|
||||||
const pageTitle = selectPageTitle(state)
|
const pageTitle = selectPageTitle(state)
|
||||||
|
|
||||||
window.document.title = pageTitle
|
window.document.title = pageTitle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,8 +54,12 @@ export function doCloseModal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doHistoryBack() {
|
export function doHistoryBack() {
|
||||||
return {
|
return function(dispatch, getState) {
|
||||||
type: types.HISTORY_BACK
|
if (window.history.length > 1) {
|
||||||
|
window.history.back();
|
||||||
|
} else {
|
||||||
|
dispatch(doNavigate('discover'))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +162,7 @@ export function doCheckUpgradeAvailable() {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.UPDATE_VERSION,
|
type: types.UPDATE_VERSION,
|
||||||
data: {
|
data: {
|
||||||
version: versionInfo.lbrynet_version
|
version: remoteVersion,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import lbry from 'lbry'
|
||||||
import {
|
import {
|
||||||
connect
|
connect
|
||||||
} from 'react-redux'
|
} from 'react-redux'
|
||||||
|
|
|
@ -8,7 +8,7 @@ export const Header = (props) => {
|
||||||
back,
|
back,
|
||||||
navigate
|
navigate
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
return <header id="header">
|
return <header id="header">
|
||||||
<div className="header__item">
|
<div className="header__item">
|
||||||
<Link onClick={back} button="alt button--flat" icon="icon-arrow-left" />
|
<Link onClick={back} button="alt button--flat" icon="icon-arrow-left" />
|
||||||
|
|
|
@ -8,7 +8,6 @@ const defaultState = {
|
||||||
platform: process.platform,
|
platform: process.platform,
|
||||||
upgradeSkipped: sessionStorage.getItem('upgradeSkipped'),
|
upgradeSkipped: sessionStorage.getItem('upgradeSkipped'),
|
||||||
daemonReady: false,
|
daemonReady: false,
|
||||||
platform: window.navigator.platform,
|
|
||||||
obscureNsfw: !lbry.getClientSetting('showNsfw'),
|
obscureNsfw: !lbry.getClientSetting('showNsfw'),
|
||||||
hidePrice: false,
|
hidePrice: false,
|
||||||
hasSignature: false,
|
hasSignature: false,
|
||||||
|
|
Loading…
Reference in a new issue