Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified TMessagesProj/config/release.keystore
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class BuildVars {
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static String BUILD_VERSION_STRING = BuildConfig.BUILD_VERSION_STRING;

public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static int APP_ID = 20831107;
public static String APP_HASH = "cebe3a984370eef377d30f9c9f1052b8";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what?


// SafetyNet key for Google Identity SDK, set it to empty to disable
public static String SAFETYNET_KEY = "AIzaSyDqt8P-7F7CPCseMkOiVRgb1LY8RN1bvH8";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public static long getTopicId(int currentAccount, TLRPC.Message message, boolean
}

@Deprecated
private static long getTopicId(int currentAccount, TLRPC.Message message, boolean sureIsForum, boolean sureIsMonoForum) {
public static long getTopicId(int currentAccount, TLRPC.Message message, boolean sureIsForum, boolean sureIsMonoForum) {
final long selfId = UserConfig.getInstance(currentAccount).getClientUserId();
if (sureIsMonoForum) {
return getMonoForumTopicId(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import androidx.core.graphics.ColorUtils;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LocaleController;
import org.telegram.ui.Components.AnimatedEmojiSpan;
Expand All @@ -32,6 +33,7 @@
public class ActionBarMenuSubItem extends FrameLayout {

public AnimatedEmojiSpan.TextViewEmojis textView;
public TextView valueTextView;
public TextView subtextView;
public RLottieImageView imageView;
public boolean checkViewLeft;
Expand Down Expand Up @@ -97,6 +99,17 @@ public ActionBarMenuSubItem(Context context, int needCheck, boolean top, boolean
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));

valueTextView = new TextView(context);
valueTextView.setLines(1);
valueTextView.setSingleLine(true);
valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
valueTextView.setEllipsize(TextUtils.TruncateAt.END);
valueTextView.setTextColor(textColor);
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
valueTextView.setTypeface(AndroidUtilities.bold());
valueTextView.setVisibility(GONE);
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL));

checkViewLeft = LocaleController.isRTL;
makeCheckView(needCheck);
}
Expand Down Expand Up @@ -124,6 +137,16 @@ public void setEmojiCacheType(int cacheType) {

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (valueTextView.getVisibility() == VISIBLE) {
int availableWidth = Math.max(0, MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - getPaddingRight());
valueTextView.measure(
MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
MeasureSpec.makeMeasureSpec(dp(itemHeight), MeasureSpec.AT_MOST)
);
textView.setMaxWidth(Math.max(0, availableWidth - valueTextView.getMeasuredWidth() - dp(8)));
} else {
textView.setMaxWidth(Integer.MAX_VALUE);
}
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(dp(itemHeight), View.MeasureSpec.EXACTLY));
if (expandIfMultiline && textView.getLayout().getLineCount() > 1) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(dp(itemHeight + 8), View.MeasureSpec.EXACTLY));
Expand Down Expand Up @@ -204,6 +227,7 @@ public void setMultiline(boolean changeSize) {
}

public void setTextAndIcon(CharSequence text, int icon, Drawable iconDrawable) {
valueTextView.setVisibility(GONE);
textView.setText(text);
if (icon != 0 || iconDrawable != null || checkView != null) {
if (iconDrawable != null) {
Expand All @@ -223,6 +247,7 @@ public void setTextAndIcon(CharSequence text, int icon, Drawable iconDrawable) {
}

public void setTextAndIcon(CharSequence text, ImageLocation imageLocation, String imageFilter, Drawable thumb, Object parentObject) {
valueTextView.setVisibility(GONE);
textView.setText(text);
textView.setPadding(checkViewLeft ? (checkView != null ? dp(43) : 0) : dp(43), 0, checkViewLeft ? dp(43) : (checkView != null ? dp(43) : 0), 0);
if (backupImageView == null) {
Expand Down Expand Up @@ -257,6 +282,7 @@ public ActionBarMenuSubItem setColors(int textColor, int iconColor) {
public void setTextColor(int textColor) {
if (this.textColor != textColor) {
textView.setTextColor(this.textColor = textColor);
valueTextView.setTextColor(this.textColor);
}
}

Expand Down Expand Up @@ -344,9 +370,44 @@ public void onItemShown() {
}

public void setText(CharSequence text) {
valueTextView.setVisibility(GONE);
textView.setText(text);
}

public void setTextAndValueAndIcon(CharSequence text, CharSequence value, int icon, Drawable iconDrawable) {
textView.setText(text);
if (TextUtils.isEmpty(value)) {
valueTextView.setVisibility(GONE);
} else {
valueTextView.setVisibility(VISIBLE);
valueTextView.setText(value);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) valueTextView.getLayoutParams();
if (LocaleController.isRTL) {
layoutParams.leftMargin = checkView != null && !checkViewLeft ? dp(34) : 0;
layoutParams.rightMargin = 0;
} else {
layoutParams.rightMargin = checkView != null && !checkViewLeft ? dp(34) : 0;
layoutParams.leftMargin = 0;
}
valueTextView.setLayoutParams(layoutParams);
}
if (icon != 0 || iconDrawable != null || checkView != null) {
if (iconDrawable != null) {
iconResId = 0;
imageView.setImageDrawable(iconDrawable);
} else {
iconResId = icon;
imageView.setImageResource(icon);
}
imageView.setVisibility(VISIBLE);
textView.setPadding(checkViewLeft ? (checkView != null ? dp(43) : 0) : dp(icon != 0 || iconDrawable != null ? 43 : 0), 0, checkViewLeft ? dp(icon != 0 || iconDrawable != null ? 43 : 0) : (checkView != null ? dp(43) : 0), 0);
} else {
iconResId = 0;
imageView.setVisibility(INVISIBLE);
textView.setPadding(0, 0, 0, 0);
}
}

public void setSubtextColor(int color) {
if (subtextView != null) {
subtextView.setTextColor(color);
Expand Down
10 changes: 7 additions & 3 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
import org.telegram.ui.Components.voip.VoIPHelper;
import org.telegram.ui.Delegates.ChatActivityMemberRequestsDelegate;
import org.telegram.ui.Gifts.GiftSheet;
import org.telegram.ui.Stars.BotStarsController;
import org.telegram.ui.Stars.StarReactionsOverlay;
import org.telegram.ui.Stars.StarsController;
import org.telegram.ui.Stars.StarsIntroActivity;
Expand Down Expand Up @@ -2627,6 +2628,7 @@ public boolean onFragmentCreate() {
if (ChatObject.isMonoForum(currentChat)) {
chatMode = MODE_SUGGESTIONS;
isSubscriberSuggestions = !ChatObject.canManageMonoForum(currentAccount, currentChat);
BotStarsController.getInstance(currentAccount).getBotStarsBalance(-currentChat.linked_monoforum_id);
}
dialog_id = -chatId;
if (ChatObject.isChannel(currentChat)) {
Expand Down Expand Up @@ -3761,6 +3763,7 @@ public void onItemClick(final int id) {
if (getContext() == null) return;
AlertsCreator.showAlertWithCheckbox(
getContext(),
currentChat != null ? currentChat.linked_monoforum_id : -1L,
getString(R.string.RemoveMessageFeeTitle),
AndroidUtilities.replaceTags(formatString(ChatObject.isMonoForum(currentChat) ? R.string.RemoveMessageFeeMessageChannel : R.string.RemoveMessageFeeMessage, DialogObject.getShortName(user_id))),
revenue > 0 ? formatPluralStringComma("RemoveMessageFeeRefund", (int) (long) revenue) : null,
Expand Down Expand Up @@ -28543,6 +28546,7 @@ public void updateDrawState(@NonNull TextPaint ds) {
if (getContext() == null) return;
AlertsCreator.showAlertWithCheckbox(
getContext(),
currentChat != null ? currentChat.linked_monoforum_id : -1L,
getString(R.string.RemoveMessageFeeTitle),
AndroidUtilities.replaceTags(formatString(ChatObject.isMonoForum(currentChat) ? R.string.RemoveMessageFeeMessageChannel : R.string.RemoveMessageFeeMessage, DialogObject.getShortName(user_id))),
revenue > 0 ? formatPluralStringComma("RemoveMessageFeeRefund", (int) (long) revenue) : null,
Expand Down Expand Up @@ -42820,8 +42824,8 @@ public void didPressPhoneNumber(ChatMessageCell cell, CharacterStyle link, Strin
subOptions.addGap();
subOptions.add(R.drawable.msg_addbot, getString(R.string.CreateNewContact), () -> {
options.dismiss();
NewContactBottomSheet sheet = new NewContactBottomSheet(this, getContext()).setInitialPhoneNumber(phone, false);
sheet.show();
NewContactActivity fragment = new NewContactActivity().setInitialPhoneNumber(phone, false);
presentFragment(fragment);
});
subOptions.add(R.drawable.menu_contact_existing, getString(R.string.AddToExistingContact), () -> addToContacts.run(false));

Expand Down Expand Up @@ -43509,7 +43513,7 @@ public void fillMessageMenu(
message.isSponsored() || type == 1 && message.getDialogId() == mergeDialogId ||
message.messageOwner.action instanceof TLRPC.TL_messageActionSecureValuesSent ||
currentEncryptedChat == null && message.getId() < 0 ||
bottomChannelButtonsLayout != null && bottomChannelButtonsLayout.getVisibility() == View.VISIBLE && !(bottomOverlayChatWaitsReply && selectedObject != null && (MessageObject.getTopicId(currentAccount, selectedObject.messageOwner, ChatObject.isForum(currentChat)) != 0 || selectedObject.wasJustSent))) {
bottomChannelButtonsLayout != null && bottomChannelButtonsLayout.getVisibility() == View.VISIBLE && !(bottomOverlayChatWaitsReply && selectedObject != null && (MessageObject.getTopicId(currentAccount, selectedObject.messageOwner, ChatObject.isForum(currentChat), ChatObject.isMonoForum(currentChat)) != 0 || selectedObject.wasJustSent))) {
allowChatActions = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2154,6 +2154,10 @@ public static void showPayForMessageAlert(int currentAccount, long dialogId, lon
}

public static void showAlertWithCheckbox(Context context, CharSequence title, CharSequence message, CharSequence check, CharSequence button, Utilities.Callback<Boolean> onAction, Theme.ResourcesProvider resourcesProvider) {
showAlertWithCheckbox(context, -1L, title, message, check, button, onAction, resourcesProvider);
}

public static void showAlertWithCheckbox(Context context, long chatId, CharSequence title, CharSequence message, CharSequence check, CharSequence button, Utilities.Callback<Boolean> onAction, Theme.ResourcesProvider resourcesProvider) {
if (context == null) {
onAction.run(false);
return;
Expand Down Expand Up @@ -2227,6 +2231,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
AlertDialog d = builder.create();
d.setShowStarsBalance(true);
d.show();
if (d.getStarsBalanceCloud() != null) {
d.getStarsBalanceCloud().setChatId(chatId);
}
}

public static void createClearOrDeleteDialogAlert(BaseFragment fragment, boolean clear, TLRPC.Chat chat, TLRPC.User user, boolean secret, boolean canDeleteHistory, MessagesStorage.BooleanCallback onProcessRunnable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4336,7 +4336,7 @@ private void showRestrictedHint() {
}
if (DialogObject.isChatDialog(dialog_id)) {
TLRPC.Chat chat = accountInstance.getMessagesController().getChat(-dialog_id);
BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.passcode_lock_close, LocaleController.formatString("SendPlainTextRestrictionHint", R.string.SendPlainTextRestrictionHint, ChatObject.getAllowedSendString(chat)), 3).show();
BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.passcode_lock_close, LocaleController.formatString("SendPlainTextRestrictionHint", R.string.SendPlainTextRestrictionHint, ChatObject.getAllowedSendString(chat)), 4).show();
}
}

Expand Down
Loading