2014-03-23 00:20:13 +01:00
|
|
|
/*
|
2020-09-30 15:48:47 +02:00
|
|
|
* This is the source code of Telegram for Android v. 7.x.x.
|
2014-03-23 00:20:13 +01:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
2020-09-30 15:48:47 +02:00
|
|
|
* Copyright Nikolai Kudashov, 2013-2020.
|
2014-03-23 00:20:13 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.messenger;
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.SharedPreferences;
|
2021-11-05 11:06:49 +01:00
|
|
|
import android.os.Build;
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2022-09-16 20:48:21 +02:00
|
|
|
import com.android.billingclient.api.ProductDetails;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
2014-03-23 00:20:13 +01:00
|
|
|
public class BuildVars {
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2022-09-21 16:20:30 +02:00
|
|
|
public static boolean DEBUG_VERSION = BuildConfig.DEBUG_VERSION;
|
|
|
|
public static boolean LOGS_ENABLED = BuildConfig.DEBUG_VERSION;
|
|
|
|
public static boolean DEBUG_PRIVATE_VERSION = BuildConfig.DEBUG_PRIVATE_VERSION;
|
2019-01-23 18:03:33 +01:00
|
|
|
public static boolean USE_CLOUD_STRINGS = true;
|
2019-12-31 14:08:08 +01:00
|
|
|
public static boolean CHECK_UPDATES = true;
|
2021-11-05 11:06:49 +01:00
|
|
|
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
2023-03-08 08:27:18 +01:00
|
|
|
public static int BUILD_VERSION = 3195;
|
|
|
|
public static String BUILD_VERSION_STRING = "9.5.0";
|
2019-12-31 14:08:08 +01:00
|
|
|
public static int APP_ID = 4;
|
2022-07-04 13:54:30 +02:00
|
|
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
2022-06-28 12:00:33 +02:00
|
|
|
|
2023-02-03 20:11:36 +01:00
|
|
|
// SafetyNet key for Google Identity SDK, set it to empty to disable
|
|
|
|
public static String SAFETYNET_KEY = "AIzaSyDqt8P-7F7CPCseMkOiVRgb1LY8RN1bvH8";
|
2021-07-31 01:39:13 +02:00
|
|
|
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
|
2019-12-31 14:08:08 +01:00
|
|
|
public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger";
|
2022-09-16 20:48:21 +02:00
|
|
|
public static String GOOGLE_AUTH_CLIENT_ID = "760348033671-81kmi3pi84p11ub8hp9a1funsv0rn2p9.apps.googleusercontent.com";
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2022-08-12 17:23:51 +02:00
|
|
|
public static String HUAWEI_APP_ID = "101184875";
|
|
|
|
|
2022-06-21 04:51:00 +02:00
|
|
|
// You can use this flag to disable Google Play Billing (If you're making fork and want it to be in Google Play)
|
|
|
|
public static boolean IS_BILLING_UNAVAILABLE = false;
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
static {
|
|
|
|
if (ApplicationLoader.applicationContext != null) {
|
|
|
|
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
|
2021-06-25 02:43:10 +02:00
|
|
|
LOGS_ENABLED = DEBUG_VERSION || sharedPreferences.getBoolean("logsEnabled", DEBUG_VERSION);
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
|
|
|
}
|
2021-07-31 01:39:13 +02:00
|
|
|
|
2022-06-21 04:51:00 +02:00
|
|
|
public static boolean useInvoiceBilling() {
|
2022-09-16 20:48:21 +02:00
|
|
|
return DEBUG_VERSION || isStandaloneApp() || isBetaApp() || isHuaweiStoreApp() || hasDirectCurrency();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static boolean hasDirectCurrency() {
|
|
|
|
if (!BillingController.getInstance().isReady() || BillingController.PREMIUM_PRODUCT_DETAILS == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (ProductDetails.SubscriptionOfferDetails offerDetails : BillingController.PREMIUM_PRODUCT_DETAILS.getSubscriptionOfferDetails()) {
|
|
|
|
for (ProductDetails.PricingPhase phase : offerDetails.getPricingPhases().getPricingPhaseList()) {
|
|
|
|
for (String cur : MessagesController.getInstance(UserConfig.selectedAccount).directPaymentsCurrency) {
|
|
|
|
if (Objects.equals(phase.getPriceCurrencyCode(), cur)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2022-06-21 04:51:00 +02:00
|
|
|
}
|
|
|
|
|
2021-07-31 01:39:13 +02:00
|
|
|
private static Boolean standaloneApp;
|
|
|
|
public static boolean isStandaloneApp() {
|
|
|
|
if (standaloneApp == null) {
|
|
|
|
standaloneApp = ApplicationLoader.applicationContext != null && "org.telegram.messenger.web".equals(ApplicationLoader.applicationContext.getPackageName());
|
|
|
|
}
|
|
|
|
return standaloneApp;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Boolean betaApp;
|
|
|
|
public static boolean isBetaApp() {
|
|
|
|
if (betaApp == null) {
|
|
|
|
betaApp = ApplicationLoader.applicationContext != null && "org.telegram.messenger.beta".equals(ApplicationLoader.applicationContext.getPackageName());
|
|
|
|
}
|
|
|
|
return betaApp;
|
|
|
|
}
|
2022-08-12 17:23:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
public static boolean isHuaweiStoreApp() {
|
|
|
|
return ApplicationLoader.isHuaweiStoreBuild();
|
|
|
|
}
|
2014-03-23 00:20:13 +01:00
|
|
|
}
|