Redux #115

Merged
6ea86b96 merged 57 commits from redux into redux 2017-05-05 22:55:12 +02:00
4 changed files with 16 additions and 6 deletions
Showing only changes of commit fb3d366fe0 - Show all commits

View file

@ -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({

View file

@ -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'

View file

@ -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,