Update to 5.13.0 (1818)

This commit is contained in:
DrKLO 2019-12-31 16:08:08 +03:00
parent 28eb8dfd0e
commit f41b228a11
2574 changed files with 1023378 additions and 62330 deletions

View file

@ -49,7 +49,6 @@ public class SharedConfig {
public static int autoLockIn = 60 * 60;
public static boolean allowScreenCapture;
public static int lastPauseTime;
public static long lastAppPauseTime;
public static boolean isWaitingForPasscodeEnter;
public static boolean useFingerprint = true;
public static String lastUpdateVersion;
@ -57,6 +56,9 @@ public class SharedConfig {
public static boolean loopStickers;
public static int keepMedia = 2;
public static int lastKeepMediaCheckTime;
public static int searchMessagesAsListHintShows;
public static int textSelectionHintShows;
public static boolean searchMessagesAsListUsed;
private static int lastLocalId = -210000;
private static String passportConfigJson = "";
@ -82,6 +84,7 @@ public class SharedConfig {
public static boolean streamMkv = false;
public static boolean saveStreamMedia = true;
public static boolean sortContactsByName;
public static boolean sortFilesByName;
public static boolean shuffleMusic;
public static boolean playOrderReversed;
public static boolean hasCameraCache;
@ -90,6 +93,7 @@ public class SharedConfig {
public static boolean allowBigEmoji;
public static boolean useSystemEmoji;
public static int fontSize = AndroidUtilities.dp(16);
public static int ivFontSize = AndroidUtilities.dp(16);
private static int devicePerformanceClass;
public static boolean drawDialogIcons;
@ -156,7 +160,6 @@ public class SharedConfig {
editor.putInt("badPasscodeTries", badPasscodeTries);
editor.putInt("autoLockIn", autoLockIn);
editor.putInt("lastPauseTime", lastPauseTime);
editor.putLong("lastAppPauseTime", lastAppPauseTime);
editor.putString("lastUpdateVersion2", lastUpdateVersion);
editor.putBoolean("useFingerprint", useFingerprint);
editor.putBoolean("allowScreenCapture", allowScreenCapture);
@ -166,6 +169,8 @@ public class SharedConfig {
editor.putString("passportConfigJson", passportConfigJson);
editor.putInt("passportConfigHash", passportConfigHash);
editor.putBoolean("sortContactsByName", sortContactsByName);
editor.putBoolean("sortFilesByName", sortFilesByName);
editor.putInt("textSelectionHintShows", textSelectionHintShows);
editor.commit();
} catch (Exception e) {
FileLog.e(e);
@ -197,7 +202,6 @@ public class SharedConfig {
badPasscodeTries = preferences.getInt("badPasscodeTries", 0);
autoLockIn = preferences.getInt("autoLockIn", 60 * 60);
lastPauseTime = preferences.getInt("lastPauseTime", 0);
lastAppPauseTime = preferences.getLong("lastAppPauseTime", 0);
useFingerprint = preferences.getBoolean("useFingerprint", true);
lastUpdateVersion = preferences.getString("lastUpdateVersion2", "3.5");
allowScreenCapture = preferences.getBoolean("allowScreenCapture", false);
@ -211,7 +215,7 @@ public class SharedConfig {
}
if (passcodeHash.length() > 0 && lastPauseTime == 0) {
lastPauseTime = (int) (System.currentTimeMillis() / 1000 - 60 * 10);
lastPauseTime = (int) (SystemClock.uptimeMillis() / 1000 - 60 * 10);
}
String passcodeSaltString = preferences.getString("passcodeSalt", "");
@ -236,6 +240,7 @@ public class SharedConfig {
roundCamera16to9 = true;//preferences.getBoolean("roundCamera16to9", false);
repeatMode = preferences.getInt("repeatMode", 0);
fontSize = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16);
ivFontSize = preferences.getInt("iv_font_size", fontSize);
allowBigEmoji = preferences.getBoolean("allowBigEmoji", true);
useSystemEmoji = preferences.getBoolean("useSystemEmoji", false);
streamMedia = preferences.getBoolean("streamMedia", true);
@ -244,6 +249,7 @@ public class SharedConfig {
streamMkv = preferences.getBoolean("streamMkv", false);
suggestStickers = preferences.getInt("suggestStickers", 0);
sortContactsByName = preferences.getBoolean("sortContactsByName", false);
sortFilesByName = preferences.getBoolean("sortFilesByName", false);
noSoundHintShowed = preferences.getBoolean("noSoundHintShowed", false);
directShareHash = preferences.getLong("directShareHash", 0);
useThreeLinesLayout = preferences.getBoolean("useThreeLinesLayout", false);
@ -253,6 +259,9 @@ public class SharedConfig {
loopStickers = preferences.getBoolean("loopStickers", true);
keepMedia = preferences.getInt("keep_media", 2);
lastKeepMediaCheckTime = preferences.getInt("lastKeepMediaCheckTime", 0);
searchMessagesAsListHintShows = preferences.getInt("searchMessagesAsListHintShows", 0);
searchMessagesAsListUsed = preferences.getBoolean("searchMessagesAsListUsed", false);
textSelectionHintShows = preferences.getInt("textSelectionHintShows", 0);
preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
showNotificationsForAllAccounts = preferences.getBoolean("AllAccounts", true);
@ -368,6 +377,7 @@ public class SharedConfig {
isWaitingForPasscodeEnter = false;
allowScreenCapture = false;
lastUpdateVersion = BuildVars.BUILD_VERSION_STRING;
textSelectionHintShows = 0;
saveConfig();
}
@ -379,6 +389,35 @@ public class SharedConfig {
editor.commit();
}
public static void setSearchMessagesAsListUsed(boolean searchMessagesAsListUsed) {
SharedConfig.searchMessagesAsListUsed = searchMessagesAsListUsed;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("searchMessagesAsListUsed", searchMessagesAsListUsed);
editor.commit();
}
public static void increaseTextSelectionHintShowed() {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("textSelectionHintShows", ++textSelectionHintShows);
editor.commit();
}
public static void removeTextSelectionHint() {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("textSelectionHintShows", 3);
editor.commit();
}
public static void increaseSearchAsListHintShows() {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("searchMessagesAsListHintShows", ++searchMessagesAsListHintShows);
editor.commit();
}
public static void setKeepMedia(int value) {
keepMedia = value;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
@ -389,27 +428,39 @@ public class SharedConfig {
public static void checkKeepMedia() {
int time = (int) (System.currentTimeMillis() / 1000);
if (keepMedia == 2 || Math.abs(time - lastKeepMediaCheckTime) < 24 * 60 * 60) {
if (Math.abs(time - lastKeepMediaCheckTime) < 60 * 60) {
return;
}
lastKeepMediaCheckTime = time;
File cacheDir = FileLoader.checkDirectory(FileLoader.MEDIA_DIR_CACHE);
Utilities.globalQueue.postRunnable(() -> {
int days;
if (keepMedia == 0) {
days = 7;
} else if (keepMedia == 1) {
days = 30;
} else {
days = 3;
}
long currentTime = time - 60 * 60 * 24 * days;
final SparseArray<File> paths = ImageLoader.getInstance().createMediaPaths();
for (int a = 0; a < paths.size(); a++) {
if (paths.keyAt(a) == FileLoader.MEDIA_DIR_CACHE) {
continue;
if (keepMedia != 2) {
int days;
if (keepMedia == 0) {
days = 7;
} else if (keepMedia == 1) {
days = 30;
} else {
days = 3;
}
long currentTime = time - 60 * 60 * 24 * days;
final SparseArray<File> paths = ImageLoader.getInstance().createMediaPaths();
for (int a = 0; a < paths.size(); a++) {
if (paths.keyAt(a) == FileLoader.MEDIA_DIR_CACHE) {
continue;
}
try {
Utilities.clearDir(paths.valueAt(a).getAbsolutePath(), 0, currentTime, false);
} catch (Throwable e) {
FileLog.e(e);
}
}
}
File stickersPath = new File(cacheDir, "acache");
if (stickersPath.exists()) {
long currentTime = time - 60 * 60 * 24;
try {
Utilities.clearDir(paths.valueAt(a).getAbsolutePath(), 0, currentTime);
Utilities.clearDir(stickersPath.getAbsolutePath(), 0, currentTime, false);
} catch (Throwable e) {
FileLog.e(e);
}
@ -568,6 +619,14 @@ public class SharedConfig {
editor.commit();
}
public static void toggleSortFilesByName() {
sortFilesByName = !sortFilesByName;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("sortFilesByName", sortFilesByName);
editor.commit();
}
public static void toggleStreamAllVideo() {
streamAllVideo = !streamAllVideo;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
@ -761,7 +820,7 @@ public class SharedConfig {
int memoryClass = ((ActivityManager) ApplicationLoader.applicationContext.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
if (androidVersion < 21 || cpuCount <= 2 || memoryClass <= 100 || cpuCount <= 4 && maxCpuFreq != -1 && maxCpuFreq <= 1250 || cpuCount <= 4 && maxCpuFreq <= 1600 && memoryClass <= 128 && androidVersion <= 21) {
devicePerformanceClass = PERFORMANCE_CLASS_LOW;
} else if (cpuCount < 8 || memoryClass <= 160 || maxCpuFreq != -1 && maxCpuFreq <= 1650) {
} else if (cpuCount < 8 || memoryClass <= 160 || maxCpuFreq != -1 && maxCpuFreq <= 1650 || maxCpuFreq == -1 && cpuCount == 8 && androidVersion <= 23) {
devicePerformanceClass = PERFORMANCE_CLASS_AVERAGE;
} else {
devicePerformanceClass = PERFORMANCE_CLASS_HIGH;