Skip to content

Commit 17067df

Browse files
committed
update to 11.9.0 (5837)
1 parent 7bfaa1c commit 17067df

File tree

92 files changed

+5364
-891
lines changed

Some content is hidden

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

92 files changed

+5364
-891
lines changed

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

+15-9
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ public void onPurchasesUpdatedInternal(@NonNull BillingResult billing, @Nullable
343343

344344
awaitingCount.incrementAndGet();
345345
AccountInstance acc = opayload.first;
346+
int requestFlags = ConnectionsManager.RequestFlagFailOnServerErrorsExceptFloodWait | ConnectionsManager.RequestFlagInvokeAfter;
347+
if (req.purpose instanceof TLRPC.TL_inputStorePaymentAuthCode) {
348+
requestFlags |= ConnectionsManager.RequestFlagWithoutLogin;
349+
}
346350
acc.getConnectionsManager().sendRequest(req, (response, error) -> {
347351
AndroidUtilities.runOnUIThread(() -> {
348352
if (progressDialog[0] != null) {
@@ -387,7 +391,7 @@ public void onPurchasesUpdatedInternal(@NonNull BillingResult billing, @Nullable
387391
}
388392
});
389393
}
390-
}, ConnectionsManager.RequestFlagFailOnServerErrorsExceptFloodWait | ConnectionsManager.RequestFlagInvokeAfter);
394+
}, requestFlags);
391395
} else {
392396
FileLog.d("BillingController.onPurchasesUpdatedInternal: " + purchase.getOrderId() + " purchase is purchased and acknowledged: consuming");
393397
awaitingCount.incrementAndGet();
@@ -413,13 +417,15 @@ public void onPurchasesUpdatedInternal(@NonNull BillingResult billing, @Nullable
413417
* All consumable purchases must be consumed. For us it is a gift.
414418
* Without confirmation the user will not be able to buy the product again.
415419
*/
416-
private void consumeGiftPurchase(Purchase purchase, TLRPC.InputStorePaymentPurpose purpose, Runnable onDone) {
417-
if (purpose instanceof TLRPC.TL_inputStorePaymentGiftPremium
418-
|| purpose instanceof TLRPC.TL_inputStorePaymentPremiumGiftCode
419-
|| purpose instanceof TLRPC.TL_inputStorePaymentStarsTopup
420-
|| purpose instanceof TLRPC.TL_inputStorePaymentStarsGift
421-
|| purpose instanceof TLRPC.TL_inputStorePaymentPremiumGiveaway
422-
|| purpose instanceof TLRPC.TL_inputStorePaymentStarsGiveaway) {
420+
public void consumeGiftPurchase(Purchase purchase, TLRPC.InputStorePaymentPurpose purpose, Runnable onDone) {
421+
if (purpose instanceof TLRPC.TL_inputStorePaymentGiftPremium ||
422+
purpose instanceof TLRPC.TL_inputStorePaymentPremiumGiftCode ||
423+
purpose instanceof TLRPC.TL_inputStorePaymentStarsTopup ||
424+
purpose instanceof TLRPC.TL_inputStorePaymentStarsGift ||
425+
purpose instanceof TLRPC.TL_inputStorePaymentPremiumGiveaway ||
426+
purpose instanceof TLRPC.TL_inputStorePaymentStarsGiveaway ||
427+
purpose instanceof TLRPC.TL_inputStorePaymentAuthCode
428+
) {
423429
FileLog.d("BillingController consumeGiftPurchase " + purpose + " " + purchase.getOrderId() + " " + purchase.getPurchaseToken());
424430
billingClient.consumeAsync(
425431
ConsumeParams.newBuilder()
@@ -532,6 +538,6 @@ public static String getResponseCodeString(int code) {
532538
case BillingClient.BillingResponseCode.ITEM_NOT_OWNED: return "ITEM_NOT_OWNED";
533539
case BillingClient.BillingResponseCode.NETWORK_ERROR: return "NETWORK_ERROR";
534540
}
535-
return null;
541+
return "BILLING_UNKNOWN_ERROR";
536542
}
537543
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,14 @@ public boolean isToday(long userId) {
295295
if (state != null && state.contains(userId))
296296
return true;
297297
final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(userId);
298-
if (userFull != null && isToday(userFull.birthday))
298+
if (userFull != null && isToday(userFull.birthday) && !UserObject.areGiftsDisabled(userFull))
299299
return true;
300300
return false;
301301
}
302302

303303
public static boolean isToday(TLRPC.UserFull userFull) {
304304
if (userFull == null) return false;
305-
return isToday(userFull.birthday);
305+
return isToday(userFull.birthday) && !UserObject.areGiftsDisabled(userFull);
306306
}
307307

308308
public static boolean isToday(TL_account.TL_birthday birthday) {

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.telegram.tgnet.TLRPC;
3838
import org.telegram.tgnet.Vector;
3939
import org.telegram.tgnet.tl.TL_account;
40-
import org.telegram.tgnet.tl.TL_stars;
4140
import org.telegram.ui.ActionBar.BaseFragment;
4241
import org.telegram.ui.Components.Bulletin;
4342

@@ -87,7 +86,7 @@ public class ContactsController extends BaseController {
8786
private ArrayList<TLRPC.PrivacyRule> birthdayPrivacyRules;
8887
private ArrayList<TLRPC.PrivacyRule> giftsPrivacyRules;
8988
private ArrayList<TLRPC.PrivacyRule> noPaidMessagesPrivacyRules;
90-
private TLRPC.TL_globalPrivacySettings globalPrivacySettings;
89+
private TLRPC.GlobalPrivacySettings globalPrivacySettings;
9190

9291
public final static int PRIVACY_RULES_TYPE_LASTSEEN = 0;
9392
public final static int PRIVACY_RULES_TYPE_INVITE = 1;
@@ -2630,7 +2629,7 @@ public void loadGlobalPrivacySetting() {
26302629
TL_account.getGlobalPrivacySettings req = new TL_account.getGlobalPrivacySettings();
26312630
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
26322631
if (error == null) {
2633-
globalPrivacySettings = (TLRPC.TL_globalPrivacySettings) response;
2632+
globalPrivacySettings = (TLRPC.GlobalPrivacySettings) response;
26342633
loadingGlobalSettings = 2;
26352634
} else {
26362635
loadingGlobalSettings = 0;
@@ -2790,7 +2789,7 @@ public boolean getLoadingPrivacyInfo(int type) {
27902789
return loadingPrivacyInfo[type] != 2;
27912790
}
27922791

2793-
public TLRPC.TL_globalPrivacySettings getGlobalPrivacySettings() {
2792+
public TLRPC.GlobalPrivacySettings getGlobalPrivacySettings() {
27942793
return globalPrivacySettings;
27952794
}
27962795

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ private PreloadRange(long o, long l) {
239239
private int cdnDatacenterId;
240240
private boolean reuploadingCdn;
241241
protected boolean requestingReference;
242+
private boolean requestedReference;
242243
private RandomAccessFile fileReadStream;
243244
private byte[] cdnCheckBytes;
244245
private boolean requestingCdnOffsets;
@@ -2217,6 +2218,7 @@ private void requestReference(RequestInfo requestInfo) {
22172218
}
22182219
clearOperation(null, false, false);
22192220
requestingReference = true;
2221+
requestedReference = true;
22202222
if (parentObject instanceof MessageObject) {
22212223
MessageObject messageObject = (MessageObject) parentObject;
22222224
if (messageObject.getId() < 0 && messageObject.messageOwner != null && messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null) {
@@ -2246,7 +2248,7 @@ protected void startDownloadRequest(int useConnectionType) {
22462248
(!isStory && streamPriorityStartOffset == 0 && (!nextPartWasPreloaded && (requestInfos.size() + delayedRequestInfos.size() >= currentMaxDownloadRequests))) ||
22472249
(isPreloadVideoOperation && (requestedBytesCount > preloadMaxBytes || moovFound != 0 && requestInfos.size() > 0))) {
22482250
if (BuildVars.LOGS_ENABLED && FULL_LOGS) {
2249-
FileLog.d(fileName + "can't start request wrong state: paused=" + paused + " reuploadingCdn=" + reuploadingCdn + " state=" + state + " requestingReference=" + requestingReference);
2251+
FileLog.d(fileName + " can't start request wrong state: paused=" + paused + " reuploadingCdn=" + reuploadingCdn + " state=" + state + " requestingReference=" + requestingReference);
22502252
}
22512253
return;
22522254
}
@@ -2259,6 +2261,12 @@ protected void startDownloadRequest(int useConnectionType) {
22592261
}
22602262
}
22612263

2264+
if (!requestedReference) {
2265+
if (FileRefController.getInstance(currentAccount).applyCachedFileReference(parentObject, location, this)) {
2266+
FileLog.d(fileName + " before download updated file ref from file ref cache!");
2267+
}
2268+
}
2269+
22622270
for (int a = 0; a < count; a++) {
22632271
long downloadOffset;
22642272
if (isPreloadVideoOperation) {

0 commit comments

Comments
 (0)