Update to 7.8.2 (2376)

Thanks to @alabiaga and @marcelpinto for help with improvements for Android 12.
https://github.com/DrKLO/Telegram/pull/1633
https://github.com/DrKLO/Telegram/pull/1636
https://github.com/DrKLO/Telegram/pull/1630
This commit is contained in:
DrKLO 2021-07-19 18:56:43 +03:00
parent 3ac3c37dd2
commit 7a60f948ae
83 changed files with 1038 additions and 877 deletions

View file

@ -65,16 +65,6 @@ public class UserConfig extends BaseController {
public volatile byte[] savedSaltedPassword;
public volatile long savedPasswordTime;
public String tonEncryptedData;
public String tonPublicKey;
public int tonPasscodeType = -1;
public byte[] tonPasscodeSalt;
public long tonPasscodeRetryInMs;
public long tonLastUptimeMillis;
public int tonBadPasscodeTries;
public String tonKeyName;
public boolean tonCreationFinished;
private static volatile UserConfig[] Instance = new UserConfig[UserConfig.MAX_ACCOUNT_COUNT];
public static UserConfig getInstance(int num) {
UserConfig localInstance = Instance[num];
@ -146,21 +136,6 @@ public class UserConfig extends BaseController {
editor.putInt("sharingMyLocationUntil", sharingMyLocationUntil);
editor.putInt("lastMyLocationShareTime", lastMyLocationShareTime);
editor.putBoolean("filtersLoaded", filtersLoaded);
if (tonEncryptedData != null) {
editor.putString("tonEncryptedData", tonEncryptedData);
editor.putString("tonPublicKey", tonPublicKey);
editor.putString("tonKeyName", tonKeyName);
editor.putBoolean("tonCreationFinished", tonCreationFinished);
if (tonPasscodeSalt != null) {
editor.putInt("tonPasscodeType", tonPasscodeType);
editor.putString("tonPasscodeSalt", Base64.encodeToString(tonPasscodeSalt, Base64.DEFAULT));
editor.putLong("tonPasscodeRetryInMs", tonPasscodeRetryInMs);
editor.putLong("tonLastUptimeMillis", tonLastUptimeMillis);
editor.putInt("tonBadPasscodeTries", tonBadPasscodeTries);
}
} else {
editor.remove("tonEncryptedData").remove("tonPublicKey").remove("tonKeyName").remove("tonPasscodeType").remove("tonPasscodeSalt").remove("tonPasscodeRetryInMs").remove("tonBadPasscodeTries").remove("tonLastUptimeMillis").remove("tonCreationFinished");
}
editor.putInt("6migrateOffsetId", migrateOffsetId);
if (migrateOffsetId != -1) {
@ -282,25 +257,9 @@ public class UserConfig extends BaseController {
notificationsSignUpSettingsLoaded = preferences.getBoolean("notificationsSignUpSettingsLoaded", false);
autoDownloadConfigLoadTime = preferences.getLong("autoDownloadConfigLoadTime", 0);
hasValidDialogLoadIds = preferences.contains("2dialogsLoadOffsetId") || preferences.getBoolean("hasValidDialogLoadIds", false);
tonEncryptedData = preferences.getString("tonEncryptedData", null);
tonPublicKey = preferences.getString("tonPublicKey", null);
tonKeyName = preferences.getString("tonKeyName", "walletKey" + currentAccount);
tonCreationFinished = preferences.getBoolean("tonCreationFinished", true);
sharingMyLocationUntil = preferences.getInt("sharingMyLocationUntil", 0);
lastMyLocationShareTime = preferences.getInt("lastMyLocationShareTime", 0);
filtersLoaded = preferences.getBoolean("filtersLoaded", false);
String salt = preferences.getString("tonPasscodeSalt", null);
if (salt != null) {
try {
tonPasscodeSalt = Base64.decode(salt, Base64.DEFAULT);
tonPasscodeType = preferences.getInt("tonPasscodeType", -1);
tonPasscodeRetryInMs = preferences.getLong("tonPasscodeRetryInMs", 0);
tonLastUptimeMillis = preferences.getLong("tonLastUptimeMillis", 0);
tonBadPasscodeTries = preferences.getInt("tonBadPasscodeTries", 0);
} catch (Exception e) {
FileLog.e(e);
}
}
try {
String terms = preferences.getString("terms", null);
@ -388,21 +347,8 @@ public class UserConfig extends BaseController {
}
}
public void clearTonConfig() {
tonEncryptedData = null;
tonKeyName = null;
tonPublicKey = null;
tonPasscodeType = -1;
tonPasscodeSalt = null;
tonCreationFinished = false;
tonPasscodeRetryInMs = 0;
tonLastUptimeMillis = 0;
tonBadPasscodeTries = 0;
}
public void clearConfig() {
getPreferences().edit().clear().commit();
clearTonConfig();
sharingMyLocationUntil = 0;
lastMyLocationShareTime = 0;