From a878d3bdd4f028b3d52b7d8333d306beb254a90a Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Wed, 31 Mar 2021 02:58:54 +0200 Subject: [PATCH] Pass has_source parameter to claim_search to ignore livestreamings --- .../ui/channel/ChannelContentFragment.java | 3 ++- .../ui/findcontent/AllContentFragment.java | 3 ++- .../ui/findcontent/EditorsChoiceFragment.java | 3 ++- .../ui/findcontent/FollowingFragment.java | 6 ++++-- .../ui/findcontent/ShuffleFragment.java | 3 ++- .../main/java/io/lbry/browser/utils/Lbry.java | 20 ++++++++++++++----- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java index 19d0043a..756c9d1f 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelContentFragment.java @@ -230,7 +230,8 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi 0, 0, currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage, - Helper.CONTENT_PAGE_SIZE); + Helper.CONTENT_PAGE_SIZE, + true); } private List getContentSortOrder() { diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java index df62198e..353fefae 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java @@ -421,7 +421,8 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi 0, 0, currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage, - Helper.CONTENT_PAGE_SIZE); + Helper.CONTENT_PAGE_SIZE, + true); } private List getContentSortOrder() { diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/EditorsChoiceFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/EditorsChoiceFragment.java index 2a041e11..8026f0bf 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/EditorsChoiceFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/EditorsChoiceFragment.java @@ -79,7 +79,8 @@ public class EditorsChoiceFragment extends BaseFragment { Arrays.asList(Claim.ORDER_BY_RELEASE_TIME), null, 1, - 99); + 99, + true); } public void onResume() { diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java index cc89d882..e3111820 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java @@ -415,7 +415,8 @@ public class FollowingFragment extends BaseFragment implements Arrays.asList(Claim.ORDER_BY_EFFECTIVE_AMOUNT), null, currentSuggestedPage == 0 ? 1 : currentSuggestedPage, - SUGGESTED_PAGE_SIZE); + SUGGESTED_PAGE_SIZE, + true); } private Map buildContentOptions() { @@ -437,7 +438,8 @@ public class FollowingFragment extends BaseFragment implements 0, 0, currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage, - Helper.CONTENT_PAGE_SIZE); + Helper.CONTENT_PAGE_SIZE, + true); } private List getChannelIds() { diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java index 0d980c4e..8650ec0a 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java @@ -210,7 +210,8 @@ public class ShuffleFragment extends BaseFragment { 121, // 2 minutes or less 1, currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage, - PAGE_SIZE); + PAGE_SIZE, + true); } public void onStart() { diff --git a/app/src/main/java/io/lbry/browser/utils/Lbry.java b/app/src/main/java/io/lbry/browser/utils/Lbry.java index b727948f..39381dc4 100644 --- a/app/src/main/java/io/lbry/browser/utils/Lbry.java +++ b/app/src/main/java/io/lbry/browser/utils/Lbry.java @@ -373,7 +373,7 @@ public final class Lbry { // build claim search for surf mode public static Map buildClaimSearchOptions( - String claimType, List notTags, List channelIds, List orderBy, long maxDuration, int limitClaimsPerChannel, int page, int pageSize) { + String claimType, List notTags, List channelIds, List orderBy, long maxDuration, int limitClaimsPerChannel, int page, int pageSize, boolean hasSource) { return buildClaimSearchOptions( Collections.singletonList(claimType), null, @@ -385,7 +385,8 @@ public final class Lbry { maxDuration, limitClaimsPerChannel, page, - pageSize); + pageSize, + hasSource); } public static Map buildClaimSearchOptions( @@ -397,7 +398,8 @@ public final class Lbry { List orderBy, String releaseTime, int page, - int pageSize) { + int pageSize, + boolean hasSource) { return buildClaimSearchOptions( Collections.singletonList(claimType), anyTags, @@ -409,7 +411,8 @@ public final class Lbry { 0, 0, page, - pageSize); + pageSize, + hasSource); } public static Map buildClaimSearchOptions( @@ -423,7 +426,8 @@ public final class Lbry { long maxDuration, int limitClaimsPerChannel, int page, - int pageSize) { + int pageSize, + boolean hasSource) { Map options = new HashMap<>(); if (claimType != null && claimType.size() > 0) { options.put("claim_type", claimType); @@ -441,6 +445,12 @@ public final class Lbry { options.put("limit_claims_per_channel", limitClaimsPerChannel); } + if (hasSource) { + options.put("has_source", true); + } else { + options.put("has_no_source", true); + } + addClaimSearchListOption("any_tags", anyTags, options); addClaimSearchListOption("not_tags", notTags, options); addClaimSearchListOption("channel_ids", channelIds, options);