sync transfer and import

This commit is contained in:
jessop 2019-09-16 15:10:48 -04:00 committed by Sean Yesmunt
parent afdba5fd5d
commit 1890985bec
4 changed files with 76 additions and 0 deletions

21
dist/bundle.es.js vendored
View file

@ -1365,6 +1365,26 @@ function doUserInviteNew(email) {
});
};
}
function doClaimYoutubeChannels() {
return dispatch => {
lbryRedux.Lbry.address_unused().then(address => // add dispatch started here
Lbryio.call('yt', 'transfer', {
address
}).then(response => {
if (response && response.length) {
Promise.all(response.map(channelMeta => {
if (channelMeta && channelMeta.channel && channelMeta.channel.transferable) {
return lbryRedux.Lbry.channel_import({
channel_data: channelMeta.channel.channel_certificate
});
}
return null;
})).then(() => dispatch(doUserFetch())); // update the channel data the form uses
}
})).catch(e => console.error('Transfering channels failed', e));
};
}
function doRewardList() {
return dispatch => {
@ -2924,6 +2944,7 @@ exports.doCheckSync = doCheckSync;
exports.doClaimEligiblePurchaseRewards = doClaimEligiblePurchaseRewards;
exports.doClaimRewardClearError = doClaimRewardClearError;
exports.doClaimRewardType = doClaimRewardType;
exports.doClaimYoutubeChannels = doClaimYoutubeChannels;
exports.doCompleteFirstRun = doCompleteFirstRun;
exports.doFetchAccessToken = doFetchAccessToken;
exports.doFetchCostInfoForUri = doFetchCostInfoForUri;

30
dist/bundle.js vendored
View file

@ -196,6 +196,8 @@ __webpack_require__.r(__webpack_exports__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doUserInviteNew", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_8__["doUserInviteNew"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClaimYoutubeChannels", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_8__["doClaimYoutubeChannels"]; });
/* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(22);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_9__["doFetchCostInfoForUri"]; });
@ -2405,6 +2407,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchAccessToken", function() { return doFetchAccessToken; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserIdentityVerify", function() { return doUserIdentityVerify; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserInviteNew", function() { return doUserInviteNew; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClaimYoutubeChannels", function() { return doClaimYoutubeChannels; });
/* harmony import */ var lbry_redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/* harmony import */ var lbry_redux__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lbry_redux__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var redux_actions_rewards__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
@ -2806,6 +2809,33 @@ function doUserInviteNew(email) {
});
};
}
function doClaimYoutubeChannels() {
return function (dispatch) {
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].address_unused().then(function (address) {
return (// add dispatch started here
lbryio__WEBPACK_IMPORTED_MODULE_4__["default"].call('yt', 'transfer', {
address: address
}).then(function (response) {
if (response && response.length) {
Promise.all(response.map(function (channelMeta) {
if (channelMeta && channelMeta.channel && channelMeta.channel.transferable) {
return lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].channel_import({
channel_data: channelMeta.channel.channel_certificate
});
}
return null;
})).then(function () {
return dispatch(doUserFetch());
}); // update the channel data the form uses
}
})
);
})["catch"](function (e) {
return console.error('Transfering channels failed', e);
});
};
}
/***/ }),
/* 20 */

View file

@ -57,6 +57,7 @@ export {
doUserResendVerificationEmail,
doUserIdentityVerify,
doUserInviteNew,
doClaimYoutubeChannels,
} from 'redux/actions/user';
export { doFetchCostInfoForUri } from 'redux/actions/cost_info';
export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist';

View file

@ -382,3 +382,27 @@ export function doUserInviteNew(email) {
});
};
}
export function doClaimYoutubeChannels() {
return dispatch => {
Lbry.address_unused()
.then(address =>
// add dispatch started here
Lbryio.call('yt', 'transfer', { address }).then(response => {
if (response && response.length) {
Promise.all(
response.map(channelMeta => {
if (channelMeta && channelMeta.channel && channelMeta.channel.transferable) {
return Lbry.channel_import({
channel_data: channelMeta.channel.channel_certificate,
});
}
return null;
})
).then(() => dispatch(doUserFetch())); // update the channel data the form uses
}
})
)
.catch(e => console.error('Transfering channels failed', e));
};
}