Loading app/src/main/java/app/fedilab/android/BaseMainActivity.java +2 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt public static List<Filter> mainFilters; public static List<app.fedilab.android.mastodon.client.entities.api.Account> filteredAccounts; public static boolean filterFetched; public static int filterFetchedRetry = 0; public static boolean show_boosts, show_replies, show_dms, show_art_nsfw, show_self_boosts, show_self_replies, show_my_messages; public static String regex_home, regex_local, regex_public; public static iconLauncher mLauncher = iconLauncher.BUBBLES; Loading Loading @@ -1358,6 +1359,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt filteredAccounts = new ArrayList<>(); filterFetched = false; filterFetchedRetry = 0; networkStateReceiver = new NetworkStateReceiver(); networkStateReceiver.addListener(this); registerReceiver(networkStateReceiver, new IntentFilter(android.net.ConnectivityManager.CONNECTIVITY_ACTION)); Loading app/src/main/java/app/fedilab/android/mastodon/helper/TimelineHelper.java +4 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class TimelineHelper { */ public static List<Status> filterStatus(Context context, List<Status> statuses, Timeline.TimeLineEnum filterTimeLineType) { //A security to make sure filters have been fetched before displaying messages if (!BaseMainActivity.filterFetched) { if (!BaseMainActivity.filterFetched && BaseMainActivity.filterFetchedRetry < 3) { MastodonFiltersService mastodonFiltersService = initv2(context); List<Filter> filterList; Call<List<Filter>> getFiltersCall = mastodonFiltersService.getFilters(BaseMainActivity.currentToken); Loading @@ -92,6 +92,7 @@ public class TimelineHelper { e.printStackTrace(); } } BaseMainActivity.filterFetchedRetry++; } //If there are filters: Loading Loading @@ -222,7 +223,7 @@ public class TimelineHelper { public static List<Notification> filterNotification(Context context, List<Notification> notifications) { //A security to make sure filters have been fetched before displaying messages List<Notification> notificationToRemove = new ArrayList<>(); if (!BaseMainActivity.filterFetched) { if (!BaseMainActivity.filterFetched && BaseMainActivity.filterFetchedRetry < 3) { try { FiltersVM filtersVM = new ViewModelProvider((ViewModelStoreOwner) context).get(FiltersVM.class); filtersVM.getFilters(BaseMainActivity.currentInstance, BaseMainActivity.currentToken).observe((LifecycleOwner) context, filters -> { Loading @@ -232,6 +233,7 @@ public class TimelineHelper { } catch (Exception e) { return notifications; } BaseMainActivity.filterFetchedRetry++; } //If there are filters: if (BaseMainActivity.mainFilters != null && !BaseMainActivity.mainFilters.isEmpty() && notifications != null && !notifications.isEmpty()) { Loading Loading
app/src/main/java/app/fedilab/android/BaseMainActivity.java +2 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt public static List<Filter> mainFilters; public static List<app.fedilab.android.mastodon.client.entities.api.Account> filteredAccounts; public static boolean filterFetched; public static int filterFetchedRetry = 0; public static boolean show_boosts, show_replies, show_dms, show_art_nsfw, show_self_boosts, show_self_replies, show_my_messages; public static String regex_home, regex_local, regex_public; public static iconLauncher mLauncher = iconLauncher.BUBBLES; Loading Loading @@ -1358,6 +1359,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt filteredAccounts = new ArrayList<>(); filterFetched = false; filterFetchedRetry = 0; networkStateReceiver = new NetworkStateReceiver(); networkStateReceiver.addListener(this); registerReceiver(networkStateReceiver, new IntentFilter(android.net.ConnectivityManager.CONNECTIVITY_ACTION)); Loading
app/src/main/java/app/fedilab/android/mastodon/helper/TimelineHelper.java +4 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class TimelineHelper { */ public static List<Status> filterStatus(Context context, List<Status> statuses, Timeline.TimeLineEnum filterTimeLineType) { //A security to make sure filters have been fetched before displaying messages if (!BaseMainActivity.filterFetched) { if (!BaseMainActivity.filterFetched && BaseMainActivity.filterFetchedRetry < 3) { MastodonFiltersService mastodonFiltersService = initv2(context); List<Filter> filterList; Call<List<Filter>> getFiltersCall = mastodonFiltersService.getFilters(BaseMainActivity.currentToken); Loading @@ -92,6 +92,7 @@ public class TimelineHelper { e.printStackTrace(); } } BaseMainActivity.filterFetchedRetry++; } //If there are filters: Loading Loading @@ -222,7 +223,7 @@ public class TimelineHelper { public static List<Notification> filterNotification(Context context, List<Notification> notifications) { //A security to make sure filters have been fetched before displaying messages List<Notification> notificationToRemove = new ArrayList<>(); if (!BaseMainActivity.filterFetched) { if (!BaseMainActivity.filterFetched && BaseMainActivity.filterFetchedRetry < 3) { try { FiltersVM filtersVM = new ViewModelProvider((ViewModelStoreOwner) context).get(FiltersVM.class); filtersVM.getFilters(BaseMainActivity.currentInstance, BaseMainActivity.currentToken).observe((LifecycleOwner) context, filters -> { Loading @@ -232,6 +233,7 @@ public class TimelineHelper { } catch (Exception e) { return notifications; } BaseMainActivity.filterFetchedRetry++; } //If there are filters: if (BaseMainActivity.mainFilters != null && !BaseMainActivity.mainFilters.isEmpty() && notifications != null && !notifications.isEmpty()) { Loading