diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java index 944abfb7ea..45b786e72b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java @@ -245,6 +245,14 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe private boolean loadingDialogs; private NestedSizeNotifierLayout nestedSizeNotifierLayout; + private long targetDialogId = -1L; + + public CacheControlActivity() {} + + public CacheControlActivity(Bundle args) { + targetDialogId = args.getLong("dialog_id", -1L); + } + private ActionBarMenuSubItem clearDatabaseItem; private ActionBarMenuSubItem resetDatabaseItem; private void updateDatabaseItemSize() { @@ -533,6 +541,14 @@ private void loadDialogEntities() { fillDialogsEntitiesRecursive(FileLoader.checkDirectory(FileLoader.MEDIA_DIR_DOCUMENT), TYPE_DOCUMENTS, dilogsFilesEntities, cacheModel); fillDialogsEntitiesRecursive(FileLoader.checkDirectory(FileLoader.MEDIA_DIR_FILES), TYPE_DOCUMENTS, dilogsFilesEntities, cacheModel); + // ----- Nagram Hook start ----- + if (targetDialogId != -1) { + DialogFileEntities entities = dilogsFilesEntities.get(targetDialogId, null); + if (entities != null) AndroidUtilities.runOnUIThread(() -> showClearCacheDialog(entities), 100); + targetDialogId = -1; + } + // ----- Nagram Hook end ----- + ArrayList entities = new ArrayList<>(); ArrayList unknownUsers = new ArrayList<>(); ArrayList unknownChats = new ArrayList<>(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index b3584da69b..b45c320d78 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -555,13 +555,10 @@ public void setAlpha(int a) { private final static int statistics = 19; private final static int start_secret_chat = 20; private final static int gallery_menu_save = 21; - private final static int event_log = 102; - private final static int message_filter = 103; private final static int view_discussion = 22; private final static int delete_topic = 23; private final static int report = 24; - private final static int aliasChannelName = 100; private final static int edit_name = 101; private final static int edit_info = 30; private final static int logout = 31; @@ -579,6 +576,11 @@ public void setAlpha(int a) { private final static int set_username = 43; private final static int bot_privacy = 44; + private final static int aliasChannelName = 100; + private final static int event_log = 102; + private final static int message_filter = 103; + private final static int clear_cache = 104; + private Rect rect = new Rect(); private TextCell setAvatarCell; @@ -2791,6 +2793,11 @@ public void didChangeOwner(TLRPC.User user) { // args.putLong("user_id", userId); // presentFragment(new QrActivity(args)); // } + } else if (id == clear_cache) { + Bundle args = new Bundle(); + args.putLong("dialog_id", userId != 0 ? dialogId : -chatId); + CacheControlActivity fragment = new CacheControlActivity(args); + presentFragment(fragment); } } }); @@ -10618,6 +10625,8 @@ private void createActionBarMenu(boolean animated) { if (selfUser && !myProfile) { otherItem.addSubItem(logout, R.drawable.msg_leave, LocaleController.getString(R.string.LogOut)); + } else { + otherItem.addSubItem(clear_cache, R.drawable.msg_delete, LocaleController.getString(R.string.ClearCache)); } if (!isPulledDown) { otherItem.hideSubItem(gallery_menu_save);