Merge pull request #35 from lbryio/sdk-0.36-changes
replace claim_list_by_channel with claim_search
This commit is contained in:
commit
a8fd592c46
3 changed files with 93 additions and 92 deletions
16
dist/bundle.es.js
vendored
16
dist/bundle.es.js
vendored
|
@ -1544,18 +1544,20 @@ const doCheckSubscription = (subscriptionUri, shouldNotify) => (dispatch, getSta
|
||||||
|
|
||||||
if (!savedSubscription) {
|
if (!savedSubscription) {
|
||||||
throw Error(`Trying to find new content for ${subscriptionUri} but it doesn't exist in your subscriptions`);
|
throw Error(`Trying to find new content for ${subscriptionUri} but it doesn't exist in your subscriptions`);
|
||||||
} // We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
claimId
|
||||||
|
} = lbryRedux.parseURI(subscriptionUri); // We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
||||||
|
|
||||||
lbryRedux.Lbry.claim_list_by_channel({
|
lbryRedux.Lbry.claim_search({
|
||||||
uri: subscriptionUri,
|
channel_id: claimId,
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: PAGE_SIZE
|
page_size: PAGE_SIZE
|
||||||
}).then(claimListByChannel => {
|
}).then(result => {
|
||||||
const claimResult = claimListByChannel[subscriptionUri] || {};
|
|
||||||
const {
|
const {
|
||||||
claims_in_channel: claimsInChannel
|
items: claimsInChannel
|
||||||
} = claimResult; // may happen if subscribed to an abandoned channel or an empty channel
|
} = result; // may happen if subscribed to an abandoned channel or an empty channel
|
||||||
|
|
||||||
if (!claimsInChannel || !claimsInChannel.length) {
|
if (!claimsInChannel || !claimsInChannel.length) {
|
||||||
return;
|
return;
|
||||||
|
|
26
dist/bundle.js
vendored
26
dist/bundle.js
vendored
|
@ -2527,16 +2527,18 @@ var doCheckSubscription = function doCheckSubscription(subscriptionUri, shouldNo
|
||||||
|
|
||||||
if (!savedSubscription) {
|
if (!savedSubscription) {
|
||||||
throw Error("Trying to find new content for ".concat(subscriptionUri, " but it doesn't exist in your subscriptions"));
|
throw Error("Trying to find new content for ".concat(subscriptionUri, " but it doesn't exist in your subscriptions"));
|
||||||
} // We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
}
|
||||||
|
|
||||||
|
var _parseURI = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscriptionUri),
|
||||||
|
claimId = _parseURI.claimId; // We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
||||||
|
|
||||||
|
|
||||||
lbry_redux__WEBPACK_IMPORTED_MODULE_3__["Lbry"].claim_list_by_channel({
|
lbry_redux__WEBPACK_IMPORTED_MODULE_3__["Lbry"].claim_search({
|
||||||
uri: subscriptionUri,
|
channel_id: claimId,
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: constants_claim__WEBPACK_IMPORTED_MODULE_0__["PAGE_SIZE"]
|
page_size: constants_claim__WEBPACK_IMPORTED_MODULE_0__["PAGE_SIZE"]
|
||||||
}).then(function (claimListByChannel) {
|
}).then(function (result) {
|
||||||
var claimResult = claimListByChannel[subscriptionUri] || {};
|
var claimsInChannel = result.items; // may happen if subscribed to an abandoned channel or an empty channel
|
||||||
var claimsInChannel = claimResult.claims_in_channel; // may happen if subscribed to an abandoned channel or an empty channel
|
|
||||||
|
|
||||||
if (!claimsInChannel || !claimsInChannel.length) {
|
if (!claimsInChannel || !claimsInChannel.length) {
|
||||||
return;
|
return;
|
||||||
|
@ -2617,8 +2619,8 @@ var doChannelSubscribe = function doChannelSubscribe(subscription) {
|
||||||
}); // if the user isn't sharing data, keep the subscriptions entirely in the app
|
}); // if the user isn't sharing data, keep the subscriptions entirely in the app
|
||||||
|
|
||||||
if (isSharingData) {
|
if (isSharingData) {
|
||||||
var _parseURI = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscription.uri),
|
var _parseURI2 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscription.uri),
|
||||||
claimId = _parseURI.claimId; // They are sharing data, we can store their subscriptions in our internal database
|
claimId = _parseURI2.claimId; // They are sharing data, we can store their subscriptions in our internal database
|
||||||
|
|
||||||
|
|
||||||
lbryio__WEBPACK_IMPORTED_MODULE_6__["default"].call('subscription', 'new', {
|
lbryio__WEBPACK_IMPORTED_MODULE_6__["default"].call('subscription', 'new', {
|
||||||
|
@ -2645,8 +2647,8 @@ var doChannelUnsubscribe = function doChannelUnsubscribe(subscription) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isSharingData) {
|
if (isSharingData) {
|
||||||
var _parseURI2 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscription.uri),
|
var _parseURI3 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscription.uri),
|
||||||
claimId = _parseURI2.claimId;
|
claimId = _parseURI3.claimId;
|
||||||
|
|
||||||
lbryio__WEBPACK_IMPORTED_MODULE_6__["default"].call('subscription', 'delete', {
|
lbryio__WEBPACK_IMPORTED_MODULE_6__["default"].call('subscription', 'delete', {
|
||||||
claim_id: claimId
|
claim_id: claimId
|
||||||
|
@ -2699,8 +2701,8 @@ var doFetchMySubscriptions = function doFetchMySubscriptions() {
|
||||||
dbSubMap[sub.claim_id] = 1;
|
dbSubMap[sub.claim_id] = 1;
|
||||||
});
|
});
|
||||||
reduxSubscriptions.forEach(function (sub) {
|
reduxSubscriptions.forEach(function (sub) {
|
||||||
var _parseURI3 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(sub.uri),
|
var _parseURI4 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(sub.uri),
|
||||||
claimId = _parseURI3.claimId;
|
claimId = _parseURI4.claimId;
|
||||||
|
|
||||||
reduxSubMap[claimId] = 1;
|
reduxSubMap[claimId] = 1;
|
||||||
|
|
||||||
|
|
|
@ -156,11 +156,11 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { claimId } = parseURI(subscriptionUri);
|
||||||
|
|
||||||
// We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
// We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
||||||
Lbry.claim_list_by_channel({ uri: subscriptionUri, page: 1, page_size: PAGE_SIZE }).then(
|
Lbry.claim_search({ channel_id: claimId, page: 1, page_size: PAGE_SIZE }).then(result => {
|
||||||
claimListByChannel => {
|
const { items: claimsInChannel } = result;
|
||||||
const claimResult = claimListByChannel[subscriptionUri] || {};
|
|
||||||
const { claims_in_channel: claimsInChannel } = claimResult;
|
|
||||||
|
|
||||||
// may happen if subscribed to an abandoned channel or an empty channel
|
// may happen if subscribed to an abandoned channel or an empty channel
|
||||||
if (!claimsInChannel || !claimsInChannel.length) {
|
if (!claimsInChannel || !claimsInChannel.length) {
|
||||||
|
@ -185,9 +185,7 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
|
||||||
const uri = buildURI({ contentName: claim.name, claimId: claim.claim_id }, true);
|
const uri = buildURI({ contentName: claim.name, claimId: claim.claim_id }, true);
|
||||||
const shouldDownload =
|
const shouldDownload =
|
||||||
shouldAutoDownload &&
|
shouldAutoDownload &&
|
||||||
Boolean(
|
Boolean(downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee);
|
||||||
downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add the new content to the list of "un-read" subscriptions
|
// Add the new content to the list of "un-read" subscriptions
|
||||||
if (shouldNotify) {
|
if (shouldNotify) {
|
||||||
|
@ -240,8 +238,7 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
|
||||||
page: 1,
|
page: 1,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const doChannelSubscribe = (subscription: Subscription) => (
|
export const doChannelSubscribe = (subscription: Subscription) => (
|
||||||
|
|
Loading…
Reference in a new issue