mirror of
https://github.com/wrwrabbit/Partisan-Telegram-Android.git
synced 2026-05-03 06:20:11 +00:00
Update to 4.9.1
This commit is contained in:
parent
d073b80063
commit
fe599cd519
663 changed files with 40241 additions and 34380 deletions
|
|
@ -16,11 +16,14 @@ import android.os.SystemClock;
|
|||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.SerializedData;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class SharedConfig {
|
||||
|
||||
|
|
@ -46,6 +49,10 @@ public class SharedConfig {
|
|||
public static int suggestStickers;
|
||||
private static int lastLocalId = -210000;
|
||||
|
||||
private static String passportConfigJson = "";
|
||||
private static HashMap<String, String> passportConfigMap;
|
||||
public static int passportConfigHash;
|
||||
|
||||
private static boolean configLoaded;
|
||||
private static final Object sync = new Object();
|
||||
private static final Object localIdSync = new Object();
|
||||
|
|
@ -135,6 +142,8 @@ public class SharedConfig {
|
|||
editor.putString("pushString2", pushString);
|
||||
editor.putString("pushAuthKey", pushAuthKey != null ? Base64.encodeToString(pushAuthKey, Base64.DEFAULT) : "");
|
||||
editor.putInt("lastLocalId", lastLocalId);
|
||||
editor.putString("passportConfigJson", passportConfigJson);
|
||||
editor.putInt("passportConfigHash", passportConfigHash);
|
||||
editor.commit();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
|
@ -172,6 +181,8 @@ public class SharedConfig {
|
|||
allowScreenCapture = preferences.getBoolean("allowScreenCapture", false);
|
||||
lastLocalId = preferences.getInt("lastLocalId", -210000);
|
||||
pushString = preferences.getString("pushString2", "");
|
||||
passportConfigJson = preferences.getString("passportConfigJson", "");
|
||||
passportConfigHash = preferences.getInt("passportConfigHash", 0);
|
||||
String authKeyString = preferences.getString("pushAuthKey", null);
|
||||
if (!TextUtils.isEmpty(authKeyString)) {
|
||||
pushAuthKey = Base64.decode(authKeyString, Base64.DEFAULT);
|
||||
|
|
@ -242,6 +253,35 @@ public class SharedConfig {
|
|||
saveConfig();
|
||||
}
|
||||
|
||||
public static boolean isPassportConfigLoaded() {
|
||||
return passportConfigMap != null;
|
||||
}
|
||||
|
||||
public static void setPassportConfig(String json, int hash) {
|
||||
passportConfigMap = null;
|
||||
passportConfigJson = json;
|
||||
passportConfigHash = hash;
|
||||
saveConfig();
|
||||
getCountryLangs();
|
||||
}
|
||||
|
||||
public static HashMap<String, String> getCountryLangs() {
|
||||
if (passportConfigMap == null) {
|
||||
passportConfigMap = new HashMap<>();
|
||||
try {
|
||||
JSONObject object = new JSONObject(passportConfigJson);
|
||||
Iterator<String> iter = object.keys();
|
||||
while (iter.hasNext()) {
|
||||
String key = iter.next();
|
||||
passportConfigMap.put(key.toUpperCase(), object.getString(key).toUpperCase());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
return passportConfigMap;
|
||||
}
|
||||
|
||||
public static boolean checkPasscode(String passcode) {
|
||||
if (passcodeSalt.length == 0) {
|
||||
boolean result = Utilities.MD5(passcode).equals(passcodeHash);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue