Skip to content

Commit 51474c9

Browse files
committed
update to 11.13.4 (6086)
1 parent f106432 commit 51474c9

File tree

83 files changed

+6388
-1127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+6388
-1127
lines changed

TMessagesProj/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ dependencies {
5555
implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1'
5656
implementation 'com.google.android.gms:play-services-mlkit-image-labeling:16.0.8'
5757

58+
// implementation 'com.google.mlkit:translate:17.0.3'
59+
5860
constraints {
5961
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
6062
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
@@ -130,6 +132,7 @@ android {
130132
buildConfigField "boolean", "DEBUG_VERSION", "true"
131133
buildConfigField "boolean", "DEBUG_PRIVATE_VERSION", "true"
132134
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
135+
buildConfigField "int", "VERSION_NUM", "0"
133136
}
134137

135138
HA_private {
@@ -144,6 +147,7 @@ android {
144147
buildConfigField "boolean", "DEBUG_VERSION", "true"
145148
buildConfigField "boolean", "DEBUG_PRIVATE_VERSION", "true"
146149
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
150+
buildConfigField "int", "VERSION_NUM", "1"
147151
}
148152

149153
HA_public {
@@ -158,6 +162,7 @@ android {
158162
buildConfigField "boolean", "DEBUG_VERSION", "true"
159163
buildConfigField "boolean", "DEBUG_PRIVATE_VERSION", "false"
160164
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
165+
buildConfigField "int", "VERSION_NUM", "4"
161166
}
162167

163168
HA_hardcore {
@@ -172,6 +177,7 @@ android {
172177
buildConfigField "boolean", "DEBUG_VERSION", "true"
173178
buildConfigField "boolean", "DEBUG_PRIVATE_VERSION", "true"
174179
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
180+
buildConfigField "int", "VERSION_NUM", "5"
175181
}
176182

177183
standalone {
@@ -186,6 +192,7 @@ android {
186192
buildConfigField "boolean", "DEBUG_VERSION", "false"
187193
buildConfigField "boolean", "DEBUG_PRIVATE_VERSION", "false"
188194
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
195+
buildConfigField "int", "VERSION_NUM", "6"
189196
}
190197

191198
release {
@@ -201,6 +208,7 @@ android {
201208
buildConfigField "boolean", "DEBUG_VERSION", "false"
202209
buildConfigField "boolean", "DEBUG_PRIVATE_VERSION", "false"
203210
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
211+
buildConfigField "int", "VERSION_NUM", "7"
204212
}
205213
}
206214
namespace 'org.telegram.messenger'

TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
import android.widget.ImageView;
113113
import android.widget.LinearLayout;
114114
import android.widget.ListView;
115+
import android.widget.PopupWindow;
115116
import android.widget.ScrollView;
116117
import android.widget.TextView;
117118

TMessagesProj/src/main/java/org/telegram/messenger/AppGlobalConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public class AppGlobalConfig {
2727

2828
public final ConfigDouble tonUsdRate = ofDouble("ton_usd_rate", 3);
2929

30+
public final ConfigString starsRatingLearnMoreUrl = ofString("stars_rating_learnmore_url", "https://telegram.org/blog/telegram-stars");
31+
public final ConfigBoolean needAgeVideoVerification = ofBoolean("need_age_video_verification", false);
32+
33+
public final ConfigInt stargiftsCollectionsLimit = ofInt("stargifts_collections_limit", 100);
34+
public final ConfigInt stargiftsCollectionGiftsLimit = ofInt("stargifts_collection_gifts_limit", 100);
3035

3136
/* * */
3237

TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ public static void fatal(final Throwable e) {
467467
}
468468

469469
private static long dumpedHeap;
470-
private void dumpMemory() {
471-
if (System.currentTimeMillis() - dumpedHeap < 30_000) return;
470+
public void dumpMemory(boolean force) {
471+
if (!force && System.currentTimeMillis() - dumpedHeap < 30_000) return;
472472
dumpedHeap = System.currentTimeMillis();
473473
try {
474474
Debug.dumpHprofData(new File(AndroidUtilities.getLogsDir(), getInstance().dateFormat.format(System.currentTimeMillis()) + "_heap.hprof").getAbsolutePath());
@@ -493,15 +493,15 @@ private void dumpANR() {
493493
}
494494

495495
FileLog.e("ANR thread dump\n" + sb.toString());
496-
dumpMemory();
496+
dumpMemory(false);
497497
}
498498

499499
public static void fatal(final Throwable e, boolean logToAppCenter) {
500500
if (!BuildVars.LOGS_ENABLED) {
501501
return;
502502
}
503503
if (e instanceof OutOfMemoryError) {
504-
getInstance().dumpMemory();
504+
getInstance().dumpMemory(false);
505505
}
506506
if (logToAppCenter && BuildVars.DEBUG_VERSION && needSent(e)) {
507507
AndroidUtilities.appCenterLog(e);

TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5425,6 +5425,15 @@ public void removeWebapp(long dialogId) {
54255425
}
54265426
}
54275427

5428+
public boolean containsTopPeer(long uid) {
5429+
for (int a = 0; a < hints.size(); a++) {
5430+
if (DialogObject.getPeerDialogId(hints.get(a).peer) == uid) {
5431+
return true;
5432+
}
5433+
}
5434+
return false;
5435+
}
5436+
54285437
public void removePeer(long uid) {
54295438
for (int a = 0; a < hints.size(); a++) {
54305439
if (hints.get(a).peer.user_id == uid) {

TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java

Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,11 @@ public boolean isSensitive() {
593593
TLRPC.RestrictionReason reason = messageOwner.restriction_reason.get(i);
594594
if (
595595
"sensitive".equals(reason.reason) &&
596-
("all".equals(reason.platform) || (!ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() || BuildVars.DEBUG_PRIVATE_VERSION) && "android".equals(reason.platform))
596+
(
597+
"all".equals(reason.platform) ||
598+
"android".equals(reason.platform) && (!ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() || BuildVars.DEBUG_PRIVATE_VERSION) ||
599+
"android-all".equals(reason.platform)
600+
)
597601
) {
598602
return isSensitiveCached = true;
599603
}
@@ -606,7 +610,11 @@ public boolean isSensitive() {
606610
TLRPC.RestrictionReason reason = chat.restriction_reason.get(i);
607611
if (
608612
"sensitive".equals(reason.reason) &&
609-
("all".equals(reason.platform) || (!ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() || BuildVars.DEBUG_PRIVATE_VERSION) && "android".equals(reason.platform))
613+
(
614+
"all".equals(reason.platform) ||
615+
"android".equals(reason.platform) && (!ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() || BuildVars.DEBUG_PRIVATE_VERSION) ||
616+
"android-all".equals(reason.platform)
617+
)
610618
) {
611619
return isSensitiveCached = true;
612620
}
@@ -4481,7 +4489,7 @@ private void updateMessageText(AbstractMap<Long, TLRPC.User> users, AbstractMap<
44814489
if (messageOwner.action instanceof TLRPC.TL_messageActionSuggestedPostRefund) {
44824490
final boolean refundByUser = ((TLRPC.TL_messageActionSuggestedPostRefund) messageOwner.action).payer_initiated;
44834491
if (sp != null && sp.amount != null) {
4484-
final int key = refundByUser ? R.string.SuggestedOfferRefundByUserAmount : R.string.SuggestedOfferRefundByAdminAmount;
4492+
final int key = refundByUser ? R.string.SuggestedOfferRefundByUserAmountF : R.string.SuggestedOfferRefundByAdminAmountF;
44854493
messageText = StarsIntroActivity.replaceStars(sp.amount.currency == AmountUtils.Currency.TON,
44864494
LocaleController.formatString(key, userName, channelName, sp.amount.asDecimalString()));
44874495
} else {
@@ -4494,7 +4502,7 @@ private void updateMessageText(AbstractMap<Long, TLRPC.User> users, AbstractMap<
44944502
} else if (messageOwner.action instanceof TLRPC.TL_messageActionSuggestedPostSuccess) {
44954503
if (sp != null && sp.amount != null) {
44964504
messageText = StarsIntroActivity.replaceStars(sp.amount.currency == AmountUtils.Currency.TON,
4497-
LocaleController.formatString(R.string.SuggestedOfferCompleteAmount, channelName, sp.amount.asDecimalString()));
4505+
LocaleController.formatString(R.string.SuggestedOfferCompleteAmountF, channelName, sp.amount.asDecimalString()));
44984506
} else {
44994507
messageText = LocaleController.formatString(R.string.SuggestedOfferCompleteAmountUnknown, channelName);
45004508
}
@@ -5571,11 +5579,21 @@ private CharSequence formatTaskTitle(TLRPC.TodoItem task) {
55715579
}
55725580

55735581
public static CharSequence formatTextWithEntities(TLRPC.TL_textWithEntities text, boolean out) {
5582+
Theme.createCommonChatResources();
5583+
TextPaint paint = Theme.chat_actionTextPaint;
5584+
if (paint == null) {
5585+
paint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
5586+
paint.setTypeface(AndroidUtilities.bold());
5587+
paint.setTextSize(dp(Math.max(16, SharedConfig.fontSize) - 2));
5588+
}
5589+
return formatTextWithEntities(text, out, paint);
5590+
}
5591+
5592+
public static CharSequence formatTextWithEntities(TLRPC.TL_textWithEntities text, boolean out, TextPaint paint) {
55745593
CharSequence taskText = new SpannableStringBuilder(text.text);
55755594
addEntitiesToText(taskText, text.entities, out, false, false, false);
5576-
Theme.createCommonChatResources();
5577-
taskText = Emoji.replaceEmoji(taskText, Theme.chat_actionTextPaint.getFontMetricsInt(), false);
5578-
taskText = replaceAnimatedEmoji(taskText, text.entities, Theme.chat_actionTextPaint.getFontMetricsInt());
5595+
taskText = Emoji.replaceEmoji(taskText, paint.getFontMetricsInt(), false);
5596+
taskText = replaceAnimatedEmoji(taskText, text.entities, paint.getFontMetricsInt());
55795597
return taskText;
55805598
}
55815599

@@ -11984,6 +12002,8 @@ private CharSequence getActionSuggestionApprovalText(String channelName, String
1198412002
ssb.append(AndroidUtilities.replaceTags(LocaleController.formatString(key, channelName)));
1198512003
}
1198612004
if (suggestionOffer.amount != null && !suggestionOffer.amount.isZero()) {
12005+
final boolean isTon = suggestionOffer.amount.currency == AmountUtils.Currency.TON;
12006+
1198712007
{
1198812008
final String text = isAdmin ?
1198912009
LocaleController.formatString(R.string.SuggestionAgreementReachedAdmin2, userName, suggestionOffer.amount.asDecimalString()) :
@@ -11994,18 +12014,32 @@ private CharSequence getActionSuggestionApprovalText(String channelName, String
1199412014
ssb.append(StarsIntroActivity.replaceStars(suggestionOffer.amount.currency == AmountUtils.Currency.TON, AndroidUtilities.replaceTags(text)));
1199512015
}
1199612016
{
11997-
final int key = isAdmin ?
11998-
R.string.SuggestionAgreementReachedAdmin3:
11999-
R.string.SuggestionAgreementReachedUser3;
12017+
final int key;
12018+
if (isTon) {
12019+
key = isAdmin ?
12020+
R.string.SuggestionAgreementReachedAdmin3TON:
12021+
R.string.SuggestionAgreementReachedUser3TON;
12022+
} else {
12023+
key = isAdmin ?
12024+
R.string.SuggestionAgreementReachedAdmin3Stars:
12025+
R.string.SuggestionAgreementReachedUser3Stars;
12026+
}
1200012027

1200112028
ssb.append("\n\n");
1200212029
ssb.setSpan(new RelativeSizeSpan(0.6f), ssb.length() - 1, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
1200312030
ssb.append(AndroidUtilities.replaceTags(LocaleController.formatString(key, channelName, hours)));
1200412031
}
1200512032
{
12006-
final int key = isAdmin ?
12007-
R.string.SuggestionAgreementReachedAdmin4:
12008-
R.string.SuggestionAgreementReachedUser4;
12033+
final int key;
12034+
if (isTon) {
12035+
key = isAdmin ?
12036+
R.string.SuggestionAgreementReachedAdmin4TON:
12037+
R.string.SuggestionAgreementReachedUser4TON;
12038+
} else {
12039+
key = isAdmin ?
12040+
R.string.SuggestionAgreementReachedAdmin4Stars:
12041+
R.string.SuggestionAgreementReachedUser4Stars;
12042+
}
1200912043

1201012044
ssb.append("\n\n");
1201112045
ssb.setSpan(new RelativeSizeSpan(0.6f), ssb.length() - 1, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@@ -12017,6 +12051,46 @@ private CharSequence getActionSuggestionApprovalText(String channelName, String
1201712051
return ssb;
1201812052
}
1201912053

12054+
public static TLRPC.TodoItem findTodoItem(MessageObject messageObject, int task_id) {
12055+
final TLRPC.MessageMedia media = getMedia(messageObject);
12056+
if (!(media instanceof TLRPC.TL_messageMediaToDo)) {
12057+
return null;
12058+
}
12059+
final TLRPC.TL_messageMediaToDo mediaTodo = (TLRPC.TL_messageMediaToDo) media;
12060+
if (mediaTodo.todo == null || mediaTodo.todo.list == null) {
12061+
return null;
12062+
}
12063+
for (int i = 0; i < mediaTodo.todo.list.size(); ++i) {
12064+
TLRPC.TodoItem ti = mediaTodo.todo.list.get(i);
12065+
if (ti.id == task_id) {
12066+
return ti;
12067+
}
12068+
}
12069+
return null;
12070+
}
12071+
12072+
public static boolean isCompleted(MessageObject messageObject, int taskId) {
12073+
final TLRPC.MessageMedia media = getMedia(messageObject);
12074+
if (!(media instanceof TLRPC.TL_messageMediaToDo)) {
12075+
return false;
12076+
}
12077+
final TLRPC.TL_messageMediaToDo mediaTodo = (TLRPC.TL_messageMediaToDo) media;
12078+
if (mediaTodo.todo == null || mediaTodo.todo.list == null) {
12079+
return false;
12080+
}
12081+
return isCompleted(mediaTodo, taskId);
12082+
}
12083+
12084+
public static boolean isCompleted(TLRPC.TL_messageMediaToDo mediaTodo, int taskId) {
12085+
for (int i = 0; i < mediaTodo.completions.size(); ++i) {
12086+
final TLRPC.TodoCompletion completion = mediaTodo.completions.get(i);
12087+
if (completion.id == taskId) {
12088+
return true;
12089+
}
12090+
}
12091+
return false;
12092+
}
12093+
1202012094
public static void toggleTodo(TLRPC.TL_messageMediaToDo mediaTodo, int taskId, boolean enable, long myself, int currentDate) {
1202112095
for (int i = 0; i < mediaTodo.completions.size(); ++i) {
1202212096
final TLRPC.TodoCompletion completion = mediaTodo.completions.get(i);

0 commit comments

Comments
 (0)