Merge branch 'master' of github.com:lbryio/lbry-app
This commit is contained in:
commit
eb3f1086a2
10 changed files with 53 additions and 36 deletions
|
@ -243,3 +243,11 @@ export function doRemoveSnackBarSnack() {
|
||||||
type: types.REMOVE_SNACKBAR_SNACK,
|
type: types.REMOVE_SNACKBAR_SNACK,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doClearCache() {
|
||||||
|
return function(dispatch, getState) {
|
||||||
|
window.cacheStore.purge();
|
||||||
|
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -44,16 +44,6 @@ export function doResolveUri(uri) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doCancelResolveUri(uri) {
|
|
||||||
return function(dispatch, getState) {
|
|
||||||
lbry.cancelResolve({ uri });
|
|
||||||
dispatch({
|
|
||||||
type: types.RESOLVE_URI_CANCELED,
|
|
||||||
data: { uri },
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function doFetchFeaturedUris() {
|
export function doFetchFeaturedUris() {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { doNavigate } from "actions/app";
|
import { doNavigate } from "actions/app";
|
||||||
import { doResolveUri, doCancelResolveUri } from "actions/content";
|
import { doResolveUri } from "actions/content";
|
||||||
import { selectObscureNsfw } from "selectors/app";
|
import { selectObscureNsfw } from "selectors/app";
|
||||||
import {
|
import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
|
@ -31,7 +31,6 @@ const makeSelect = () => {
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
cancelResolveUri: uri => dispatch(doCancelResolveUri(uri)),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(FileCard);
|
export default connect(makeSelect, perform)(FileCard);
|
||||||
|
|
|
@ -23,14 +23,6 @@ class FileCard extends React.PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
const { isResolvingUri, cancelResolveUri, uri } = this.props;
|
|
||||||
|
|
||||||
if (isResolvingUri) {
|
|
||||||
cancelResolveUri(uri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleMouseOver() {
|
handleMouseOver() {
|
||||||
this.setState({
|
this.setState({
|
||||||
hovered: true,
|
hovered: true,
|
||||||
|
@ -47,13 +39,11 @@ class FileCard extends React.PureComponent {
|
||||||
const { claim, fileInfo, metadata, isResolvingUri, navigate } = this.props;
|
const { claim, fileInfo, metadata, isResolvingUri, navigate } = this.props;
|
||||||
|
|
||||||
const uri = lbryuri.normalize(this.props.uri);
|
const uri = lbryuri.normalize(this.props.uri);
|
||||||
const title = !isResolvingUri && metadata && metadata.title
|
const title = metadata && metadata.title ? metadata.title : uri;
|
||||||
? metadata.title
|
|
||||||
: uri;
|
|
||||||
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
||||||
|
|
||||||
let description = "";
|
let description = "";
|
||||||
if (isResolvingUri) {
|
if (isResolvingUri && !claim) {
|
||||||
description = __("Loading...");
|
description = __("Loading...");
|
||||||
} else if (metadata && metadata.description) {
|
} else if (metadata && metadata.description) {
|
||||||
description = metadata.description;
|
description = metadata.description;
|
||||||
|
|
|
@ -21,7 +21,7 @@ class UriIndicator extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
const { claim, uri, isResolvingUri } = this.props;
|
const { claim, uri, isResolvingUri } = this.props;
|
||||||
|
|
||||||
if (isResolvingUri) {
|
if (isResolvingUri && !claim) {
|
||||||
return <span className="empty">Validating...</span>;
|
return <span className="empty">Validating...</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ export const FETCH_FEATURED_CONTENT_COMPLETED =
|
||||||
"FETCH_FEATURED_CONTENT_COMPLETED";
|
"FETCH_FEATURED_CONTENT_COMPLETED";
|
||||||
export const RESOLVE_URI_STARTED = "RESOLVE_URI_STARTED";
|
export const RESOLVE_URI_STARTED = "RESOLVE_URI_STARTED";
|
||||||
export const RESOLVE_URI_COMPLETED = "RESOLVE_URI_COMPLETED";
|
export const RESOLVE_URI_COMPLETED = "RESOLVE_URI_COMPLETED";
|
||||||
export const RESOLVE_URI_CANCELED = "RESOLVE_URI_CANCELED";
|
|
||||||
export const FETCH_CHANNEL_CLAIMS_STARTED = "FETCH_CHANNEL_CLAIMS_STARTED";
|
export const FETCH_CHANNEL_CLAIMS_STARTED = "FETCH_CHANNEL_CLAIMS_STARTED";
|
||||||
export const FETCH_CHANNEL_CLAIMS_COMPLETED = "FETCH_CHANNEL_CLAIMS_COMPLETED";
|
export const FETCH_CHANNEL_CLAIMS_COMPLETED = "FETCH_CHANNEL_CLAIMS_COMPLETED";
|
||||||
export const FETCH_CLAIM_LIST_MINE_STARTED = "FETCH_CLAIM_LIST_MINE_STARTED";
|
export const FETCH_CLAIM_LIST_MINE_STARTED = "FETCH_CLAIM_LIST_MINE_STARTED";
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { doClearCache } from "actions/app";
|
||||||
import { doSetDaemonSetting } from "actions/settings";
|
import { doSetDaemonSetting } from "actions/settings";
|
||||||
import { selectDaemonSettings } from "selectors/settings";
|
import { selectDaemonSettings } from "selectors/settings";
|
||||||
import SettingsPage from "./view";
|
import SettingsPage from "./view";
|
||||||
|
@ -10,6 +11,7 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||||
|
clearCache: () => dispatch(doClearCache()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(SettingsPage);
|
export default connect(select, perform)(SettingsPage);
|
||||||
|
|
|
@ -2,6 +2,9 @@ import React from "react";
|
||||||
import { FormField, FormRow } from "component/form.js";
|
import { FormField, FormRow } from "component/form.js";
|
||||||
import SubHeader from "component/subHeader";
|
import SubHeader from "component/subHeader";
|
||||||
import lbry from "lbry.js";
|
import lbry from "lbry.js";
|
||||||
|
import Link from "component/link";
|
||||||
|
|
||||||
|
const { remote } = require("electron");
|
||||||
|
|
||||||
class SettingsPage extends React.PureComponent {
|
class SettingsPage extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -15,9 +18,23 @@ class SettingsPage extends React.PureComponent {
|
||||||
showNsfw: lbry.getClientSetting("showNsfw"),
|
showNsfw: lbry.getClientSetting("showNsfw"),
|
||||||
showUnavailable: lbry.getClientSetting("showUnavailable"),
|
showUnavailable: lbry.getClientSetting("showUnavailable"),
|
||||||
language: lbry.getClientSetting("language"),
|
language: lbry.getClientSetting("language"),
|
||||||
|
clearingCache: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearCache() {
|
||||||
|
this.setState({
|
||||||
|
clearingCache: true,
|
||||||
|
});
|
||||||
|
const success = () => {
|
||||||
|
this.setState({ clearingCache: false });
|
||||||
|
window.location.href = `${remote.app.getAppPath()}/dist/index.html`;
|
||||||
|
};
|
||||||
|
const clear = () => this.props.clearCache().then(success.bind(this));
|
||||||
|
|
||||||
|
setTimeout(clear, 1000, { once: true });
|
||||||
|
}
|
||||||
|
|
||||||
setDaemonSetting(name, value) {
|
setDaemonSetting(name, value) {
|
||||||
this.props.setDaemonSetting(name, value);
|
this.props.setDaemonSetting(name, value);
|
||||||
}
|
}
|
||||||
|
@ -274,6 +291,27 @@ class SettingsPage extends React.PureComponent {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section className="card">
|
||||||
|
<div className="card__content">
|
||||||
|
<h3>{__("Application Cache")}</h3>
|
||||||
|
</div>
|
||||||
|
<div className="card__content">
|
||||||
|
<p>
|
||||||
|
<Link
|
||||||
|
label={
|
||||||
|
this.state.clearingCache
|
||||||
|
? __("Clearing")
|
||||||
|
: __("Clear the cache")
|
||||||
|
}
|
||||||
|
icon="icon-trash"
|
||||||
|
button="alt"
|
||||||
|
onClick={this.clearCache.bind(this)}
|
||||||
|
disabled={this.state.clearingCache}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,15 +26,6 @@ reducers[types.RESOLVE_URI_COMPLETED] = function(state, action) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[types.RESOLVE_URI_CANCELED] = function(state, action) {
|
|
||||||
const uri = action.data.uri;
|
|
||||||
const newClaims = Object.assign({}, state.claimsByUri);
|
|
||||||
delete newClaims[uri];
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
claimsByUri: newClaims,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers[types.FETCH_CLAIM_LIST_MINE_STARTED] = function(state, action) {
|
reducers[types.FETCH_CLAIM_LIST_MINE_STARTED] = function(state, action) {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
isClaimListMinePending: true,
|
isClaimListMinePending: true,
|
||||||
|
|
|
@ -100,6 +100,6 @@ const persistOptions = {
|
||||||
debounce: 1000,
|
debounce: 1000,
|
||||||
storage: localForage,
|
storage: localForage,
|
||||||
};
|
};
|
||||||
persistStore(reduxStore, persistOptions);
|
window.cacheStore = persistStore(reduxStore, persistOptions);
|
||||||
|
|
||||||
export default reduxStore;
|
export default reduxStore;
|
||||||
|
|
Loading…
Reference in a new issue