@@ -593,7 +593,11 @@ public boolean isSensitive() {
593
593
TLRPC.RestrictionReason reason = messageOwner.restriction_reason.get(i);
594
594
if (
595
595
"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
+ )
597
601
) {
598
602
return isSensitiveCached = true;
599
603
}
@@ -606,7 +610,11 @@ public boolean isSensitive() {
606
610
TLRPC.RestrictionReason reason = chat.restriction_reason.get(i);
607
611
if (
608
612
"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
+ )
610
618
) {
611
619
return isSensitiveCached = true;
612
620
}
@@ -4481,7 +4489,7 @@ private void updateMessageText(AbstractMap<Long, TLRPC.User> users, AbstractMap<
4481
4489
if (messageOwner.action instanceof TLRPC.TL_messageActionSuggestedPostRefund) {
4482
4490
final boolean refundByUser = ((TLRPC.TL_messageActionSuggestedPostRefund) messageOwner.action).payer_initiated;
4483
4491
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 ;
4485
4493
messageText = StarsIntroActivity.replaceStars(sp.amount.currency == AmountUtils.Currency.TON,
4486
4494
LocaleController.formatString(key, userName, channelName, sp.amount.asDecimalString()));
4487
4495
} else {
@@ -4494,7 +4502,7 @@ private void updateMessageText(AbstractMap<Long, TLRPC.User> users, AbstractMap<
4494
4502
} else if (messageOwner.action instanceof TLRPC.TL_messageActionSuggestedPostSuccess) {
4495
4503
if (sp != null && sp.amount != null) {
4496
4504
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()));
4498
4506
} else {
4499
4507
messageText = LocaleController.formatString(R.string.SuggestedOfferCompleteAmountUnknown, channelName);
4500
4508
}
@@ -5571,11 +5579,21 @@ private CharSequence formatTaskTitle(TLRPC.TodoItem task) {
5571
5579
}
5572
5580
5573
5581
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) {
5574
5593
CharSequence taskText = new SpannableStringBuilder(text.text);
5575
5594
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());
5579
5597
return taskText;
5580
5598
}
5581
5599
@@ -11984,6 +12002,8 @@ private CharSequence getActionSuggestionApprovalText(String channelName, String
11984
12002
ssb.append(AndroidUtilities.replaceTags(LocaleController.formatString(key, channelName)));
11985
12003
}
11986
12004
if (suggestionOffer.amount != null && !suggestionOffer.amount.isZero()) {
12005
+ final boolean isTon = suggestionOffer.amount.currency == AmountUtils.Currency.TON;
12006
+
11987
12007
{
11988
12008
final String text = isAdmin ?
11989
12009
LocaleController.formatString(R.string.SuggestionAgreementReachedAdmin2, userName, suggestionOffer.amount.asDecimalString()) :
@@ -11994,18 +12014,32 @@ private CharSequence getActionSuggestionApprovalText(String channelName, String
11994
12014
ssb.append(StarsIntroActivity.replaceStars(suggestionOffer.amount.currency == AmountUtils.Currency.TON, AndroidUtilities.replaceTags(text)));
11995
12015
}
11996
12016
{
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
+ }
12000
12027
12001
12028
ssb.append("\n\n");
12002
12029
ssb.setSpan(new RelativeSizeSpan(0.6f), ssb.length() - 1, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
12003
12030
ssb.append(AndroidUtilities.replaceTags(LocaleController.formatString(key, channelName, hours)));
12004
12031
}
12005
12032
{
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
+ }
12009
12043
12010
12044
ssb.append("\n\n");
12011
12045
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
12017
12051
return ssb;
12018
12052
}
12019
12053
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
+
12020
12094
public static void toggleTodo(TLRPC.TL_messageMediaToDo mediaTodo, int taskId, boolean enable, long myself, int currentDate) {
12021
12095
for (int i = 0; i < mediaTodo.completions.size(); ++i) {
12022
12096
final TLRPC.TodoCompletion completion = mediaTodo.completions.get(i);
0 commit comments