Skip to content

Commit ddc90f1

Browse files
committed
update to 12.0.1 (6166)
1 parent aa5fe2e commit ddc90f1

20 files changed

Lines changed: 306 additions & 551 deletions

‎TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ private void requestNextChatThemes(ResultCallback<Void> callback) {
943943
final TL_account.Tl_getUniqueGiftChatThemes req = new TL_account.Tl_getUniqueGiftChatThemes();
944944
req.offset = giftsThemeList.offset;
945945
req.hash = giftsThemeList.hash;
946-
req.limit = 10;
946+
req.limit = 50;
947947

948948
getConnectionsManager().sendRequestTyped(req, chatThemeQueue::postRunnable, (response, error) -> {
949949
if (error != null) {

‎TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,43 +2669,43 @@ public void loadPrivacySettings(boolean force) {
26692669

26702670
switch (num) {
26712671
case PRIVACY_RULES_TYPE_LASTSEEN:
2672-
req.key = new TLRPC.TL_inputPrivacyKeyStatusTimestamp();
2672+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyStatusTimestamp;
26732673
break;
26742674
case PRIVACY_RULES_TYPE_INVITE:
2675-
req.key = new TLRPC.TL_inputPrivacyKeyChatInvite();
2675+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyChatInvite;
26762676
break;
26772677
case PRIVACY_RULES_TYPE_CALLS:
2678-
req.key = new TLRPC.TL_inputPrivacyKeyPhoneCall();
2678+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyPhoneCall;
26792679
break;
26802680
case PRIVACY_RULES_TYPE_P2P:
2681-
req.key = new TLRPC.TL_inputPrivacyKeyPhoneP2P();
2681+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyPhoneP2P;
26822682
break;
26832683
case PRIVACY_RULES_TYPE_PHOTO:
2684-
req.key = new TLRPC.TL_inputPrivacyKeyProfilePhoto();
2684+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyProfilePhoto;
26852685
break;
26862686
case PRIVACY_RULES_TYPE_BIO:
2687-
req.key = new TLRPC.TL_inputPrivacyKeyAbout();
2687+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyAbout;
26882688
break;
26892689
case PRIVACY_RULES_TYPE_FORWARDS:
2690-
req.key = new TLRPC.TL_inputPrivacyKeyForwards();
2690+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyForwards;
26912691
break;
26922692
case PRIVACY_RULES_TYPE_PHONE:
2693-
req.key = new TLRPC.TL_inputPrivacyKeyPhoneNumber();
2693+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyPhoneNumber;
26942694
break;
26952695
case PRIVACY_RULES_TYPE_VOICE_MESSAGES:
2696-
req.key = new TLRPC.TL_inputPrivacyKeyVoiceMessages();
2696+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyVoiceMessages;
26972697
break;
26982698
case PRIVACY_RULES_TYPE_BIRTHDAY:
2699-
req.key = new TLRPC.TL_inputPrivacyKeyBirthday();
2699+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyBirthday;
27002700
break;
27012701
case PRIVACY_RULES_TYPE_GIFTS:
2702-
req.key = new TLRPC.TL_inputPrivacyKeyStarGiftsAutoSave();
2702+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyStarGiftsAutoSave;
27032703
break;
27042704
case PRIVACY_RULES_TYPE_NO_PAID_MESSAGES:
2705-
req.key = new TLRPC.TL_inputPrivacyKeyNoPaidMessages();
2705+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyNoPaidMessages;
27062706
break;
27072707
case PRIVACY_RULES_TYPE_ADDED_BY_PHONE:
2708-
req.key = new TLRPC.TL_inputPrivacyKeyAddedByPhone();
2708+
req.key = TLRPC.InputPrivacyKey.inputPrivacyKeyAddedByPhone;
27092709
break;
27102710
default:
27112711
continue;

‎TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18560,29 +18560,29 @@ public boolean processUpdateArray(ArrayList<TLRPC.Update> updates, ArrayList<TLR
1856018560
TLRPC.Update baseUpdate = updatesOnMainThreadFinal.get(a);
1856118561
if (baseUpdate instanceof TLRPC.TL_updatePrivacy) {
1856218562
TLRPC.TL_updatePrivacy update = (TLRPC.TL_updatePrivacy) baseUpdate;
18563-
if (update.key instanceof TLRPC.TL_privacyKeyStatusTimestamp) {
18563+
if (update.key == TLRPC.PrivacyKey.privacyKeyStatusTimestamp) {
1856418564
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_LASTSEEN);
18565-
} else if (update.key instanceof TLRPC.TL_privacyKeyChatInvite) {
18565+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyChatInvite) {
1856618566
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_INVITE);
18567-
} else if (update.key instanceof TLRPC.TL_privacyKeyPhoneCall) {
18567+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyPhoneCall) {
1856818568
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_CALLS);
18569-
} else if (update.key instanceof TLRPC.TL_privacyKeyPhoneP2P) {
18569+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyPhoneP2P) {
1857018570
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_P2P);
18571-
} else if (update.key instanceof TLRPC.TL_privacyKeyProfilePhoto) {
18571+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyProfilePhoto) {
1857218572
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_PHOTO);
18573-
} else if (update.key instanceof TLRPC.TL_privacyKeyForwards) {
18573+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyForwards) {
1857418574
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_FORWARDS);
18575-
} else if (update.key instanceof TLRPC.TL_privacyKeyPhoneNumber) {
18575+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyPhoneNumber) {
1857618576
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_PHONE);
18577-
} else if (update.key instanceof TLRPC.TL_privacyKeyAddedByPhone) {
18577+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyAddedByPhone) {
1857818578
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_ADDED_BY_PHONE);
18579-
} else if (update.key instanceof TLRPC.TL_privacyKeyVoiceMessages) {
18579+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyVoiceMessages) {
1858018580
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_VOICE_MESSAGES);
18581-
} else if (update.key instanceof TLRPC.TL_privacyKeyAbout) {
18581+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyAbout) {
1858218582
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_BIO);
18583-
} else if (update.key instanceof TLRPC.TL_privacyKeyBirthday) {
18583+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyBirthday) {
1858418584
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_BIRTHDAY);
18585-
} else if (update.key instanceof TLRPC.TL_privacyKeyStarGiftsAutoSave) {
18585+
} else if (update.key == TLRPC.PrivacyKey.privacyKeyStarGiftsAutoSave) {
1858618586
getContactsController().setPrivacyRules(update.rules, ContactsController.PRIVACY_RULES_TYPE_GIFTS);
1858718587
}
1858818588
} else if (baseUpdate instanceof TLRPC.TL_updateStarsRevenueStatus) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package org.telegram.tgnet;
2+
3+
public class TLEnum {
4+
public interface Constructor {
5+
int getConstructor();
6+
7+
default void serializeToStream(OutputSerializedData stream) {
8+
stream.writeInt32(getConstructor());
9+
}
10+
}
11+
12+
public static <E extends Enum<E> & Constructor> E TLdeserialize(Class<E> enumClass, int constructor, boolean exception) {
13+
final E result = fromConstructor(enumClass, constructor);
14+
15+
if (result == null) {
16+
if (exception) {
17+
throw new RuntimeException(String.format("can't parse magic %x in %s", constructor, enumClass.getName()));
18+
}
19+
20+
return null;
21+
}
22+
23+
return result;
24+
}
25+
26+
public static <E extends Enum<E> & Constructor> E fromConstructor(Class<E> enumClass, int constructor) {
27+
E[] enums = enumClass.getEnumConstants();
28+
if (enums == null) {
29+
return null;
30+
}
31+
32+
for (E e : enums) {
33+
if (e.getConstructor() == constructor) {
34+
return e;
35+
}
36+
}
37+
return null;
38+
}
39+
}

0 commit comments

Comments
 (0)