Skip to content

Commit

Permalink
update to 10.2.3 (4075)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaraush committed Nov 2, 2023
1 parent dfaff8c commit c319639
Show file tree
Hide file tree
Showing 44 changed files with 849 additions and 304 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/jni/tgnet/ConnectionsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
if (!request->respondsToMessageId(resultMid)) {
continue;
}
if (LOGS_ENABLED) DEBUG_D("got response for request %p - %s", request->rawRequest, typeid(*request->rawRequest).name());
if (LOGS_ENABLED) DEBUG_D("got response for request %p - %s (messageId = 0x%" PRIx64 ")", request->rawRequest, typeid(*request->rawRequest).name(), request->messageId);
bool discardResponse = false;
bool isError = false;
bool allowInitConnection = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5517,4 +5517,18 @@ public static void checkAndroidTheme(Context context, boolean open) {
}
context.setTheme(Theme.isCurrentThemeDark() && open ? R.style.Theme_TMessages_Dark : R.style.Theme_TMessages);
}

private static Boolean isHonor;
public static boolean isHonor() {
if (isHonor == null) {
try {
final String brand = Build.BRAND.toLowerCase();
isHonor = brand.contains("huawei") || brand.contains("honor");
} catch (Exception e) {
FileLog.e(e);
isHonor = false;
}
}
return isHonor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,20 @@ public String formatCurrency(long amount, String currency) {
}

public String formatCurrency(long amount, String currency, int exp) {
return formatCurrency(amount, currency, exp, false);
}

public String formatCurrency(long amount, String currency, int exp, boolean rounded) {
if (currency.isEmpty()) {
return String.valueOf(amount);
}
Currency cur = Currency.getInstance(currency);
if (cur != null) {
NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
numberFormat.setCurrency(cur);
if (rounded) {
return numberFormat.format(Math.round(amount / Math.pow(10, exp)));
}
return numberFormat.format(amount / Math.pow(10, exp));
}
return amount + " " + currency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class BuildVars {
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 = 4071;
public static String BUILD_VERSION_STRING = "10.2.2";
public static int BUILD_VERSION = 4075;
public static String BUILD_VERSION_STRING = "10.2.3";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void loadReactionsForMessages(long dialogId, ArrayList<MessageObject> vis
});
reactionsRequests.add(reqId);
if (reactionsRequests.size() > 5) {
chatActivity.getConnectionsManager().cancelRequest(reactionsRequests.remove(0), false);
chatActivity.getConnectionsManager().cancelRequest(reactionsRequests.remove(0), true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public interface FileDownloadProgressListener {
public final SparseArray<MessageObject> unviewedDownloads = new SparseArray<>();

public static class Preset {
public int[] mask = new int[5];
public int[] mask = new int[4];
public long[] sizes = new long[4];
public boolean preloadVideo;
public boolean preloadMusic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -1294,31 +1295,6 @@ private TLRPC.TL_messages_stickerSet getCachedStickerSetInternal(long id, Intege
return set;
}

private void fetchStickerSetInternal(long id, Integer hash, Utilities.Callback2<Boolean, TLRPC.TL_messages_stickerSet> onDone) {
if (onDone == null) {
return;
}
TLRPC.TL_messages_getStickerSet req = new TLRPC.TL_messages_getStickerSet();
TLRPC.TL_inputStickerSetID inputStickerSetID = new TLRPC.TL_inputStickerSetID();
inputStickerSetID.id = id;
req.stickerset = inputStickerSetID;
if (hash != null) {
req.hash = hash;
}
getConnectionsManager().sendRequest(req, (response, error) -> {
AndroidUtilities.runOnUIThread(() -> {
// if (error != null && "".equals(error.text)) {
// onDone.run(true, null);
// } else
if (response != null) {
onDone.run(true, (TLRPC.TL_messages_stickerSet) response);
} else {
onDone.run(false, null);
}
});
});
}

private final HashMap<TLRPC.InputStickerSet, ArrayList<Utilities.Callback2<Boolean, TLRPC.TL_messages_stickerSet>>> loadingStickerSets = new HashMap<>();

private void fetchStickerSetInternal(TLRPC.InputStickerSet inputStickerSet, Utilities.Callback2<Boolean, TLRPC.TL_messages_stickerSet> onDone) {
Expand Down Expand Up @@ -5603,20 +5579,18 @@ public void loadReplyMessagesForMessages(ArrayList<MessageObject> messages, long

LongSparseArray<ArrayList<MessageObject>> finalMessagesWithUnknownStories = messagesWithUnknownStories;

int[] requestsCount = new int[] {2};
AtomicInteger requestsCount = new AtomicInteger(2);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
try {
getMessagesController().getStoriesController().fillMessagesWithStories(finalMessagesWithUnknownStories, () -> {
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
}
}, classGuid);
if (replyMessageOwners.isEmpty()) {
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
Expand Down Expand Up @@ -5743,8 +5717,7 @@ public void loadReplyMessagesForMessages(ArrayList<MessageObject> messages, long
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
}
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
Expand Down Expand Up @@ -5772,8 +5745,7 @@ public void loadReplyMessagesForMessages(ArrayList<MessageObject> messages, long
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
Expand All @@ -5799,8 +5771,7 @@ public void loadReplyMessagesForMessages(ArrayList<MessageObject> messages, long
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
Expand All @@ -5812,8 +5783,7 @@ public void loadReplyMessagesForMessages(ArrayList<MessageObject> messages, long
}
}
} else {
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ public void calculate() {
if (checkCaption && captionMessage == null) {
captionMessage = messageObject;
checkCaption = false;
} else {
} else if (!isDocuments) {
captionMessage = null;
}
hasCaption = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3953,7 +3953,19 @@ public void sendMessage(SendMessageParams sendMessageParams) {
anotherChat = true;
}
}
final boolean anotherTopic = replyToTopMsg != null && replyToTopMsg.getId() != replyToMsg.getId() && MessageObject.getTopicId(replyToMsg.messageOwner, true) != replyToTopMsg.getId();
boolean anotherTopic = false;
if (replyToMsg != null) {
boolean isForum = false;
if (!isForum) {
TLRPC.Chat chat = getMessagesController().getChat(-DialogObject.getPeerDialogId(newMsg.peer_id));
if (ChatObject.isForum(chat)) {
isForum = true;
}
}
if (isForum) {
anotherTopic = replyToTopMsg.getId() != replyToMsg.getId() && MessageObject.getTopicId(replyToMsg.messageOwner, true) != replyToTopMsg.getId();
}
}
if (anotherChat || anotherTopic) {
newMsg.reply_to.flags |= 1;
newMsg.reply_to.reply_to_peer_id = peer2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private void sendRequestInternal(TLObject object, RequestDelegate onComplete, Re
resp.networkType = networkType;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("java received " + resp + " error = " + error);
FileLog.d("java received " + resp + " error = " + error + " messageId = " + requestMsgId);
}
FileLog.dumpResponseAndRequest(object, resp, error, requestMsgId, finalStartRequestTime, requestToken);
final TLObject finalResponse = resp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
} else {
scrollContainer.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (topAnimationIsNew ? Gravity.CENTER_HORIZONTAL : LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 24, 0, 24, customView != null || items != null ? customViewOffset : 0));
if (bottomView != null) {
scrollContainer.addView(bottomView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 24, -16, 24, 0));
scrollContainer.addView(bottomView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 24, -24, 24, 0));
}
}
if (!TextUtils.isEmpty(message)) {
Expand Down Expand Up @@ -907,7 +907,12 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
}
};
}
buttonsLayout.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
if(bottomView != null) {
buttonsLayout.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), AndroidUtilities.dp(4));
buttonsLayout.setTranslationY(-AndroidUtilities.dp(6));
} else {
buttonsLayout.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
}
containerView.addView(buttonsLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 52));
if (topAnimationIsNew) {
buttonsLayout.setTranslationY(-AndroidUtilities.dp(8));
Expand Down
25 changes: 0 additions & 25 deletions TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -3507,25 +3507,6 @@ public void run() {
public static int[] keys_avatar_background2 = {key_avatar_background2Red, key_avatar_background2Orange, key_avatar_background2Violet, key_avatar_background2Green, key_avatar_background2Cyan, key_avatar_background2Blue, key_avatar_background2Pink};
public static int[] keys_avatar_nameInMessage = {key_avatar_nameInMessageRed, key_avatar_nameInMessageOrange, key_avatar_nameInMessageViolet, key_avatar_nameInMessageGreen, key_avatar_nameInMessageCyan, key_avatar_nameInMessageBlue, key_avatar_nameInMessagePink};

public static final int key_avatar_composite_nameInMessageRed = colorsCount++;
public static final int key_avatar_composite_nameInMessageOrange = colorsCount++;
public static final int key_avatar_composite_nameInMessageViolet = colorsCount++;
public static final int key_avatar_composite_nameInMessageGreen = colorsCount++;
public static final int key_avatar_composite_nameInMessageCyan = colorsCount++;
public static final int key_avatar_composite_nameInMessageBlue = colorsCount++;
public static final int key_avatar_composite_nameInMessagePink = colorsCount++;

public static final int key_avatar_composite_nameInMessageRed2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageOrange2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageViolet2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageGreen2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageCyan2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageBlue2 = colorsCount++;
public static final int key_avatar_composite_nameInMessagePink2 = colorsCount++;

public static int[] keys_avatar_composite_nameInMessage = {key_avatar_composite_nameInMessageRed, key_avatar_composite_nameInMessageOrange, key_avatar_composite_nameInMessageViolet, key_avatar_composite_nameInMessageGreen, key_avatar_composite_nameInMessageCyan, key_avatar_composite_nameInMessageBlue, key_avatar_composite_nameInMessagePink};
public static int[] keys_avatar_composite_nameInMessage2 = {key_avatar_composite_nameInMessageRed2, key_avatar_composite_nameInMessageOrange2, key_avatar_composite_nameInMessageViolet2, key_avatar_composite_nameInMessageGreen2, key_avatar_composite_nameInMessageCyan2, key_avatar_composite_nameInMessageBlue2, key_avatar_composite_nameInMessagePink2};

public static final int key_actionBarDefault = colorsCount++;
public static final int key_actionBarDefaultSelector = colorsCount++;
public static final int key_actionBarWhiteSelector = colorsCount++;
Expand Down Expand Up @@ -4398,12 +4379,6 @@ public void run() {
for (int i = 0; i < keys_avatar_nameInMessage.length; i++) {
themeAccentExclusionKeys.add(keys_avatar_nameInMessage[i]);
}
for (int i = 0; i < keys_avatar_composite_nameInMessage.length; i++) {
themeAccentExclusionKeys.add(keys_avatar_composite_nameInMessage[i]);
}
for (int i = 0; i < keys_avatar_composite_nameInMessage2.length; i++) {
themeAccentExclusionKeys.add(keys_avatar_composite_nameInMessage2[i]);
}
for (int i = 0; i < keys_colors.length; i++) {
themeAccentExclusionKeys.add(keys_colors[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,6 @@ public static int[] createDefaultColors() {
defaultColors[key_avatar_nameInMessageBlue] = 0xff368AD1;
defaultColors[key_avatar_nameInMessagePink] = 0xffC7508B;

defaultColors[key_avatar_composite_nameInMessageRed] = 0xffE15052;
defaultColors[key_avatar_composite_nameInMessageOrange] = 0xffE0802B;
defaultColors[key_avatar_composite_nameInMessageViolet] = 0xffA05FF3;
defaultColors[key_avatar_composite_nameInMessageGreen] = 0xff27A910;
defaultColors[key_avatar_composite_nameInMessageCyan] = 0xff27ACCE;
defaultColors[key_avatar_composite_nameInMessageBlue] = 0xff3391D4;
defaultColors[key_avatar_composite_nameInMessagePink] = 0xffD14972;

defaultColors[key_avatar_composite_nameInMessageRed2] = 0xffF9AE63;
defaultColors[key_avatar_composite_nameInMessageOrange2] = 0xffFAC534;
defaultColors[key_avatar_composite_nameInMessageViolet2] = 0xffF48FFF;
defaultColors[key_avatar_composite_nameInMessageGreen2] = 0xffA7DC57;
defaultColors[key_avatar_composite_nameInMessageCyan2] = 0xff82E8D6;
defaultColors[key_avatar_composite_nameInMessageBlue2] = 0xff7DD3F0;
defaultColors[key_avatar_composite_nameInMessagePink2] = 0xffFFBE9F;

defaultColors[key_actionBarDefault] = 0xff527da3;
defaultColors[key_actionBarDefaultIcon] = 0xffffffff;
defaultColors[key_actionBarActionModeDefault] = 0xffffffff;
Expand Down Expand Up @@ -962,20 +946,6 @@ public static SparseArray<String> createColorKeysMap() {
colorKeysMap.put(key_avatar_nameInMessageCyan, "avatar_nameInMessageCyan");
colorKeysMap.put(key_avatar_nameInMessageBlue, "avatar_nameInMessageBlue");
colorKeysMap.put(key_avatar_nameInMessagePink, "avatar_nameInMessagePink");
colorKeysMap.put(key_avatar_composite_nameInMessageRed, "avatar_composite_nameInMessageRed");
colorKeysMap.put(key_avatar_composite_nameInMessageOrange, "avatar_composite_nameInMessageOrange");
colorKeysMap.put(key_avatar_composite_nameInMessageViolet, "avatar_composite_nameInMessageViolet");
colorKeysMap.put(key_avatar_composite_nameInMessageGreen, "avatar_composite_nameInMessageGreen");
colorKeysMap.put(key_avatar_composite_nameInMessageCyan, "avatar_composite_nameInMessageCyan");
colorKeysMap.put(key_avatar_composite_nameInMessageBlue, "avatar_composite_nameInMessageBlue");
colorKeysMap.put(key_avatar_composite_nameInMessagePink, "avatar_composite_nameInMessagePink");
colorKeysMap.put(key_avatar_composite_nameInMessageRed2, "avatar_composite_nameInMessageRed2");
colorKeysMap.put(key_avatar_composite_nameInMessageOrange2, "avatar_composite_nameInMessageOrange2");
colorKeysMap.put(key_avatar_composite_nameInMessageViolet2, "avatar_composite_nameInMessageViolet2");
colorKeysMap.put(key_avatar_composite_nameInMessageGreen2, "avatar_composite_nameInMessageGreen2");
colorKeysMap.put(key_avatar_composite_nameInMessageCyan2, "avatar_composite_nameInMessageCyan2");
colorKeysMap.put(key_avatar_composite_nameInMessageBlue2, "avatar_composite_nameInMessageBlue2");
colorKeysMap.put(key_avatar_composite_nameInMessagePink2, "avatar_composite_nameInMessagePink2");
colorKeysMap.put(key_actionBarDefault, "actionBarDefault");
colorKeysMap.put(key_actionBarDefaultSelector, "actionBarDefaultSelector");
colorKeysMap.put(key_actionBarWhiteSelector, "actionBarWhiteSelector");
Expand Down

0 comments on commit c319639

Please sign in to comment.