Skip to content

Instantly share code, notes, and snippets.

@s3va
Last active March 14, 2024 00:09
Show Gist options
  • Save s3va/fb5f0053718f4ec6fe9ed6800318d59a to your computer and use it in GitHub Desktop.
Save s3va/fb5f0053718f4ec6fe9ed6800318d59a to your computer and use it in GitHub Desktop.
Show chatId(or userId) in android telegram app. Diff to DrKLO githab telegram app.
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
index 524e5ef9..98e63d2c 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
@@ -14,16 +14,16 @@ import android.os.Build;
public class BuildVars {
- public static boolean DEBUG_VERSION = false;
- public static boolean DEBUG_PRIVATE_VERSION = false;
- public static boolean LOGS_ENABLED = false;
+ public static boolean DEBUG_VERSION = true;
+ public static boolean DEBUG_PRIVATE_VERSION = true;
+ public static boolean LOGS_ENABLED = true;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 2470;
public static String BUILD_VERSION_STRING = "8.2.7";
- public static int APP_ID = 4;
- public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
+ public static int APP_ID = 1XXXXXX2;
+ public static String APP_HASH = "6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger";
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java
index e73f6465..ca484008 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java
@@ -60,6 +60,10 @@ public class TextDetailCell extends FrameLayout {
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(60) + (needDivider ? 1 : 0), MeasureSpec.EXACTLY));
}
+ public void sSelectableText(){
+ textView.setTextIsSelectable(true);
+ }
+
public void setTextAndValue(String text, String value, boolean divider) {
textView.setText(text);
valueTextView.setText(value);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
index af95ed94..3250b9c6 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
@@ -406,6 +406,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
private int addMemberRow;
private int subscribersRow;
private int subscribersRequestsRow;
+ private int userOrChatIdRow;
private int administratorsRow;
private int blockedUsersRow;
private int membersSectionRow;
@@ -2616,6 +2617,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else if (position == subscribersRequestsRow) {
MemberRequestsActivity activity = new MemberRequestsActivity(chatId);
presentFragment(activity);
+ } else if (position == userOrChatIdRow) {
+ Toast.makeText(
+ getParentActivity(),
+ "ChatId: " + chatId + " UserId: " + userId + " DialogId: " + dialogId,
+ Toast.LENGTH_LONG
+ ).show();
} else if (position == administratorsRow) {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
@@ -5476,6 +5483,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
addMemberRow = -1;
subscribersRow = -1;
subscribersRequestsRow = -1;
+ userOrChatIdRow = -1;
administratorsRow = -1;
blockedUsersRow = -1;
membersSectionRow = -1;
@@ -5509,6 +5517,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
setAvatarRow = rowCount++;
setAvatarSectionRow = rowCount++;
}
+ userOrChatIdRow = rowCount++;
numberSectionRow = rowCount++;
numberRow = rowCount++;
setUsernameRow = rowCount++;
@@ -5559,6 +5568,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
boolean hasPhone = user != null && !TextUtils.isEmpty(user.phone);
infoHeaderRow = rowCount++;
+ userOrChatIdRow = rowCount++;
if (!isBot && (hasPhone || !hasInfo)) {
phoneRow = rowCount++;
}
@@ -5615,6 +5625,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
usernameRow = rowCount++;
}
}
+ userOrChatIdRow = rowCount++;
if (infoHeaderRow != -1) {
notificationsDividerRow = rowCount++;
}
@@ -6983,6 +6994,18 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
TLRPC.Chat chat = getMessagesController().getChat(chatId);
detailCell.setTextAndValue(getMessagesController().linkPrefix + "/" + chat.username, LocaleController.getString("InviteLink", R.string.InviteLink), false);
}
+
+ } else if (position == userOrChatIdRow) {
+ String text;
+ if (userId != 0) {
+ detailCell.setTextAndValue(String.valueOf(userId), "User Id", true);
+ detailCell.sSelectableText();
+ } else if (currentChat != null) {
+ //TLRPC.Chat chat = getMessagesController().getChat(chatId);
+ detailCell.setTextAndValue(String.valueOf(chatId), "Chat Id", true);
+ detailCell.sSelectableText();
+ }
+
} else if (position == locationRow) {
if (chatInfo != null && chatInfo.location instanceof TLRPC.TL_channelLocation) {
TLRPC.TL_channelLocation location = (TLRPC.TL_channelLocation) chatInfo.location;
@@ -7288,7 +7311,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (position == infoHeaderRow || position == membersHeaderRow || position == settingsSectionRow2 ||
position == numberSectionRow || position == helpHeaderRow || position == debugHeaderRow) {
return 1;
- } else if (position == phoneRow || position == usernameRow || position == locationRow ||
+ } else if (position == phoneRow || position == usernameRow || position == userOrChatIdRow || position == locationRow ||
position == numberRow || position == setUsernameRow || position == bioRow) {
return 2;
} else if (position == userInfoRow || position == channelInfoRow) {
@@ -8227,6 +8250,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
put(++pointer, addMemberRow, sparseIntArray);
put(++pointer, subscribersRow, sparseIntArray);
put(++pointer, subscribersRequestsRow, sparseIntArray);
+ put(++pointer, userOrChatIdRow, sparseIntArray);
put(++pointer, administratorsRow, sparseIntArray);
put(++pointer, blockedUsersRow, sparseIntArray);
put(++pointer, membersSectionRow, sparseIntArray);
diff --git a/app/jni/third_party/opus b/app/jni/third_party/opus
--- a/app/jni/third_party/opus
+++ b/app/jni/third_party/opus
@@ -1 +1 @@
-Subproject commit e85ed7726db5d677c9c0677298ea0cb9c65bdd23
+Subproject commit e85ed7726db5d677c9c0677298ea0cb9c65bdd23-dirty
diff --git a/app/src/main/java/org/thunderdog/challegram/ui/ProfileController.java b/app/src/main/java/org/thunderdog/challegram/ui/ProfileController.java
index eb10d83..5c901ab 100644
--- a/app/src/main/java/org/thunderdog/challegram/ui/ProfileController.java
+++ b/app/src/main/java/org/thunderdog/challegram/ui/ProfileController.java
@@ -130,6 +130,7 @@ import org.thunderdog.challegram.widget.rtl.RtlViewPager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -812,7 +813,7 @@ public class ProfileController extends ViewController<ProfileController.Args> im
} else if (id == R.id.btn_copyUsername) {
String username = getProfileUsername();
if (!StringUtils.isEmpty(username)) {
- UI.copyText("@" + username, R.string.CopiedUsername);
+ UI.copyText("@" + username + " " + getPeerId(), R.string.CopiedUsername);
}
} else if (id == R.id.btn_peer_id_copy) {
UI.copyText(Long.toString(getPeerId()), R.string.CopiedPeerId);
@@ -1946,22 +1947,22 @@ public class ProfileController extends ViewController<ProfileController.Args> im
return TD.toCharSequence(formattedText);
} else if (!tdlib.isUserChat(chat) || tdlib.isBotChat(chat)) {
- return tdlib.tMeUrl(usernames, true);
+ return tdlib.tMeUrl(usernames, true) + " " + getPeerId();
}
}
- return Lang.getString(R.string.Username);
+ return Lang.getString(R.string.Username) + " " + getPeerId();
}
private String getUsernameData () {
TdApi.Usernames usernames = tdlib.chatUsernames(chat);
if (usernames != null && Td.hasUsername(usernames)) {
if (tdlib.isUserChat(chat)) { // Bots + Users: @username
- return "@" + Td.primaryUsername(usernames);
+ return "@" + Td.primaryUsername(usernames)+ " " + getPeerId();
} else { // Otherwise: /username
- return "/" + Td.primaryUsername(usernames);
+ return "/" + Td.primaryUsername(usernames)+ " " + getPeerId();
}
} else {
- return "";
+ return "" + getPeerId();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment