Update to 2.8.1

Thanks to https://github.com/DrKLO/Telegram/issues/738 for smart
notifications
This commit is contained in:
DrKLO 2015-05-03 14:48:36 +03:00
parent f6655078a1
commit 2b8304ebf4
557 changed files with 42344 additions and 13434 deletions

View file

@ -36,6 +36,7 @@ public class UserConfig {
public static int autoLockIn = 60 * 60;
public static int lastPauseTime = 0;
public static boolean isWaitingForPasscodeEnter = false;
public static int lastUpdateVersion;
public static int getNewMessageId() {
int id;
@ -71,6 +72,7 @@ public class UserConfig {
editor.putInt("passcodeType", passcodeType);
editor.putInt("autoLockIn", autoLockIn);
editor.putInt("lastPauseTime", lastPauseTime);
editor.putInt("lastUpdateVersion", lastUpdateVersion);
if (currentUser != null) {
if (withFile) {
@ -123,28 +125,28 @@ public class UserConfig {
if (configFile.exists()) {
try {
SerializedData data = new SerializedData(configFile);
int ver = data.readInt32();
int ver = data.readInt32(false);
if (ver == 1) {
int constructor = data.readInt32();
currentUser = (TLRPC.TL_userSelf)TLClassStore.Instance().TLdeserialize(data, constructor);
MessagesStorage.lastDateValue = data.readInt32();
MessagesStorage.lastPtsValue = data.readInt32();
MessagesStorage.lastSeqValue = data.readInt32();
registeredForPush = data.readBool();
pushString = data.readString();
lastSendMessageId = data.readInt32();
lastLocalId = data.readInt32();
contactsHash = data.readString();
importHash = data.readString();
saveIncomingPhotos = data.readBool();
int constructor = data.readInt32(false);
currentUser = TLRPC.TL_userSelf.TLdeserialize(data, constructor, false);
MessagesStorage.lastDateValue = data.readInt32(false);
MessagesStorage.lastPtsValue = data.readInt32(false);
MessagesStorage.lastSeqValue = data.readInt32(false);
registeredForPush = data.readBool(false);
pushString = data.readString(false);
lastSendMessageId = data.readInt32(false);
lastLocalId = data.readInt32(false);
contactsHash = data.readString(false);
importHash = data.readString(false);
saveIncomingPhotos = data.readBool(false);
contactsVersion = 0;
MessagesStorage.lastQtsValue = data.readInt32();
MessagesStorage.lastSecretVersion = data.readInt32();
int val = data.readInt32();
MessagesStorage.lastQtsValue = data.readInt32(false);
MessagesStorage.lastSecretVersion = data.readInt32(false);
int val = data.readInt32(false);
if (val == 1) {
MessagesStorage.secretPBytes = data.readByteArray();
MessagesStorage.secretPBytes = data.readByteArray(false);
}
MessagesStorage.secretG = data.readInt32();
MessagesStorage.secretG = data.readInt32(false);
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
@ -152,8 +154,8 @@ public class UserConfig {
}
});
} else if (ver == 2) {
int constructor = data.readInt32();
currentUser = (TLRPC.TL_userSelf)TLClassStore.Instance().TLdeserialize(data, constructor);
int constructor = data.readInt32(false);
currentUser = TLRPC.TL_userSelf.TLdeserialize(data, constructor, false);
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("userconfing", Context.MODE_PRIVATE);
registeredForPush = preferences.getBoolean("registeredForPush", false);
@ -199,12 +201,13 @@ public class UserConfig {
passcodeType = preferences.getInt("passcodeType", 0);
autoLockIn = preferences.getInt("autoLockIn", 60 * 60);
lastPauseTime = preferences.getInt("lastPauseTime", 0);
lastUpdateVersion = preferences.getInt("lastUpdateVersion", 511);
String user = preferences.getString("user", null);
if (user != null) {
byte[] userBytes = Base64.decode(user, Base64.DEFAULT);
if (userBytes != null) {
SerializedData data = new SerializedData(userBytes);
currentUser = (TLRPC.TL_userSelf)TLClassStore.Instance().TLdeserialize(data, data.readInt32());
currentUser = TLRPC.TL_userSelf.TLdeserialize(data, data.readInt32(false), false);
data.cleanup();
}
}
@ -229,6 +232,7 @@ public class UserConfig {
autoLockIn = 60 * 60;
lastPauseTime = 0;
isWaitingForPasscodeEnter = false;
lastUpdateVersion = BuildVars.BUILD_VERSION;
saveConfig(true);
}
}