resolve subscribe uris before calling claim_list_mine for quick navigation and remove duplicate call for featured
This commit is contained in:
parent
75228bcd89
commit
9e5f82c7ae
2 changed files with 33 additions and 57 deletions
|
@ -4,12 +4,7 @@ import path from 'path';
|
|||
import { ipcRenderer, remote } from 'electron';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import {
|
||||
Lbry,
|
||||
doBalanceSubscribe,
|
||||
doFetchFileInfosAndPublishedClaims,
|
||||
selectNotification,
|
||||
} from 'lbry-redux';
|
||||
import { Lbry, doBalanceSubscribe, doFetchFileInfosAndPublishedClaims, doError } from 'lbry-redux';
|
||||
import Native from 'native';
|
||||
import { doFetchDaemonSettings } from 'redux/actions/settings';
|
||||
import { doAuthNavigate } from 'redux/actions/navigation';
|
||||
|
@ -23,8 +18,9 @@ import {
|
|||
selectAutoUpdateDeclined,
|
||||
selectRemoteVersion,
|
||||
selectUpgradeTimer,
|
||||
selectModal,
|
||||
} from 'redux/selectors/app';
|
||||
import { doAuthenticate, doFetchRewardedContent } from 'lbryinc';
|
||||
import { doAuthenticate } from 'lbryinc';
|
||||
import { lbrySettings as config, version as appVersion } from 'package.json';
|
||||
|
||||
const { autoUpdater } = remote.require('electron-updater');
|
||||
|
@ -33,6 +29,22 @@ const Fs = remote.require('fs');
|
|||
|
||||
const CHECK_UPGRADE_INTERVAL = 10 * 60 * 1000;
|
||||
|
||||
export function doOpenModal(id, modalProps = {}) {
|
||||
return {
|
||||
type: ACTIONS.SHOW_MODAL,
|
||||
data: {
|
||||
id,
|
||||
modalProps,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function doHideModal() {
|
||||
return {
|
||||
type: ACTIONS.HIDE_MODAL,
|
||||
};
|
||||
}
|
||||
|
||||
export function doUpdateDownloadProgress(percent) {
|
||||
return {
|
||||
type: ACTIONS.UPGRADE_DOWNLOAD_PROGRESSED,
|
||||
|
@ -88,9 +100,7 @@ export function doDownloadUpgrade() {
|
|||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||
});
|
||||
dispatch(doHideModal());
|
||||
dispatch(
|
||||
doOpenModal(MODALS.DOWNLOADING)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.DOWNLOADING));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -109,15 +119,11 @@ export function doDownloadUpgradeRequested() {
|
|||
// electron-updater behavior
|
||||
if (autoUpdateDeclined) {
|
||||
// The user declined an update before, so show the "confirm" dialog
|
||||
dispatch(
|
||||
doOpenModal(MODALS.AUTO_UPDATE_CONFIRM)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.AUTO_UPDATE_CONFIRM));
|
||||
} else {
|
||||
// The user was never shown the original update dialog (e.g. because they were
|
||||
// watching a video). So show the inital "update downloaded" dialog.
|
||||
dispatch(
|
||||
doOpenModal(MODALS.AUTO_UPDATE_DOWNLOADED)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.AUTO_UPDATE_DOWNLOADED));
|
||||
}
|
||||
} else {
|
||||
// Old behavior for Linux
|
||||
|
@ -145,9 +151,7 @@ export function doAutoUpdate() {
|
|||
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
|
||||
});
|
||||
|
||||
dispatch(
|
||||
doOpenModal(MODALS.AUTO_UPDATE_DOWNLOADED)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.AUTO_UPDATE_DOWNLOADED));
|
||||
|
||||
dispatch(doClearUpgradeTimer());
|
||||
};
|
||||
|
@ -216,12 +220,10 @@ export function doCheckUpgradeAvailable() {
|
|||
|
||||
if (
|
||||
upgradeAvailable &&
|
||||
!selectNotification(state) &&
|
||||
!selectModal(state) &&
|
||||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
||||
) {
|
||||
dispatch(
|
||||
doOpenModal(MODALS.UPGRADE)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.UPGRADE));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -266,42 +268,32 @@ export function doCheckDaemonVersion() {
|
|||
type: ACTIONS.DAEMON_VERSION_MISMATCH,
|
||||
});
|
||||
|
||||
return dispatch(
|
||||
doOpenModal(MODALS.INCOMPATIBLE_DAEMON)
|
||||
);
|
||||
return dispatch(doOpenModal(MODALS.INCOMPATIBLE_DAEMON));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doNotifyEncryptWallet() {
|
||||
return dispatch => {
|
||||
dispatch(
|
||||
doOpenModal(MODALS.WALLET_ENCRYPT)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.WALLET_ENCRYPT));
|
||||
};
|
||||
}
|
||||
|
||||
export function doNotifyDecryptWallet() {
|
||||
return dispatch => {
|
||||
dispatch(
|
||||
doOpenModal(MODALS.WALLET_DECRYPT)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.WALLET_DECRYPT));
|
||||
};
|
||||
}
|
||||
|
||||
export function doNotifyUnlockWallet() {
|
||||
return dispatch => {
|
||||
dispatch(
|
||||
doOpenModal(MODALS.WALLET_UNLOCK)
|
||||
);
|
||||
dispatch(doOpenModal(MODALS.WALLET_UNLOCK));
|
||||
};
|
||||
}
|
||||
|
||||
export function doAlertError(errorList) {
|
||||
return dispatch => {
|
||||
dispatch(
|
||||
doError(errorList)
|
||||
);
|
||||
dispatch(doError(errorList));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -314,7 +306,6 @@ export function doDaemonReady() {
|
|||
dispatch(doFetchDaemonSettings());
|
||||
dispatch(doBalanceSubscribe());
|
||||
dispatch(doFetchFileInfosAndPublishedClaims());
|
||||
dispatch(doFetchRewardedContent());
|
||||
if (!selectIsUpgradeSkipped(state)) {
|
||||
dispatch(doCheckUpgradeAvailable());
|
||||
}
|
||||
|
@ -373,26 +364,10 @@ export function doClickCommentButton() {
|
|||
export function doConditionalAuthNavigate(newSession) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const notification = selectNotification(state);
|
||||
const notification = selectModal(state);
|
||||
|
||||
if (newSession || (notification && notification.id !== 'email_collection')) {
|
||||
dispatch(doAuthNavigate());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function doOpenModal(id, modalProps = {}) {
|
||||
return {
|
||||
type: ACTIONS.SHOW_MODAL,
|
||||
data: {
|
||||
id,
|
||||
modalProps,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function doHideModal() {
|
||||
return {
|
||||
type: ACTIONS.HIDE_MODAL
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import * as NOTIFICATION_TYPES from 'constants/subscriptions';
|
|||
import { Lbryio, rewards, doClaimRewardType } from 'lbryinc';
|
||||
import { selectSubscriptions, selectUnreadByChannel } from 'redux/selectors/subscriptions';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { Lbry, buildURI, parseURI } from 'lbry-redux';
|
||||
import { Lbry, buildURI, parseURI, doResolveUris } from 'lbry-redux';
|
||||
import { doPurchaseUri, doFetchClaimsByChannel } from 'redux/actions/content';
|
||||
import Promise from 'bluebird';
|
||||
|
||||
|
@ -101,6 +101,7 @@ export const doFetchMySubscriptions = () => (dispatch: ReduxDispatch, getState:
|
|||
data: subscriptions,
|
||||
});
|
||||
|
||||
dispatch(doResolveUris(subscriptions.map(({ uri }) => uri)));
|
||||
subscriptions.forEach(({ uri }) => dispatch(doFetchClaimsByChannel(uri, 1)));
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
Loading…
Reference in a new issue