cleanup
This commit is contained in:
parent
76b5547323
commit
6ac727e19e
2 changed files with 24 additions and 61 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
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';
|
import FileListPublished from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -8,7 +9,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
|
checkPendingPublishes: () => dispatch(doCheckPendingPublishesApp()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -4,23 +4,22 @@ import {
|
||||||
batchActions,
|
batchActions,
|
||||||
// selectPendingById,
|
// selectPendingById,
|
||||||
doError,
|
doError,
|
||||||
selectMyClaimsWithoutChannels,
|
selectMyClaims,
|
||||||
doPublish,
|
doPublish,
|
||||||
// doCheckPendingPublishes,
|
doCheckPendingPublishes,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import * as ACTIONS from 'constants/action_types';
|
import * as ACTIONS from 'constants/action_types';
|
||||||
// import { selectosNotificationsEnabled } from 'redux/selectors/settings';
|
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
|
||||||
// import { push } from 'connected-react-router';
|
import { push } from 'connected-react-router';
|
||||||
// import analytics from 'analytics';
|
import analytics from 'analytics';
|
||||||
// import { formatLbryUriForWeb } from 'util/uri';
|
import { formatLbryUriForWeb } from 'util/uri';
|
||||||
import analytics from '../../analytics';
|
|
||||||
import { doOpenModal } from './app';
|
import { doOpenModal } from './app';
|
||||||
|
|
||||||
export const doPublishDesktop = () => (dispatch: Dispatch, getState: () => {}) => {
|
export const doPublishDesktop = () => (dispatch: Dispatch, getState: () => {}) => {
|
||||||
const publishSuccess = successResponse => {
|
const publishSuccess = successResponse => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
analytics.apiLogPublish();
|
analytics.apiLogPublish();
|
||||||
const myClaims = selectMyClaimsWithoutChannels(state);
|
const myClaims = selectMyClaims(state);
|
||||||
const pendingClaim = successResponse.outputs[0];
|
const pendingClaim = successResponse.outputs[0];
|
||||||
const uri = pendingClaim.permanent_url;
|
const uri = pendingClaim.permanent_url;
|
||||||
const actions = [];
|
const actions = [];
|
||||||
|
@ -58,54 +57,17 @@ export const doPublishDesktop = () => (dispatch: Dispatch, getState: () => {}) =
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calls claim_list_mine until any pending publishes are confirmed
|
// Calls claim_list_mine until any pending publishes are confirmed
|
||||||
export const doCheckPendingPublishesApp = () => (dispatch: Dispatch, getState: GetState) => {};
|
export const doCheckPendingPublishesApp = () => (dispatch: Dispatch, getState: GetState) => {
|
||||||
|
const onConfirmed = claim => {
|
||||||
// export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => {
|
if (selectosNotificationsEnabled(getState())) {
|
||||||
// const state = getState();
|
const notif = new window.Notification('LBRY Publish Complete', {
|
||||||
// const pendingById = selectPendingById(state);
|
body: `${claim.value.title} has been published to lbry://${claim.name}. Click here to view it`,
|
||||||
//
|
silent: false,
|
||||||
// if (!Object.keys(pendingById).length) {
|
});
|
||||||
// return;
|
notif.onclick = () => {
|
||||||
// }
|
dispatch(push(formatLbryUriForWeb(claim.permanent_url)));
|
||||||
//
|
};
|
||||||
// let publishCheckInterval;
|
}
|
||||||
//
|
};
|
||||||
// const checkFileList = () => {
|
return dispatch(doCheckPendingPublishes(onConfirmed));
|
||||||
// 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);
|
|
||||||
// };
|
|
||||||
|
|
Loading…
Reference in a new issue