mirror of https://github.com/NekoX-Dev/NekoX.git
Add allow secret chat option
This commit is contained in:
parent
9137c1c29e
commit
397e9e899a
|
@ -32,6 +32,7 @@ import java.util.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import tw.nekomimi.nekogram.NekoConfig;
|
||||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||||
|
|
||||||
public class SecretChatHelper extends BaseController {
|
public class SecretChatHelper extends BaseController {
|
||||||
|
@ -187,6 +188,11 @@ public class SecretChatHelper extends BaseController {
|
||||||
TLRPC.EncryptedChat existingChat = getMessagesController().getEncryptedChatDB(newChat.id, false);
|
TLRPC.EncryptedChat existingChat = getMessagesController().getEncryptedChatDB(newChat.id, false);
|
||||||
|
|
||||||
if (newChat instanceof TLRPC.TL_encryptedChatRequested && existingChat == null) {
|
if (newChat instanceof TLRPC.TL_encryptedChatRequested && existingChat == null) {
|
||||||
|
if (!NekoConfig.acceptSecretChat) {
|
||||||
|
declineSecretChat(newChat.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int user_id = newChat.participant_id;
|
int user_id = newChat.participant_id;
|
||||||
if (user_id == getUserConfig().getClientUserId()) {
|
if (user_id == getUserConfig().getClientUserId()) {
|
||||||
user_id = newChat.admin_id;
|
user_id = newChat.admin_id;
|
||||||
|
|
|
@ -2861,7 +2861,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
SharedConfig.inappCamera ? LocaleController.getString("DebugMenuDisableCamera", R.string.DebugMenuDisableCamera) : LocaleController.getString("DebugMenuEnableCamera", R.string.DebugMenuEnableCamera),
|
SharedConfig.inappCamera ? LocaleController.getString("DebugMenuDisableCamera", R.string.DebugMenuDisableCamera) : LocaleController.getString("DebugMenuEnableCamera", R.string.DebugMenuEnableCamera),
|
||||||
LocaleController.getString("DebugMenuClearMediaCache", R.string.DebugMenuClearMediaCache),
|
LocaleController.getString("DebugMenuClearMediaCache", R.string.DebugMenuClearMediaCache),
|
||||||
LocaleController.getString("DebugMenuCallSettings", R.string.DebugMenuCallSettings),
|
LocaleController.getString("DebugMenuCallSettings", R.string.DebugMenuCallSettings),
|
||||||
NekoConfig.residentNotification ? LocaleController.getString("DisableResidentNotification", R.string.DisableResidentNotification) : LocaleController.getString("EnableResidentNotification", R.string.EnableResidentNotification),
|
null,
|
||||||
BuildVars.DEBUG_PRIVATE_VERSION ? "Check for app updates" : null,
|
BuildVars.DEBUG_PRIVATE_VERSION ? "Check for app updates" : null,
|
||||||
LocaleController.getString("DebugMenuReadAllDialogs", R.string.DebugMenuReadAllDialogs),
|
LocaleController.getString("DebugMenuReadAllDialogs", R.string.DebugMenuReadAllDialogs),
|
||||||
SharedConfig.pauseMusicOnRecord ? LocaleController.getString("DebugMenuDisablePauseMusic", R.string.DebugMenuDisablePauseMusic) : LocaleController.getString("DebugMenuEnablePauseMusic", R.string.DebugMenuEnablePauseMusic),
|
SharedConfig.pauseMusicOnRecord ? LocaleController.getString("DebugMenuDisablePauseMusic", R.string.DebugMenuDisablePauseMusic) : LocaleController.getString("DebugMenuEnablePauseMusic", R.string.DebugMenuEnablePauseMusic),
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class NekoConfig {
|
||||||
|
|
||||||
public static String ccToLang;
|
public static String ccToLang;
|
||||||
public static String ccInputLang;
|
public static String ccInputLang;
|
||||||
public static boolean increaseVoiceMessageQuality = false;
|
public static boolean increaseVoiceMessageQuality;
|
||||||
|
|
||||||
public static boolean hideProxyByDefault;
|
public static boolean hideProxyByDefault;
|
||||||
public static boolean useProxyItem;
|
public static boolean useProxyItem;
|
||||||
|
@ -124,6 +124,7 @@ public class NekoConfig {
|
||||||
public static boolean useChatAttachMediaMenu;
|
public static boolean useChatAttachMediaMenu;
|
||||||
public static boolean disableLinkPreviewByDefault;
|
public static boolean disableLinkPreviewByDefault;
|
||||||
public static boolean sendCommentAfterForward;
|
public static boolean sendCommentAfterForward;
|
||||||
|
public static boolean acceptSecretChat;
|
||||||
|
|
||||||
public static String getOpenPGPAppName() {
|
public static String getOpenPGPAppName() {
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ public class NekoConfig {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocaleController.getString("None",R.string.None);
|
return LocaleController.getString("None", R.string.None);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,8 +253,8 @@ public class NekoConfig {
|
||||||
|
|
||||||
proxyAutoSwitch = preferences.getBoolean("proxy_auto_switch", false);
|
proxyAutoSwitch = preferences.getBoolean("proxy_auto_switch", false);
|
||||||
//preferences.getBoolean("usePersianCalender", false);
|
//preferences.getBoolean("usePersianCalender", false);
|
||||||
openPGPApp = preferences.getString("openPGPApp","");
|
openPGPApp = preferences.getString("openPGPApp", "");
|
||||||
openPGPKeyId = preferences.getLong("openPGPKeyId",0L);
|
openPGPKeyId = preferences.getLong("openPGPKeyId", 0L);
|
||||||
|
|
||||||
disableVibration = preferences.getBoolean("disableVibration", false);
|
disableVibration = preferences.getBoolean("disableVibration", false);
|
||||||
autoPauseVideo = preferences.getBoolean("autoPauseVideo", false);
|
autoPauseVideo = preferences.getBoolean("autoPauseVideo", false);
|
||||||
|
@ -264,6 +265,7 @@ public class NekoConfig {
|
||||||
disableLinkPreviewByDefault = preferences.getBoolean("disableLinkPreviewByDefault", false);
|
disableLinkPreviewByDefault = preferences.getBoolean("disableLinkPreviewByDefault", false);
|
||||||
sendCommentAfterForward = preferences.getBoolean("sendCommentAfterForward", true);
|
sendCommentAfterForward = preferences.getBoolean("sendCommentAfterForward", true);
|
||||||
increaseVoiceMessageQuality = preferences.getBoolean("increaseVoiceMessageQuality", true);
|
increaseVoiceMessageQuality = preferences.getBoolean("increaseVoiceMessageQuality", true);
|
||||||
|
acceptSecretChat = preferences.getBoolean("acceptSecretChat", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,28 +489,12 @@ public class NekoConfig {
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static void toggleShowHiddenFeature() {
|
|
||||||
showHiddenFeature = !showHiddenFeature;
|
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean("showHiddenFeature", showHiddenFeature);
|
|
||||||
editor.commit();
|
|
||||||
} */
|
|
||||||
|
|
||||||
public static void toggleHideKeyboardOnChatScroll() {
|
public static void toggleHideKeyboardOnChatScroll() {
|
||||||
hideKeyboardOnChatScroll = !hideKeyboardOnChatScroll;
|
preferences.edit().putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll = !hideKeyboardOnChatScroll).apply();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll);
|
|
||||||
editor.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleAvatarAsDrawerBackground() {
|
public static void toggleAvatarAsDrawerBackground() {
|
||||||
avatarAsDrawerBackground = !avatarAsDrawerBackground;
|
preferences.edit().putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground = !avatarAsDrawerBackground).apply();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground);
|
|
||||||
editor.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleUseSystemEmoji() {
|
public static void toggleUseSystemEmoji() {
|
||||||
|
@ -520,309 +506,206 @@ public class NekoConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSortByUnread() {
|
public static void toggleSortByUnread() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("sort_by_unread", sortByUnread = !sortByUnread).apply();
|
preferences.edit().putBoolean("sort_by_unread", sortByUnread = !sortByUnread).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleShowTabsOnForward() {
|
public static void toggleShowTabsOnForward() {
|
||||||
showTabsOnForward = !showTabsOnForward;
|
preferences.edit().putBoolean("showTabsOnForward", showTabsOnForward = !showTabsOnForward).apply();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean("showTabsOnForward", showTabsOnForward);
|
|
||||||
editor.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleRearVideoMessages() {
|
public static void toggleRearVideoMessages() {
|
||||||
rearVideoMessages = !rearVideoMessages;
|
preferences.edit().putBoolean("rearVideoMessages", rearVideoMessages = !rearVideoMessages).apply();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean("rearVideoMessages", rearVideoMessages);
|
|
||||||
editor.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleHideAllTab() {
|
public static void toggleHideAllTab() {
|
||||||
hideAllTab = !hideAllTab;
|
preferences.edit().putBoolean("hideAllTab", hideAllTab = !hideAllTab).apply();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean("hideAllTab", hideAllTab);
|
|
||||||
editor.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSortByUnmuted() {
|
public static void toggleSortByUnmuted() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("sort_by_unmuted", sortByUnmuted = !sortByUnmuted).apply();
|
preferences.edit().putBoolean("sort_by_unmuted", sortByUnmuted = !sortByUnmuted).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSortByUser() {
|
public static void toggleSortByUser() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("sort_by_user", sortByUser = !sortByUser).apply();
|
preferences.edit().putBoolean("sort_by_user", sortByUser = !sortByUser).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSortByContacts() {
|
public static void toggleSortByContacts() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("sort_by_contacts", sortByContacts = !sortByContacts).apply();
|
preferences.edit().putBoolean("sort_by_contacts", sortByContacts = !sortByContacts).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableUndo() {
|
public static void toggleDisableUndo() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("disable_undo", disableUndo = !disableUndo).apply();
|
preferences.edit().putBoolean("disable_undo", disableUndo = !disableUndo).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterUsers() {
|
public static void toggleFilterUsers() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_users", filterUsers = !filterUsers).apply();
|
preferences.edit().putBoolean("filter_users", filterUsers = !filterUsers).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterContacts() {
|
public static void toggleFilterContacts() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_contacts", filterContacts = !filterContacts).apply();
|
preferences.edit().putBoolean("filter_contacts", filterContacts = !filterContacts).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterGroups() {
|
public static void toggleFilterGroups() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filterGroups", filterGroups = !filterGroups).apply();
|
preferences.edit().putBoolean("filterGroups", filterGroups = !filterGroups).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterChannels() {
|
public static void toggleFilterChannels() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_channels", filterChannels = !filterChannels).apply();
|
preferences.edit().putBoolean("filter_channels", filterChannels = !filterChannels).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterBots() {
|
public static void toggleFilterBots() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_bots", filterBots = !filterBots).apply();
|
preferences.edit().putBoolean("filter_bots", filterBots = !filterBots).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterAdmins() {
|
public static void toggleFilterAdmins() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_admins", filterAdmins = !filterAdmins).apply();
|
preferences.edit().putBoolean("filter_admins", filterAdmins = !filterAdmins).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterUnmuted() {
|
public static void toggleFilterUnmuted() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_unmuted", filterUnmuted = !filterUnmuted).apply();
|
preferences.edit().putBoolean("filter_unmuted", filterUnmuted = !filterUnmuted).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableFilterUnread() {
|
public static void toggleDisableFilterUnread() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_unread", filterUnread = !filterUnread).apply();
|
preferences.edit().putBoolean("filter_unread", filterUnread = !filterUnread).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleFilterUnmutedAndUnread() {
|
public static void toggleFilterUnmutedAndUnread() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("filter_unmuted_and_unread", filterUnmutedAndUnread = !filterUnmutedAndUnread).apply();
|
preferences.edit().putBoolean("filter_unmuted_and_unread", filterUnmutedAndUnread = !filterUnmutedAndUnread).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableSystemAccount() {
|
public static void toggleDisableSystemAccount() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("disable_system_account", disableSystemAccount = !disableSystemAccount).apply();
|
preferences.edit().putBoolean("disable_system_account", disableSystemAccount = !disableSystemAccount).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableProxyWhenVpnEnabled() {
|
public static void toggleDisableProxyWhenVpnEnabled() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("disable_proxy_when_vpn_enabled", disableProxyWhenVpnEnabled = !disableProxyWhenVpnEnabled).apply();
|
preferences.edit().putBoolean("disable_proxy_when_vpn_enabled", disableProxyWhenVpnEnabled = !disableProxyWhenVpnEnabled).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSkipOpenLinkConfirm() {
|
public static void toggleSkipOpenLinkConfirm() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("skip_open_link_confirm", skipOpenLinkConfirm = !skipOpenLinkConfirm).apply();
|
preferences.edit().putBoolean("skip_open_link_confirm", skipOpenLinkConfirm = !skipOpenLinkConfirm).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleRemoveTitleEmoji() {
|
public static void toggleRemoveTitleEmoji() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("remove_title_emoji", removeTitleEmoji = !removeTitleEmoji).apply();
|
preferences.edit().putBoolean("remove_title_emoji", removeTitleEmoji = !removeTitleEmoji).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleIgnoredMutedCount() {
|
public static void toggleIgnoredMutedCount() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("ignore_muted_count", ignoreMutedCount = !ignoreMutedCount).apply();
|
preferences.edit().putBoolean("ignore_muted_count", ignoreMutedCount = !ignoreMutedCount).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleUseDefaultTheme() {
|
public static void toggleUseDefaultTheme() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("use_default_theme", useDefaultTheme = !useDefaultTheme).apply();
|
preferences.edit().putBoolean("use_default_theme", useDefaultTheme = !useDefaultTheme).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleShowIdAndDc() {
|
public static void toggleShowIdAndDc() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("show_id_and_dc", showIdAndDc = !showIdAndDc).apply();
|
preferences.edit().putBoolean("show_id_and_dc", showIdAndDc = !showIdAndDc).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setGoogleTranslateKey(String key) {
|
public static void setGoogleTranslateKey(String key) {
|
||||||
|
|
||||||
preferences.edit().putString("google_cloud_translate_key", googleCloudTranslateKey = key).apply();
|
preferences.edit().putString("google_cloud_translate_key", googleCloudTranslateKey = key).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCachePath(String cachePath) {
|
public static void setCachePath(String cachePath) {
|
||||||
|
|
||||||
preferences.edit().putString("cache_path", NekoConfig.cachePath = cachePath).apply();
|
preferences.edit().putString("cache_path", NekoConfig.cachePath = cachePath).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTranslateToLang(String toLang) {
|
public static void setTranslateToLang(String toLang) {
|
||||||
|
|
||||||
preferences.edit().putString("trans_to_lang", translateToLang = toLang).apply();
|
preferences.edit().putString("trans_to_lang", translateToLang = toLang).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTranslateInputToLang(String toLang) {
|
public static void setTranslateInputToLang(String toLang) {
|
||||||
|
|
||||||
preferences.edit().putString("trans_input_to_lang", translateInputLang = toLang).apply();
|
preferences.edit().putString("trans_input_to_lang", translateInputLang = toLang).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTabsTitleType(int type) {
|
public static void setTabsTitleType(int type) {
|
||||||
|
|
||||||
preferences.edit().putInt("tabsTitleType", tabsTitleType = type).apply();
|
preferences.edit().putInt("tabsTitleType", tabsTitleType = type).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleConfirmAVMessage() {
|
public static void toggleConfirmAVMessage() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("confirmAVMessage", confirmAVMessage = !confirmAVMessage).apply();
|
preferences.edit().putBoolean("confirmAVMessage", confirmAVMessage = !confirmAVMessage).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleAskBeforeCall() {
|
public static void toggleAskBeforeCall() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("askBeforeCall", askBeforeCall = !askBeforeCall).apply();
|
preferences.edit().putBoolean("askBeforeCall", askBeforeCall = !askBeforeCall).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleHideProxyByDefault() {
|
public static void toggleHideProxyByDefault() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("hide_proxy_by_default", hideProxyByDefault = !hideProxyByDefault).apply();
|
preferences.edit().putBoolean("hide_proxy_by_default", hideProxyByDefault = !hideProxyByDefault).apply();
|
||||||
|
|
||||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleUseProxyItem() {
|
public static void toggleUseProxyItem() {
|
||||||
|
preferences.edit().putBoolean("use_proxy_item", useProxyItem = !useProxyItem).apply();
|
||||||
preferences.edit().putBoolean("use_proxy_item",useProxyItem = !useProxyItem).apply();
|
|
||||||
|
|
||||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableNumberRounding() {
|
public static void toggleDisableNumberRounding() {
|
||||||
|
preferences.edit().putBoolean("disableNumberRounding", disableNumberRounding = !disableNumberRounding).apply();
|
||||||
preferences.edit().putBoolean("disableNumberRounding",disableNumberRounding = !disableNumberRounding).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableAppBarShadow() {
|
public static void toggleDisableAppBarShadow() {
|
||||||
|
preferences.edit().putBoolean("disableAppBarShadow", disableAppBarShadow = !disableAppBarShadow).apply();
|
||||||
preferences.edit().putBoolean("disableAppBarShadow",disableAppBarShadow = !disableAppBarShadow).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleMediaPreview() {
|
public static void toggleMediaPreview() {
|
||||||
|
preferences.edit().putBoolean("mediaPreview", mediaPreview = !mediaPreview).apply();
|
||||||
preferences.edit().putBoolean("mediaPreview",mediaPreview = !mediaPreview).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleProxyAutoSwitch() {
|
public static void toggleProxyAutoSwitch() {
|
||||||
|
preferences.edit().putBoolean("proxy_auto_switch", proxyAutoSwitch = !proxyAutoSwitch).apply();
|
||||||
preferences.edit().putBoolean("proxy_auto_switch",proxyAutoSwitch = !proxyAutoSwitch).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOpenPGPApp(String packageName) {
|
public static void setOpenPGPApp(String packageName) {
|
||||||
|
preferences.edit().putString("openPGPApp", openPGPApp = packageName).apply();
|
||||||
preferences.edit().putString("openPGPApp",openPGPApp = packageName).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOpenPGPKeyId(long keyId) {
|
public static void setOpenPGPKeyId(long keyId) {
|
||||||
|
preferences.edit().putLong("openPGPKeyId", openPGPKeyId = keyId).apply();
|
||||||
preferences.edit().putLong("openPGPKeyId",openPGPKeyId = keyId).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableVibration() {
|
public static void toggleDisableVibration() {
|
||||||
|
preferences.edit().putBoolean("disableVibration", disableVibration = !disableVibration).apply();
|
||||||
preferences.edit().putBoolean("disableVibration",disableVibration = !disableVibration).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleAutoPauseVideo() {
|
public static void toggleAutoPauseVideo() {
|
||||||
|
preferences.edit().putBoolean("autoPauseVideo", autoPauseVideo = !autoPauseVideo).apply();
|
||||||
preferences.edit().putBoolean("autoPauseVideo",autoPauseVideo = !autoPauseVideo).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableProximityEvents() {
|
public static void toggleDisableProximityEvents() {
|
||||||
|
preferences.edit().putBoolean("disableProximityEvents", disableProximityEvents = !disableProximityEvents).apply();
|
||||||
preferences.edit().putBoolean("disableProximityEvents",disableProximityEvents = !disableProximityEvents).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleIgnoreContentRestrictions() {
|
public static void toggleIgnoreContentRestrictions() {
|
||||||
|
preferences.edit().putBoolean("ignoreContentRestrictions", ignoreContentRestrictions = !ignoreContentRestrictions).apply();
|
||||||
preferences.edit().putBoolean("ignoreContentRestrictions",ignoreContentRestrictions = !ignoreContentRestrictions).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleUseChatAttachMediaMenu() {
|
public static void toggleUseChatAttachMediaMenu() {
|
||||||
|
preferences.edit().putBoolean("useChatAttachMediaMenu", useChatAttachMediaMenu = !useChatAttachMediaMenu).apply();
|
||||||
preferences.edit().putBoolean("useChatAttachMediaMenu",useChatAttachMediaMenu = !useChatAttachMediaMenu).apply();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleDisableLinkPreviewByDefault() {
|
public static void toggleDisableLinkPreviewByDefault() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("disableLinkPreviewByDefault", disableLinkPreviewByDefault = !disableLinkPreviewByDefault).apply();
|
preferences.edit().putBoolean("disableLinkPreviewByDefault", disableLinkPreviewByDefault = !disableLinkPreviewByDefault).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSendCommentAfterForward() {
|
public static void toggleSendCommentAfterForward() {
|
||||||
|
|
||||||
preferences.edit().putBoolean("sendCommentAfterForward", sendCommentAfterForward = !sendCommentAfterForward).apply();
|
preferences.edit().putBoolean("sendCommentAfterForward", sendCommentAfterForward = !sendCommentAfterForward).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCCToLang(String toLang) {
|
public static void setCCToLang(String toLang) {
|
||||||
|
|
||||||
preferences.edit().putString("opencc_to_lang", ccToLang = toLang).apply();
|
preferences.edit().putString("opencc_to_lang", ccToLang = toLang).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCCInputToLang(String toLang) {
|
public static void setCCInputToLang(String toLang) {
|
||||||
|
|
||||||
preferences.edit().putString("opencc_input_to_lang", ccInputLang = toLang).apply();
|
preferences.edit().putString("opencc_input_to_lang", ccInputLang = toLang).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleIncreaseVoiceMessageQuality() {
|
public static void toggleIncreaseVoiceMessageQuality() {
|
||||||
increaseVoiceMessageQuality = !increaseVoiceMessageQuality;
|
preferences.edit().putBoolean("increaseVoiceMessageQuality", increaseVoiceMessageQuality = !increaseVoiceMessageQuality).apply();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
}
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean("increaseVoiceMessageQuality", increaseVoiceMessageQuality);
|
public static void toggleAcceptSecretChat() {
|
||||||
editor.commit();
|
preferences.edit().putBoolean("acceptSecretChat", acceptSecretChat = !acceptSecretChat).apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -95,6 +95,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
|
|
||||||
private int dialogsRow;
|
private int dialogsRow;
|
||||||
private int sortMenuRow;
|
private int sortMenuRow;
|
||||||
|
private int acceptSecretChatRow;
|
||||||
private int dialogs2Row;
|
private int dialogs2Row;
|
||||||
|
|
||||||
private int appearanceRow;
|
private int appearanceRow;
|
||||||
|
@ -488,6 +489,11 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
if (view instanceof TextCheckCell) {
|
if (view instanceof TextCheckCell) {
|
||||||
((TextCheckCell) view).setChecked(NekoConfig.autoPauseVideo);
|
((TextCheckCell) view).setChecked(NekoConfig.autoPauseVideo);
|
||||||
}
|
}
|
||||||
|
} else if (position == acceptSecretChatRow) {
|
||||||
|
NekoConfig.toggleAcceptSecretChat();
|
||||||
|
if (view instanceof TextCheckCell) {
|
||||||
|
((TextCheckCell) view).setChecked(NekoConfig.acceptSecretChat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -683,6 +689,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
|
|
||||||
dialogsRow = rowCount++;
|
dialogsRow = rowCount++;
|
||||||
sortMenuRow = rowCount++;
|
sortMenuRow = rowCount++;
|
||||||
|
acceptSecretChatRow = rowCount++;
|
||||||
dialogs2Row = rowCount++;
|
dialogs2Row = rowCount++;
|
||||||
|
|
||||||
appearanceRow = rowCount++;
|
appearanceRow = rowCount++;
|
||||||
|
@ -709,7 +716,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
inappCameraRow = rowCount++;
|
inappCameraRow = rowCount++;
|
||||||
hideProxySponsorChannelRow = rowCount++;
|
hideProxySponsorChannelRow = rowCount++;
|
||||||
askBeforeCallRow = rowCount++;
|
askBeforeCallRow = rowCount++;
|
||||||
autoPauseVideoRow = rowCount ++;
|
autoPauseVideoRow = rowCount++;
|
||||||
disableNumberRoundingRow = rowCount++;
|
disableNumberRoundingRow = rowCount++;
|
||||||
openArchiveOnPullRow = rowCount++;
|
openArchiveOnPullRow = rowCount++;
|
||||||
nameOrderRow = rowCount++;
|
nameOrderRow = rowCount++;
|
||||||
|
@ -812,7 +819,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
}
|
}
|
||||||
textCell.setTextAndValue(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration), value, false);
|
textCell.setTextAndValue(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration), value, false);
|
||||||
} else if (position == sortMenuRow) {
|
} else if (position == sortMenuRow) {
|
||||||
textCell.setText(LocaleController.getString("SortMenu", R.string.SortMenu), false);
|
textCell.setText(LocaleController.getString("SortMenu", R.string.SortMenu), true);
|
||||||
} else if (position == translateToLangRow) {
|
} else if (position == translateToLangRow) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("TransToLang", R.string.TransToLang), NekoConfig.formatLang(NekoConfig.translateToLang), true);
|
textCell.setTextAndValue(LocaleController.getString("TransToLang", R.string.TransToLang), NekoConfig.formatLang(NekoConfig.translateToLang), true);
|
||||||
} else if (position == translateInputToLangRow) {
|
} else if (position == translateInputToLangRow) {
|
||||||
|
@ -900,8 +907,10 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
} else if (position == usePersianCalenderRow) {
|
} else if (position == usePersianCalenderRow) {
|
||||||
} else if (position == autoPauseVideoRow) {
|
} else if (position == autoPauseVideoRow) {
|
||||||
textCell.setTextAndValueAndCheck(LocaleController.getString("AutoPauseVideo", R.string.AutoPauseVideo), LocaleController.getString("AutoPauseVideoAbout", R.string.AutoPauseVideoAbout), NekoConfig.autoPauseVideo, true, true);
|
textCell.setTextAndValueAndCheck(LocaleController.getString("AutoPauseVideo", R.string.AutoPauseVideo), LocaleController.getString("AutoPauseVideoAbout", R.string.AutoPauseVideoAbout), NekoConfig.autoPauseVideo, true, true);
|
||||||
|
} else if (position == acceptSecretChatRow) {
|
||||||
|
textCell.setTextAndCheck(LocaleController.getString("AcceptSecretChat", R.string.AcceptSecretChat), NekoConfig.acceptSecretChat, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
HeaderCell headerCell = (HeaderCell) holder.itemView;
|
HeaderCell headerCell = (HeaderCell) holder.itemView;
|
||||||
|
|
|
@ -271,4 +271,6 @@
|
||||||
<string name="UserRestrictionsSendGames">Send Games</string>
|
<string name="UserRestrictionsSendGames">Send Games</string>
|
||||||
<string name="UserRestrictionsSendInline">Send via Inline Bots</string>
|
<string name="UserRestrictionsSendInline">Send via Inline Bots</string>
|
||||||
|
|
||||||
|
<string name="AcceptSecretChat">Accept new secret chat</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue