speedup setupfilters and cache

This commit is contained in:
gdlbo
2022-08-27 16:30:45 +03:00
parent 4bded5c565
commit 41ac03a7e1
3 changed files with 16 additions and 7 deletions
@@ -1,8 +1,12 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.ui.dialogs.ServerDialog.sendRequest;
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.removeWallpaper;
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
import static ru.vtosters.lite.utils.Preferences.checkupdates;
import static ru.vtosters.lite.utils.Preferences.preferences;
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
import static ru.vtosters.lite.utils.ThemesUtils.setNeededTheme;
@@ -35,7 +39,18 @@ public class MainActivityInjector {
.edit()
.putBoolean("isdark", isDarkTheme())
.commit();
VkExecutors.x.q().a(() -> getInstance().autoCleaningCache()); // slowTasksScheduler
VkExecutors.x.q().a(() -> {
if (preferences.getString("clearcache", "").isEmpty()) {
preferences.edit().putString("clearcache", "100mb").apply();
} // temp shit fix
removeWallpaper(); // temp fix
getInstance().autoCleaningCache();
setupFilters();
}); // slowTasksScheduler
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannels.createChannels();
}
@@ -107,7 +107,6 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
// a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// context.startActivity(a2);
sendToast("Обои временно недоступны. Следите за новостями на @vtosters в Telegram");
removeWallpaper();
return true;
}
}
@@ -34,17 +34,12 @@ public class Preferences {
public static String VERSIONNAME = "Beta";
public static void init(Application application) throws Exception {
setupFilters();
GmsUtils.fixGapps();
setProxy();
reloadMessagesList();
LifecycleUtils.registerActivities(application);
getInstance().autoCleaningCache();
} // VK Init
public static void forceOffline() {
setupFilters();
getInstance().autoCleaningCache();
edit().putBoolean("isdark", isDarkTheme()).commit();
if (setoffline() && offline()) {