handle new daemon status response #68

Merged
neb-b merged 1 commit from encryption into master 2018-08-15 20:38:39 +02:00
4 changed files with 11 additions and 21 deletions

18
dist/bundle.js vendored
View file

@ -1596,7 +1596,6 @@ var WALLET_LOCK_COMPLETED = exports.WALLET_LOCK_COMPLETED = 'WALLET_LOCK_COMPLET
var WALLET_LOCK_FAILED = exports.WALLET_LOCK_FAILED = 'WALLET_LOCK_FAILED'; var WALLET_LOCK_FAILED = exports.WALLET_LOCK_FAILED = 'WALLET_LOCK_FAILED';
var WALLET_STATUS_START = exports.WALLET_STATUS_START = 'WALLET_STATUS_START'; var WALLET_STATUS_START = exports.WALLET_STATUS_START = 'WALLET_STATUS_START';
var WALLET_STATUS_COMPLETED = exports.WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED'; var WALLET_STATUS_COMPLETED = exports.WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
var WALLET_STATUS_FAILED = exports.WALLET_STATUS_FAILED = 'WALLET_STATUS_FAILED';
// Claims // Claims
var FETCH_FEATURED_CONTENT_STARTED = exports.FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED'; var FETCH_FEATURED_CONTENT_STARTED = exports.FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
@ -4192,6 +4191,7 @@ var DEFAULTSEARCHRESULTFROM = 0;
var doSearch = exports.doSearch = function doSearch(rawQuery) { var doSearch = exports.doSearch = function doSearch(rawQuery) {
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULTSEARCHRESULTSIZE; var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULTSEARCHRESULTSIZE;
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULTSEARCHRESULTFROM; var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULTSEARCHRESULTFROM;
var isBackgroundSearch = arguments[3];
return function (dispatch, getState) { return function (dispatch, getState) {
var state = getState(); var state = getState();
var query = rawQuery.replace(/^lbry:\/\//i, ''); var query = rawQuery.replace(/^lbry:\/\//i, '');
@ -4216,7 +4216,8 @@ var doSearch = exports.doSearch = function doSearch(rawQuery) {
// If the user is on the file page with a pre-populated uri and they select // If the user is on the file page with a pre-populated uri and they select
// the search option without typing anything, searchQuery will be empty // the search option without typing anything, searchQuery will be empty
// We need to populate it so the input is filled on the search page // We need to populate it so the input is filled on the search page
if (!state.search.searchQuery) { // isBackgroundSearch means the search is happening in the background, don't update the search query
if (!state.search.searchQuery && !isBackgroundSearch) {
dispatch({ dispatch({
type: ACTIONS.UPDATE_SEARCH_QUERY, type: ACTIONS.UPDATE_SEARCH_QUERY,
data: { searchQuery: query } data: { searchQuery: query }
@ -4863,16 +4864,11 @@ function doWalletStatus() {
type: ACTIONS.WALLET_STATUS_START type: ACTIONS.WALLET_STATUS_START
}); });
_lbry2.default.status().then(function (result) { _lbry2.default.status().then(function (status) {
if (result && !result.error) { if (status && status.wallet) {
dispatch({ dispatch({
type: ACTIONS.WALLET_STATUS_COMPLETED, type: ACTIONS.WALLET_STATUS_COMPLETED,
result: result result: status.wallet.is_encrypted
});
} else {
dispatch({
type: ACTIONS.WALLET_STATUS_FAILED,
result: result
}); });
} }
}); });
@ -6231,7 +6227,7 @@ reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = function (state /*: WalletState*/, actio
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = function (state /*: WalletState*/, action) { reducers[ACTIONS.WALLET_STATUS_COMPLETED] = function (state /*: WalletState*/, action) {
return Object.assign({}, state, { return Object.assign({}, state, {
walletIsEncrypted: !!action.result.wallet_is_encrypted walletIsEncrypted: action.result
}); });
}; };

View file

@ -57,7 +57,6 @@ export const WALLET_LOCK_COMPLETED = 'WALLET_LOCK_COMPLETED';
export const WALLET_LOCK_FAILED = 'WALLET_LOCK_FAILED'; export const WALLET_LOCK_FAILED = 'WALLET_LOCK_FAILED';
export const WALLET_STATUS_START = 'WALLET_STATUS_START'; export const WALLET_STATUS_START = 'WALLET_STATUS_START';
export const WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED'; export const WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
export const WALLET_STATUS_FAILED = 'WALLET_STATUS_FAILED';
// Claims // Claims
export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED'; export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';

View file

@ -337,16 +337,11 @@ export function doWalletStatus() {
type: ACTIONS.WALLET_STATUS_START, type: ACTIONS.WALLET_STATUS_START,
}); });
Lbry.status().then(result => { Lbry.status().then(status => {
if (result && !result.error) { if (status && status.wallet) {
dispatch({ dispatch({
type: ACTIONS.WALLET_STATUS_COMPLETED, type: ACTIONS.WALLET_STATUS_COMPLETED,
result, result: status.wallet.is_encrypted,
});
} else {
dispatch({
type: ACTIONS.WALLET_STATUS_FAILED,
result,
}); });
} }
}); });

View file

@ -188,7 +188,7 @@ reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = (state: WalletState, action) => {
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = (state: WalletState, action) => reducers[ACTIONS.WALLET_STATUS_COMPLETED] = (state: WalletState, action) =>
Object.assign({}, state, { Object.assign({}, state, {
walletIsEncrypted: !!action.result.wallet_is_encrypted, walletIsEncrypted: action.result,
}); });
reducers[ACTIONS.WALLET_ENCRYPT_START] = (state: WalletState) => reducers[ACTIONS.WALLET_ENCRYPT_START] = (state: WalletState) =>