Skip to content

Commit

Permalink
Merge pull request #24527 from brave/fix_gpc_crash_brave_news_setting…
Browse files Browse the repository at this point in the history
…s_android

[Android] fix gpc crash brave news settings
  • Loading branch information
deeppandya committed Jul 9, 2024
1 parent 396819e commit 495c505
Showing 1 changed file with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,13 @@ public static List<Publisher> getSuggestionsPublisherList() {

public static void setFollowingPublisherList() {
List<Publisher> publisherList = new ArrayList<>();
for (Publisher publisher : mGlobalPublisherList) {
if (publisher.userEnabledStatus == UserEnabled.ENABLED
|| (publisher.type == PublisherType.DIRECT_SOURCE
&& publisher.userEnabledStatus != UserEnabled.DISABLED)) {
publisherList.add(publisher);
if (mGlobalPublisherList != null && mGlobalPublisherList.size() > 0) {
for (Publisher publisher : mGlobalPublisherList) {
if (publisher.userEnabledStatus == UserEnabled.ENABLED
|| (publisher.type == PublisherType.DIRECT_SOURCE
&& publisher.userEnabledStatus != UserEnabled.DISABLED)) {
publisherList.add(publisher);
}
}
}
mFollowingPublisherList = publisherList;
Expand All @@ -244,11 +246,13 @@ public static List<Publisher> getFollowingPublisherList() {

public static void setFollowingChannelList() {
List<Channel> channelList = new ArrayList<>();
for (Channel channel : mChannelList) {
List<String> subscribedLocalesList =
new ArrayList<>(Arrays.asList(channel.subscribedLocales));
if (subscribedLocalesList.contains(mLocale)) {
channelList.add(channel);
if (mChannelList != null && mChannelList.size() > 0) {
for (Channel channel : mChannelList) {
List<String> subscribedLocalesList =
new ArrayList<>(Arrays.asList(channel.subscribedLocales));
if (subscribedLocalesList.contains(mLocale)) {
channelList.add(channel);
}
}
}
mFollowingChannelList = channelList;
Expand All @@ -260,22 +264,26 @@ public static List<Channel> getFollowingChannelList() {

public static List<Channel> searchChannel(String search) {
List<Channel> channelList = new ArrayList<>();
for (Channel channel : mChannelList) {
if (channel.channelName.toLowerCase(Locale.ROOT).contains(search)) {
channelList.add(channel);
if (mChannelList != null && mChannelList.size() > 0) {
for (Channel channel : mChannelList) {
if (channel.channelName.toLowerCase(Locale.ROOT).contains(search)) {
channelList.add(channel);
}
}
}
return channelList;
}

public static List<Publisher> searchPublisher(String search) {
List<Publisher> publisherList = new ArrayList<>();
for (Publisher publisher : mGlobalPublisherList) {
if (publisher.publisherName.toLowerCase(Locale.ROOT).contains(search)
|| publisher.categoryName.toLowerCase(Locale.ROOT).contains(search)
|| publisher.feedSource.url.toLowerCase(Locale.ROOT).contains(search)
|| publisher.siteUrl.url.toLowerCase(Locale.ROOT).contains(search)) {
publisherList.add(publisher);
if (mGlobalPublisherList != null && mGlobalPublisherList.size() > 0) {
for (Publisher publisher : mGlobalPublisherList) {
if (publisher.publisherName.toLowerCase(Locale.ROOT).contains(search)
|| publisher.categoryName.toLowerCase(Locale.ROOT).contains(search)
|| publisher.feedSource.url.toLowerCase(Locale.ROOT).contains(search)
|| publisher.siteUrl.url.toLowerCase(Locale.ROOT).contains(search)) {
publisherList.add(publisher);
}
}
}

Expand Down

0 comments on commit 495c505

Please sign in to comment.