Skip to content

Commit

Permalink
feat: add hide phone number in profile
Browse files Browse the repository at this point in the history
  • Loading branch information
cinit authored and NextAlone committed Dec 8, 2023
1 parent 2f61db6 commit 48c7662
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
private final static int PHONE_OPTION_CALL = 0,
PHONE_OPTION_COPY = 1,
PHONE_OPTION_TELEGRAM_CALL = 2,
PHONE_OPTION_TELEGRAM_VIDEO_CALL = 3;
PHONE_OPTION_TELEGRAM_VIDEO_CALL = 3,
PHONE_OPTION_HIDE = 1001;

private boolean mOverrideHidePhoneNumber = false;

private RecyclerListView listView;
private RecyclerListView searchListView;
Expand Down Expand Up @@ -6034,6 +6037,10 @@ protected void onSend(LongSparseArray<TLRPC.Dialog> dids, int count, TLRPC.TL_fo
items.add(LocaleController.getString("Copy", R.string.Copy));
actions.add(PHONE_OPTION_COPY);

icons.add(R.drawable.msg_archive_hide);
items.add(LocaleController.getString("Hide", R.string.Hide));
actions.add(PHONE_OPTION_HIDE);

AtomicReference<ActionBarPopupWindow> popupWindowRef = new AtomicReference<>();
ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getContext(), R.drawable.popup_fixed_alert, resourcesProvider) {
Path path = new Path();
Expand Down Expand Up @@ -6085,6 +6092,14 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
}
VoIPHelper.startCall(user, action == PHONE_OPTION_TELEGRAM_VIDEO_CALL, userInfo != null && userInfo.video_calls_available, getParentActivity(), userInfo, getAccountInstance());
break;
case PHONE_OPTION_HIDE: {
mOverrideHidePhoneNumber = true;
updateRowsIds();
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
break;
}
}
});
}
Expand Down Expand Up @@ -8695,7 +8710,9 @@ private void updateRowsIds() {
setAvatarSectionRow = rowCount++;
}
numberSectionRow = rowCount++;
numberRow = hidePhone ? -1 : rowCount++;
if (!mOverrideHidePhoneNumber) {
numberRow = hidePhone ? -1 : rowCount++;
}
setUsernameRow = rowCount++;
bioRow = rowCount++;

Expand Down Expand Up @@ -8770,7 +8787,7 @@ private void updateRowsIds() {
}
infoStartRow = rowCount;
infoHeaderRow = rowCount++;
if (!isBot && (hasPhone || !hasInfo)) {
if (!isBot && (hasPhone || !hasInfo) && !mOverrideHidePhoneNumber) {
phoneRow = rowCount++;
}
if (userInfo != null && !TextUtils.isEmpty(userInfo.about)) {
Expand Down

0 comments on commit 48c7662

Please sign in to comment.