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) {
|
||||
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({
|
||||
uri: subscriptionUri,
|
||||
lbryRedux.Lbry.claim_search({
|
||||
channel_id: claimId,
|
||||
page: 1,
|
||||
page_size: PAGE_SIZE
|
||||
}).then(claimListByChannel => {
|
||||
const claimResult = claimListByChannel[subscriptionUri] || {};
|
||||
}).then(result => {
|
||||
const {
|
||||
claims_in_channel: claimsInChannel
|
||||
} = claimResult; // may happen if subscribed to an abandoned channel or an empty channel
|
||||
items: claimsInChannel
|
||||
} = result; // may happen if subscribed to an abandoned channel or an empty channel
|
||||
|
||||
if (!claimsInChannel || !claimsInChannel.length) {
|
||||
return;
|
||||
|
|
26
dist/bundle.js
vendored
26
dist/bundle.js
vendored
|
@ -2527,16 +2527,18 @@ var doCheckSubscription = function doCheckSubscription(subscriptionUri, shouldNo
|
|||
|
||||
if (!savedSubscription) {
|
||||
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({
|
||||
uri: subscriptionUri,
|
||||
lbry_redux__WEBPACK_IMPORTED_MODULE_3__["Lbry"].claim_search({
|
||||
channel_id: claimId,
|
||||
page: 1,
|
||||
page_size: constants_claim__WEBPACK_IMPORTED_MODULE_0__["PAGE_SIZE"]
|
||||
}).then(function (claimListByChannel) {
|
||||
var claimResult = claimListByChannel[subscriptionUri] || {};
|
||||
var claimsInChannel = claimResult.claims_in_channel; // may happen if subscribed to an abandoned channel or an empty channel
|
||||
}).then(function (result) {
|
||||
var claimsInChannel = result.items; // may happen if subscribed to an abandoned channel or an empty channel
|
||||
|
||||
if (!claimsInChannel || !claimsInChannel.length) {
|
||||
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 (isSharingData) {
|
||||
var _parseURI = 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
|
||||
var _parseURI2 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscription.uri),
|
||||
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', {
|
||||
|
@ -2645,8 +2647,8 @@ var doChannelUnsubscribe = function doChannelUnsubscribe(subscription) {
|
|||
});
|
||||
|
||||
if (isSharingData) {
|
||||
var _parseURI2 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscription.uri),
|
||||
claimId = _parseURI2.claimId;
|
||||
var _parseURI3 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(subscription.uri),
|
||||
claimId = _parseURI3.claimId;
|
||||
|
||||
lbryio__WEBPACK_IMPORTED_MODULE_6__["default"].call('subscription', 'delete', {
|
||||
claim_id: claimId
|
||||
|
@ -2699,8 +2701,8 @@ var doFetchMySubscriptions = function doFetchMySubscriptions() {
|
|||
dbSubMap[sub.claim_id] = 1;
|
||||
});
|
||||
reduxSubscriptions.forEach(function (sub) {
|
||||
var _parseURI3 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(sub.uri),
|
||||
claimId = _parseURI3.claimId;
|
||||
var _parseURI4 = Object(lbry_redux__WEBPACK_IMPORTED_MODULE_3__["parseURI"])(sub.uri),
|
||||
claimId = _parseURI4.claimId;
|
||||
|
||||
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?
|
||||
Lbry.claim_list_by_channel({ uri: subscriptionUri, page: 1, page_size: PAGE_SIZE }).then(
|
||||
claimListByChannel => {
|
||||
const claimResult = claimListByChannel[subscriptionUri] || {};
|
||||
const { claims_in_channel: claimsInChannel } = claimResult;
|
||||
Lbry.claim_search({ channel_id: claimId, page: 1, page_size: PAGE_SIZE }).then(result => {
|
||||
const { items: claimsInChannel } = result;
|
||||
|
||||
// may happen if subscribed to an abandoned channel or an empty channel
|
||||
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 shouldDownload =
|
||||
shouldAutoDownload &&
|
||||
Boolean(
|
||||
downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee
|
||||
);
|
||||
Boolean(downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee);
|
||||
|
||||
// Add the new content to the list of "un-read" subscriptions
|
||||
if (shouldNotify) {
|
||||
|
@ -240,8 +238,7 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
|
|||
page: 1,
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const doChannelSubscribe = (subscription: Subscription) => (
|
||||
|
|
Loading…
Reference in a new issue