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