This commit is contained in:
jessop 2019-07-12 22:59:45 -04:00 committed by Sean Yesmunt
parent 76b5547323
commit 6ac727e19e
2 changed files with 24 additions and 61 deletions

View file

@ -1,5 +1,6 @@
import { connect } from 'react-redux';
import { selectIsFetchingClaimListMine, selectMyClaimUrisWithoutChannels, doCheckPendingPublishes } from 'lbry-redux';
import { selectIsFetchingClaimListMine, selectMyClaimUrisWithoutChannels } from 'lbry-redux';
import { doCheckPendingPublishesApp } from 'redux/actions/publish';
import FileListPublished from './view';
const select = state => ({
@ -8,7 +9,7 @@ const select = state => ({
});
const perform = dispatch => ({
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
checkPendingPublishes: () => dispatch(doCheckPendingPublishesApp()),
});
export default connect(

View file

@ -4,23 +4,22 @@ import {
batchActions,
// selectPendingById,
doError,
selectMyClaimsWithoutChannels,
selectMyClaims,
doPublish,
// doCheckPendingPublishes,
doCheckPendingPublishes,
} from 'lbry-redux';
import * as ACTIONS from 'constants/action_types';
// import { selectosNotificationsEnabled } from 'redux/selectors/settings';
// import { push } from 'connected-react-router';
// import analytics from 'analytics';
// import { formatLbryUriForWeb } from 'util/uri';
import analytics from '../../analytics';
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
import { push } from 'connected-react-router';
import analytics from 'analytics';
import { formatLbryUriForWeb } from 'util/uri';
import { doOpenModal } from './app';
export const doPublishDesktop = () => (dispatch: Dispatch, getState: () => {}) => {
const publishSuccess = successResponse => {
const state = getState();
analytics.apiLogPublish();
const myClaims = selectMyClaimsWithoutChannels(state);
const myClaims = selectMyClaims(state);
const pendingClaim = successResponse.outputs[0];
const uri = pendingClaim.permanent_url;
const actions = [];
@ -58,54 +57,17 @@ export const doPublishDesktop = () => (dispatch: Dispatch, getState: () => {}) =
};
// Calls claim_list_mine until any pending publishes are confirmed
export const doCheckPendingPublishesApp = () => (dispatch: Dispatch, getState: GetState) => {};
// export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => {
// const state = getState();
// const pendingById = selectPendingById(state);
//
// if (!Object.keys(pendingById).length) {
// return;
// }
//
// let publishCheckInterval;
//
// const checkFileList = () => {
// Lbry.claim_list().then(claims => {
// if (claims) {
// claims.forEach(claim => {
// // If it's confirmed, check if it was pending previously
// if (claim.confirmations > 0 && pendingById[claim.claim_id]) {
// delete pendingById[claim.claim_id];
//
// // If it's confirmed, check if we should notify the user
// if (selectosNotificationsEnabled(getState())) {
// const notif = new window.Notification('LBRY Publish Complete', {
// body: `${claim.value.title} has been published to lbry://${claim.name}. Click here to view it`,
// silent: false,
// });
// notif.onclick = () => {
// dispatch(push(formatLbryUriForWeb(claim.permanent_url)));
// };
// }
// }
// });
// }
//
// dispatch({
// type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
// data: {
// claims,
// },
// });
//
// if (!Object.keys(pendingById).length) {
// clearInterval(publishCheckInterval);
// }
// });
// };
//
// publishCheckInterval = setInterval(() => {
// checkFileList();
// }, 30000);
// };
export const doCheckPendingPublishesApp = () => (dispatch: Dispatch, getState: GetState) => {
const onConfirmed = claim => {
if (selectosNotificationsEnabled(getState())) {
const notif = new window.Notification('LBRY Publish Complete', {
body: `${claim.value.title} has been published to lbry://${claim.name}. Click here to view it`,
silent: false,
});
notif.onclick = () => {
dispatch(push(formatLbryUriForWeb(claim.permanent_url)));
};
}
};
return dispatch(doCheckPendingPublishes(onConfirmed));
};