Update to 7.8.1

This commit is contained in:
DrKLO 2021-07-15 17:24:57 +03:00
parent dd2b001b95
commit 3ac3c37dd2
429 changed files with 138188 additions and 2463 deletions

View file

@ -117,104 +117,106 @@ public class UserConfig extends BaseController {
}
public void saveConfig(boolean withFile, File oldFile) {
synchronized (sync) {
try {
SharedPreferences.Editor editor = getPreferences().edit();
if (currentAccount == 0) {
editor.putInt("selectedAccount", selectedAccount);
}
editor.putBoolean("registeredForPush", registeredForPush);
editor.putInt("lastSendMessageId", lastSendMessageId);
editor.putInt("contactsSavedCount", contactsSavedCount);
editor.putInt("lastBroadcastId", lastBroadcastId);
editor.putInt("lastContactsSyncTime", lastContactsSyncTime);
editor.putInt("lastHintsSyncTime", lastHintsSyncTime);
editor.putBoolean("draftsLoaded", draftsLoaded);
editor.putBoolean("unreadDialogsLoaded", unreadDialogsLoaded);
editor.putInt("ratingLoadTime", ratingLoadTime);
editor.putInt("botRatingLoadTime", botRatingLoadTime);
editor.putBoolean("contactsReimported", contactsReimported);
editor.putInt("loginTime", loginTime);
editor.putBoolean("syncContacts", syncContacts);
editor.putBoolean("suggestContacts", suggestContacts);
editor.putBoolean("hasSecureData", hasSecureData);
editor.putBoolean("notificationsSettingsLoaded3", notificationsSettingsLoaded);
editor.putBoolean("notificationsSignUpSettingsLoaded", notificationsSignUpSettingsLoaded);
editor.putLong("autoDownloadConfigLoadTime", autoDownloadConfigLoadTime);
editor.putBoolean("hasValidDialogLoadIds", hasValidDialogLoadIds);
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);
NotificationCenter.getInstance(currentAccount).doOnIdle(() -> {
synchronized (sync) {
try {
SharedPreferences.Editor editor = getPreferences().edit();
if (currentAccount == 0) {
editor.putInt("selectedAccount", selectedAccount);
}
} 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) {
editor.putInt("6migrateOffsetDate", migrateOffsetDate);
editor.putInt("6migrateOffsetUserId", migrateOffsetUserId);
editor.putInt("6migrateOffsetChatId", migrateOffsetChatId);
editor.putInt("6migrateOffsetChannelId", migrateOffsetChannelId);
editor.putLong("6migrateOffsetAccess", migrateOffsetAccess);
}
if (unacceptedTermsOfService != null) {
try {
SerializedData data = new SerializedData(unacceptedTermsOfService.getObjectSize());
unacceptedTermsOfService.serializeToStream(data);
editor.putString("terms", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
data.cleanup();
} catch (Exception ignore) {
editor.putBoolean("registeredForPush", registeredForPush);
editor.putInt("lastSendMessageId", lastSendMessageId);
editor.putInt("contactsSavedCount", contactsSavedCount);
editor.putInt("lastBroadcastId", lastBroadcastId);
editor.putInt("lastContactsSyncTime", lastContactsSyncTime);
editor.putInt("lastHintsSyncTime", lastHintsSyncTime);
editor.putBoolean("draftsLoaded", draftsLoaded);
editor.putBoolean("unreadDialogsLoaded", unreadDialogsLoaded);
editor.putInt("ratingLoadTime", ratingLoadTime);
editor.putInt("botRatingLoadTime", botRatingLoadTime);
editor.putBoolean("contactsReimported", contactsReimported);
editor.putInt("loginTime", loginTime);
editor.putBoolean("syncContacts", syncContacts);
editor.putBoolean("suggestContacts", suggestContacts);
editor.putBoolean("hasSecureData", hasSecureData);
editor.putBoolean("notificationsSettingsLoaded3", notificationsSettingsLoaded);
editor.putBoolean("notificationsSignUpSettingsLoaded", notificationsSignUpSettingsLoaded);
editor.putLong("autoDownloadConfigLoadTime", autoDownloadConfigLoadTime);
editor.putBoolean("hasValidDialogLoadIds", hasValidDialogLoadIds);
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");
}
} else {
editor.remove("terms");
}
SharedConfig.saveConfig();
editor.putInt("6migrateOffsetId", migrateOffsetId);
if (migrateOffsetId != -1) {
editor.putInt("6migrateOffsetDate", migrateOffsetDate);
editor.putInt("6migrateOffsetUserId", migrateOffsetUserId);
editor.putInt("6migrateOffsetChatId", migrateOffsetChatId);
editor.putInt("6migrateOffsetChannelId", migrateOffsetChannelId);
editor.putLong("6migrateOffsetAccess", migrateOffsetAccess);
}
if (tmpPassword != null) {
SerializedData data = new SerializedData();
tmpPassword.serializeToStream(data);
String string = Base64.encodeToString(data.toByteArray(), Base64.DEFAULT);
editor.putString("tmpPassword", string);
data.cleanup();
} else {
editor.remove("tmpPassword");
}
if (unacceptedTermsOfService != null) {
try {
SerializedData data = new SerializedData(unacceptedTermsOfService.getObjectSize());
unacceptedTermsOfService.serializeToStream(data);
editor.putString("terms", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
data.cleanup();
} catch (Exception ignore) {
if (currentUser != null) {
if (withFile) {
}
} else {
editor.remove("terms");
}
SharedConfig.saveConfig();
if (tmpPassword != null) {
SerializedData data = new SerializedData();
currentUser.serializeToStream(data);
tmpPassword.serializeToStream(data);
String string = Base64.encodeToString(data.toByteArray(), Base64.DEFAULT);
editor.putString("user", string);
editor.putString("tmpPassword", string);
data.cleanup();
} else {
editor.remove("tmpPassword");
}
} else {
editor.remove("user");
}
editor.commit();
if (oldFile != null) {
oldFile.delete();
if (currentUser != null) {
if (withFile) {
SerializedData data = new SerializedData();
currentUser.serializeToStream(data);
String string = Base64.encodeToString(data.toByteArray(), Base64.DEFAULT);
editor.putString("user", string);
data.cleanup();
}
} else {
editor.remove("user");
}
editor.commit();
if (oldFile != null) {
oldFile.delete();
}
} catch (Exception e) {
FileLog.e(e);
}
} catch (Exception e) {
FileLog.e(e);
}
}
});
}
public static boolean isValidAccount(int num) {