update to 9.4.0

This commit is contained in:
xaxtix 2023-02-03 23:11:36 +04:00
parent 2628a58147
commit 135e3cc766
433 changed files with 22076 additions and 6899 deletions

View file

@ -12,6 +12,9 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.util.Base64;
import android.util.LongSparseArray;
import android.util.SparseArray;
import android.util.SparseLongArray;
import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLRPC;
@ -78,6 +81,10 @@ public class UserConfig extends BaseController {
public volatile byte[] savedPasswordHash;
public volatile byte[] savedSaltedPassword;
public volatile long savedPasswordTime;
LongSparseArray<SaveToGallerySettingsHelper.DialogException> userSaveGalleryExceptions;
LongSparseArray<SaveToGallerySettingsHelper.DialogException> chanelSaveGalleryExceptions;
LongSparseArray<SaveToGallerySettingsHelper.DialogException> groupsSaveGalleryExceptions;
private static volatile UserConfig[] Instance = new UserConfig[UserConfig.MAX_ACCOUNT_COUNT];
public static UserConfig getInstance(int num) {
@ -415,6 +422,48 @@ public class UserConfig extends BaseController {
}
}
public LongSparseArray<SaveToGallerySettingsHelper.DialogException> getSaveGalleryExceptions(int type) {
if (type == SharedConfig.SAVE_TO_GALLERY_FLAG_PEER) {
if (userSaveGalleryExceptions == null) {
userSaveGalleryExceptions = SaveToGallerySettingsHelper.loadExceptions(ApplicationLoader.applicationContext.getSharedPreferences(SaveToGallerySettingsHelper.USERS_PREF_NAME + "_" + currentAccount, Context.MODE_PRIVATE));
}
return userSaveGalleryExceptions;
} else if (type == SharedConfig.SAVE_TO_GALLERY_FLAG_GROUP) {
if (groupsSaveGalleryExceptions == null) {
groupsSaveGalleryExceptions = SaveToGallerySettingsHelper.loadExceptions(ApplicationLoader.applicationContext.getSharedPreferences(SaveToGallerySettingsHelper.GROUPS_PREF_NAME + "_" + currentAccount, Context.MODE_PRIVATE));
}
return groupsSaveGalleryExceptions;
} else if (type == SharedConfig.SAVE_TO_GALLERY_FLAG_CHANNELS) {
if (chanelSaveGalleryExceptions == null) {
chanelSaveGalleryExceptions = SaveToGallerySettingsHelper.loadExceptions(ApplicationLoader.applicationContext.getSharedPreferences(SaveToGallerySettingsHelper.CHANNELS_PREF_NAME + "_" + currentAccount, Context.MODE_PRIVATE));
}
return chanelSaveGalleryExceptions;
}
return null;
}
public void updateSaveGalleryExceptions(int type, LongSparseArray<SaveToGallerySettingsHelper.DialogException> exceptions) {
if (type == SharedConfig.SAVE_TO_GALLERY_FLAG_PEER) {
userSaveGalleryExceptions = exceptions;
SaveToGallerySettingsHelper.saveExceptions(
ApplicationLoader.applicationContext.getSharedPreferences(SaveToGallerySettingsHelper.USERS_PREF_NAME + "_" + currentAccount, Context.MODE_PRIVATE),
userSaveGalleryExceptions
);
} else if (type == SharedConfig.SAVE_TO_GALLERY_FLAG_GROUP) {
groupsSaveGalleryExceptions = exceptions;
SaveToGallerySettingsHelper.saveExceptions(
ApplicationLoader.applicationContext.getSharedPreferences(SaveToGallerySettingsHelper.GROUPS_PREF_NAME + "_" + currentAccount, Context.MODE_PRIVATE),
groupsSaveGalleryExceptions
);
} else if (type == SharedConfig.SAVE_TO_GALLERY_FLAG_CHANNELS) {
chanelSaveGalleryExceptions = exceptions;
SaveToGallerySettingsHelper.saveExceptions(
ApplicationLoader.applicationContext.getSharedPreferences(SaveToGallerySettingsHelper.CHANNELS_PREF_NAME + "_" + currentAccount, Context.MODE_PRIVATE),
chanelSaveGalleryExceptions
);
}
}
public void clearConfig() {
getPreferences().edit().clear().apply();
@ -516,16 +565,7 @@ public class UserConfig extends BaseController {
}
public Long getEmojiStatus() {
if (currentUser == null) {
return null;
}
if (currentUser.emoji_status instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) currentUser.emoji_status).until > (int) (System.currentTimeMillis() / 1000)) {
return ((TLRPC.TL_emojiStatusUntil) currentUser.emoji_status).document_id;
}
if (currentUser.emoji_status instanceof TLRPC.TL_emojiStatus) {
return ((TLRPC.TL_emojiStatus) currentUser.emoji_status).document_id;
}
return null;
return UserObject.getEmojiStatusDocumentId(currentUser);
}