| 6 | import org.telegram.messenger.BuildVars; |
| 7 | import org.telegram.messenger.NotificationCenter; |
| 8 |
| 9 | import tw.nekomimi.nekogram.database.NitritesKt; |
| 10 |
| 11 | public class NekoXConfig { |
| 12 |
| 13 | // public static String FAQ_URL = "https://telegra.ph/NekoX-FAQ-03-31"; |
| 14 | public static String FAQ_URL = "https://github.com/NekoX-Dev/NekoX#faq"; |
| 15 | public static int[] officialChats = { |
| 16 | 1305127566, // NekoX Updates |
| 17 | 1151172683, // NekoX Chat |
| 18 | 1299578049, // NekoX Chat Channel |
| 19 | 1137038259, // NekoX APKs |
| 20 | }; |
| 21 |
| 22 | public static int[] developers = { |
| 23 | 896711046, // nekohasekai |
| 24 | 380570774, // Haruhi |
| 25 | }; |
| 26 |
| 27 | public static SharedPreferences preferences = NitritesKt.openMainSharedPreference("nekox_config"); |
| 28 |
| 29 | public static boolean developerModeEntrance; |
| 30 | public static boolean developerMode = preferences.getBoolean("developer_mode", false); |
| 31 |
| 32 | public static boolean disableFlagSecure = preferences.getBoolean("disable_flag_secure", false); |
| 33 | public static boolean disableScreenshotDetection = preferences.getBoolean("disable_screenshot_detection", false); |
| 34 |
| 35 | public static boolean disableStatusUpdate = preferences.getBoolean("disable_status_update", false); |
| 36 | public static boolean keepOnlineStatus = preferences.getBoolean("keepOnlineStatus", false); |
| 37 |
| 38 | public static boolean enableStickerPin = preferences.getBoolean("enableStickerPin", false); |
| 39 |
| 40 |
| 41 | public static void toggleDeveloperMode() { |
| 42 |
| 43 | preferences.edit().putBoolean("developer_mode", developerMode = !developerMode).apply(); |
| 44 |
| 45 | if (!developerMode) { |
| 46 |
| 47 | preferences.edit() |
| 48 | .putBoolean("disable_flag_secure", disableFlagSecure = false) |
| 49 | .putBoolean("disable_screenshot_detection", disableScreenshotDetection = false) |
| 50 | .putBoolean("disable_status_update", disableStatusUpdate = false) |
| 51 | .apply(); |
| 52 |
| 53 |
| 54 | } |
| 55 |
| 56 | } |
| 57 |
| 58 | public static void toggleDisableFlagSecure() { |
| 59 |
| 60 | preferences.edit().putBoolean("disable_flag_secure", disableFlagSecure = !disableFlagSecure).apply(); |
| 61 |
| 62 | } |
| 63 |
| 64 | public static void toggleDisableScreenshotDetection() { |
| 65 |
| 66 | preferences.edit().putBoolean("disable_screenshot_detection", disableScreenshotDetection = !disableScreenshotDetection).apply(); |
| 67 |
| 68 | } |
| 69 |
| 70 | public static int customApi = preferences.getInt("custom_api", 0); |
| 71 | public static int customAppId = preferences.getInt("custom_app_id", 0); |
| 72 | public static String customAppHash = preferences.getString("custom_app_hash", ""); |
| 73 |
| 74 | public static int currentAppId() { |
| 75 |
| 76 | switch (customApi) { |
| 77 |
| 78 | case 0: |
| 79 | return BuildConfig.APP_ID; |
| 80 | case 1: |
| 81 | return BuildVars.OFFICAL_APP_ID; |
| 82 | case 2: |
| 83 | return BuildVars.TGX_APP_ID; |
| 84 | default: |
| 85 | return customAppId; |
| 86 |
| 87 | } |
| 88 |
| 89 | } |
| 90 |
| 91 | public static String currentAppHash() { |
| 92 |
| 93 | switch (customApi) { |
| 94 |
| 95 | case 0: |
| 96 | return BuildConfig.APP_HASH; |
| 97 | case 1: |
| 98 | return BuildVars.OFFICAL_APP_HASH; |
| 99 | case 2: |
| 100 | return BuildVars.TGX_APP_HASH; |
| 101 | default: |
| 102 | return customAppHash; |
| 103 |
| 104 | } |
| 105 |
| 106 | } |
| 107 |
| 108 | public static void saveCustomApi() { |
| 109 |
| 110 | preferences.edit() |
| 111 | .putInt("custom_api", customApi) |
| 112 | .putInt("custom_app_id", customAppId) |
| 113 | .putString("custom_app_hash", customAppHash) |
| 114 | .apply(); |
| 115 |
| 116 | } |
| 117 |
| 118 | public static String customDcIpv4 = preferences.getString("custom_dc_v4", ""); |
| 119 | public static String customDcIpv6 = preferences.getString("custom_dc_v6", ""); |
| 120 | public static int customDcPort = preferences.getInt("custom_dc_port", 0); |
| 121 | public static int customDcLayer = preferences.getInt("custom_dc_layer", 0); |
| 122 |
| 123 | public static String customDcPublicKey = preferences.getString("custom_dc_public_key", ""); |
| 124 | public static long customDcFingerprint = preferences.getLong("custom_dc_fingerprint", 0L); |
| 125 |
| 126 | public static void saveCustomDc() { |
| 127 |
| 128 | preferences.edit() |
| 129 | .putString("custom_dc_v4", customDcIpv4) |
| 130 | .putString("custom_dc_v6", customDcIpv6) |
| 131 | .putInt("custom_dc_port", customDcPort) |
| 132 | .putInt("custom_dc_layer", customDcLayer) |
| 133 | .putString("custom_dc_public_key", customDcPublicKey) |
| 134 | .putLong("custom_dc_fingerprint", customDcFingerprint) |
| 135 | .apply(); |
| 136 |
| 137 | } |
| 138 |
| 139 | public static void toggleDisableStatusUpdate() { |
| 140 |
| 141 | preferences.edit().putBoolean("disable_status_update", disableStatusUpdate = !disableStatusUpdate).apply(); |
| 142 |
| 143 | NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.updateUserStatus, (Object) null); |
| 144 |
| 145 | } |
| 146 |
| 147 | public static void toggleKeepOnlineStatus() { |
| 148 |
| 149 | preferences.edit().putBoolean("keepOnlineStatus", keepOnlineStatus = !keepOnlineStatus).apply(); |
| 150 |
| 151 | NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.updateUserStatus, (Object) null); |
| 152 |
| 153 | } |
| 154 |
| 155 | public static void toggleEnableStickerPin() { |
| 156 |
| 157 | preferences.edit().putBoolean("enableStickerPin", enableStickerPin = !enableStickerPin).apply(); |
| 158 |
| 159 | } |
| 160 |
| 161 |
| 162 | } |