diff --git a/dist/bundle.es.js b/dist/bundle.es.js index f0971da..8c62092 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -4370,8 +4370,10 @@ const doPrepareEdit = (claim, uri, fileInfo, fs) => dispatch => { dispatch({ type: DO_PREPARE_EDIT, data: publishData }); }; -const doPublish = (success, fail) => (dispatch, getState) => { - dispatch({ type: PUBLISH_START }); +const doPublish = (success, fail, preview) => (dispatch, getState) => { + if (!preview) { + dispatch({ type: PUBLISH_START }); + } const state = getState(); const myClaimForUri = selectMyClaimForUri(state); @@ -4428,7 +4430,8 @@ const doPublish = (success, fail) => (dispatch, getState) => { languages: [language], tags: tags && tags.map(tag => tag.name), thumbnail_url: thumbnail, - blocking: true + blocking: true, + preview: false }; // Temporary solution to keep the same publish flow with the new tags api // Eventually we will allow users to enter their own tags on publish @@ -4480,6 +4483,15 @@ const doPublish = (success, fail) => (dispatch, getState) => { // The sdk will figure it out if (filePath) publishPayload.file_path = filePath; + if (preview) { + publishPayload.preview = true; + publishPayload.optimize_file = false; + + return lbryProxy.publish(publishPayload).then(previewResponse => { + return preview(previewResponse); + }, fail); + } + return lbryProxy.publish(publishPayload).then(response => { if (!useLBRYUploader) { return success(response); diff --git a/src/redux/actions/publish.js b/src/redux/actions/publish.js index 09b1e6a..2467438 100644 --- a/src/redux/actions/publish.js +++ b/src/redux/actions/publish.js @@ -230,11 +230,13 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, fileInfo: FileLis dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData }); }; -export const doPublish = (success: Function, fail: Function) => ( +export const doPublish = (success: Function, fail: Function, preview: Function) => ( dispatch: Dispatch, getState: () => {} ) => { - dispatch({ type: ACTIONS.PUBLISH_START }); + if (!preview) { + dispatch({ type: ACTIONS.PUBLISH_START }); + } const state = getState(); const myClaimForUri = selectMyClaimForUri(state); @@ -302,6 +304,7 @@ export const doPublish = (success: Function, fail: Function) => ( locations?: Array, blocking: boolean, optimize_file?: boolean, + preview?: boolean, } = { name, title, @@ -312,6 +315,7 @@ export const doPublish = (success: Function, fail: Function) => ( tags: tags && tags.map(tag => tag.name), thumbnail_url: thumbnail, blocking: true, + preview: false, }; // Temporary solution to keep the same publish flow with the new tags api // Eventually we will allow users to enter their own tags on publish @@ -363,6 +367,15 @@ export const doPublish = (success: Function, fail: Function) => ( // The sdk will figure it out if (filePath) publishPayload.file_path = filePath; + if (preview) { + publishPayload.preview = true; + publishPayload.optimize_file = false; + + return Lbry.publish(publishPayload).then((previewResponse: PublishResponse) => { + return preview(previewResponse); + }, fail); + } + return Lbry.publish(publishPayload).then((response: PublishResponse) => { if (!useLBRYUploader) { return success(response);