Skip to content

Commit

Permalink
"Message Details" feature from NekoX / MercuryGram
Browse files Browse the repository at this point in the history
The feature is reworked to be multi-language compliant, to fix some
bugs and to add a toggle in Debug Menu to enable Message Details Menu
  • Loading branch information
et-ness committed Feb 17, 2024
1 parent 01116f7 commit 7598453
Show file tree
Hide file tree
Showing 11 changed files with 571 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ public static void togglePaymentByInvoice() {
.apply();
}

public static void toggleMessageDetailsMenu() {
messageDetailsMenu = !messageDetailsMenu;
ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE)
.edit()
.putBoolean("messageDetailsMenu", messageDetailsMenu)
.apply();
}

public static void toggleSurfaceInStories() {
useSurfaceInStories = !useSurfaceInStories;
ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE)
Expand Down Expand Up @@ -262,6 +270,7 @@ private static boolean isWhitelisted(MediaCodecInfo codecInfo) {
public static boolean useSurfaceInStories;
public static boolean photoViewerBlur = true;
public static boolean payByInvoice;
public static boolean messageDetailsMenu;
public static int stealthModeSendMessageConfirm = 2;
private static int lastLocalId = -210000;

Expand Down Expand Up @@ -677,6 +686,7 @@ public static void loadConfig() {
photoViewerBlur = preferences.getBoolean("photoViewerBlur", true);
multipleReactionsPromoShowed = preferences.getBoolean("multipleReactionsPromoShowed", false);
callEncryptionHintDisplayedCount = preferences.getInt("callEncryptionHintDisplayedCount", 0);
messageDetailsMenu = preferences.getBoolean("messageDetailsMenu", false);

activeAccounts = Arrays.stream(preferences.getString("active_accounts", "").split(",")).filter(SharedConfig::isNotBlank).map(Integer::parseInt).collect(Collectors.toCollection(CopyOnWriteArraySet::new));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ default boolean needPresentFragment(INavigationLayout layout, NavigationParams p
/**
* @deprecated You should override {@link INavigationLayoutDelegate#needPresentFragment(INavigationLayout, NavigationParams)} for more fields
*/
@Deprecated
default boolean needPresentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation, INavigationLayout layout) {
return true;
}
Expand Down
11 changes: 11 additions & 0 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,8 @@ public void run() {
private final static int OPTION_SPEED_PROMO = 103;
private final static int OPTION_OPEN_PROFILE = 104;

private final static int OPTION_DETAILS = 200;

private final static int[] allowedNotificationsDuringChatListAnimations = new int[]{
NotificationCenter.messagesRead,
NotificationCenter.threadMessagesRead,
Expand Down Expand Up @@ -26856,6 +26858,11 @@ public void setAutoDeleteHistory(int time, int action) {
options.add(OPTION_DELETE);
icons.add(selectedObject.messageOwner.ttl_period != 0 ? R.drawable.msg_delete_auto : R.drawable.msg_delete);
}
if (SharedConfig.messageDetailsMenu) {
items.add(LocaleController.getString("MessageDetails", R.string.MessageDetails));
options.add(OPTION_DETAILS);
icons.add(R.drawable.menu_info);
}
} else {
if (allowChatActions && !isInsideContainer) {
items.add(LocaleController.getString("Reply", R.string.Reply));
Expand Down Expand Up @@ -29343,6 +29350,10 @@ private void processSelectedOption(int option) {
openUserProfile(from.user_id != 0 ? from.user_id : from.channel_id != 0 ? from.channel_id : from.chat_id);
break;
}
case OPTION_DETAILS: {
presentFragment(new MessageDetailsActivity(selectedObject));
break;
}
}
selectedObject = null;
selectedObjectGroup = null;
Expand Down
Loading

0 comments on commit 7598453

Please sign in to comment.