That fuck shit the fascists are using
1package org.tm.archive.keyvalue;
2
3import androidx.annotation.NonNull;
4
5import org.signal.ringrtc.CallManager;
6import org.tm.archive.BuildConfig;
7import org.tm.archive.util.Environment;
8import org.tm.archive.util.FeatureFlags;
9
10import java.util.Arrays;
11import java.util.Collections;
12import java.util.List;
13
14public final class InternalValues extends SignalStoreValues {
15
16 public static final String GV2_FORCE_INVITES = "internal.gv2.force_invites";
17 public static final String GV2_IGNORE_SERVER_CHANGES = "internal.gv2.ignore_server_changes";
18 public static final String GV2_IGNORE_P2P_CHANGES = "internal.gv2.ignore_p2p_changes";
19 public static final String RECIPIENT_DETAILS = "internal.recipient_details";
20 public static final String ALLOW_CENSORSHIP_SETTING = "internal.force_censorship";
21 public static final String FORCE_BUILT_IN_EMOJI = "internal.force_built_in_emoji";
22 public static final String REMOVE_SENDER_KEY_MINIMUM = "internal.remove_sender_key_minimum";
23 public static final String DELAY_RESENDS = "internal.delay_resends";
24 public static final String CALLING_SERVER = "internal.calling_server";
25 public static final String CALLING_AUDIO_PROCESSING_METHOD = "internal.calling_audio_processing_method";
26 public static final String CALLING_DATA_MODE = "internal.calling_bandwidth_mode";
27 public static final String CALLING_DISABLE_TELECOM = "internal.calling_disable_telecom";
28 public static final String CALLING_DISABLE_LBRED = "internal.calling_disable_lbred";
29 public static final String SHAKE_TO_REPORT = "internal.shake_to_report";
30 public static final String DISABLE_STORAGE_SERVICE = "internal.disable_storage_service";
31 public static final String FORCE_WEBSOCKET_MODE = "internal.force_websocket_mode";
32 public static final String LAST_SCROLL_POSITION = "internal.last_scroll_position";
33 public static final String CONVERSATION_ITEM_V2_MEDIA = "internal.conversation_item_v2_media";
34
35 InternalValues(KeyValueStore store) {
36 super(store);
37 }
38
39 @Override
40 void onFirstEverAppLaunch() {
41 }
42
43 @Override
44 @NonNull List<String> getKeysToIncludeInBackup() {
45 return Collections.emptyList();
46 }
47
48 /**
49 * Members will not be added directly to a GV2 even if they could be.
50 */
51 public synchronized boolean gv2ForceInvites() {
52 return FeatureFlags.internalUser() && getBoolean(GV2_FORCE_INVITES, false);
53 }
54
55 /**
56 * The Server will leave out changes that can only be described by a future protocol level that
57 * an older client cannot understand. Ignoring those changes by nulling them out simulates that
58 * scenario for testing.
59 * <p>
60 * In conjunction with {@link #gv2IgnoreP2PChanges()} it means no group changes are coming into
61 * the client and it will generate changes by group state comparison, and those changes will not
62 * have an editor and so will be in the passive voice.
63 */
64 public synchronized boolean gv2IgnoreServerChanges() {
65 return FeatureFlags.internalUser() && getBoolean(GV2_IGNORE_SERVER_CHANGES, false);
66 }
67
68 /**
69 * Signed group changes are sent P2P, if the client ignores them, it will then ask the server
70 * directly which allows testing of certain testing scenarios.
71 */
72 public synchronized boolean gv2IgnoreP2PChanges() {
73 return FeatureFlags.internalUser() && getBoolean(GV2_IGNORE_P2P_CHANGES, false);
74 }
75
76 /**
77 * Show detailed recipient info in the {@link org.tm.archive.components.settings.conversation.InternalConversationSettingsFragment}.
78 */
79 public synchronized boolean recipientDetails() {
80 return FeatureFlags.internalUser() && getBoolean(RECIPIENT_DETAILS, true);
81 }
82
83 /**
84 * Allow changing the censorship circumvention setting regardless of network status.
85 */
86 public synchronized boolean allowChangingCensorshipSetting() {
87 return FeatureFlags.internalUser() && getBoolean(ALLOW_CENSORSHIP_SETTING, false);
88 }
89
90 /**
91 * Force the app to use the emoji that ship with the app, as opposed to the ones that were downloaded.
92 */
93 public synchronized boolean forceBuiltInEmoji() {
94 return FeatureFlags.internalUser() && getBoolean(FORCE_BUILT_IN_EMOJI, false);
95 }
96
97 /**
98 * Remove the requirement that there must be two sender-key-capable recipients to use sender key
99 */
100 public synchronized boolean removeSenderKeyMinimum() {
101 return FeatureFlags.internalUser() && getBoolean(REMOVE_SENDER_KEY_MINIMUM, false);
102 }
103
104 /**
105 * Delay resending messages in response to retry receipts by 10 seconds.
106 */
107 public synchronized boolean delayResends() {
108 return FeatureFlags.internalUser() && getBoolean(DELAY_RESENDS, false);
109 }
110
111 /**
112 * Whether or not "shake to report" is enabled.
113 */
114 public synchronized boolean shakeToReport() {
115 return FeatureFlags.internalUser() && getBoolean(SHAKE_TO_REPORT, true);
116 }
117
118 /**
119 * Whether or not storage service is manually disabled.
120 */
121 public synchronized boolean storageServiceDisabled() {
122 return FeatureFlags.internalUser() && getBoolean(DISABLE_STORAGE_SERVICE, false);
123 }
124
125 /**
126 * The selected group calling server to use.
127 * <p>
128 * The user must be an internal user and the setting must be one of the current set of internal servers otherwise
129 * the default SFU will be returned. This ensures that if the {@link BuildConfig#SIGNAL_SFU_INTERNAL_URLS} list changes,
130 * internal users cannot be left on old servers.
131 */
132 public synchronized @NonNull String groupCallingServer() {
133 String internalServer = FeatureFlags.internalUser() ? getString(CALLING_SERVER, Environment.Calling.defaultSfuUrl()) : null;
134 if (internalServer != null && !Arrays.asList(BuildConfig.SIGNAL_SFU_INTERNAL_URLS).contains(internalServer)) {
135 internalServer = null;
136 }
137 return internalServer != null ? internalServer : BuildConfig.SIGNAL_SFU_URL;
138 }
139
140 /**
141 * Setting to override the default handling of hardware/software AEC.
142 */
143 public synchronized CallManager.AudioProcessingMethod callingAudioProcessingMethod() {
144 if (FeatureFlags.internalUser()) {
145 return CallManager.AudioProcessingMethod.values()[getInteger(CALLING_AUDIO_PROCESSING_METHOD, CallManager.AudioProcessingMethod.Default.ordinal())];
146 } else {
147 return CallManager.AudioProcessingMethod.Default;
148 }
149 }
150
151 /**
152 * Setting to override the default calling bandwidth mode.
153 */
154 public synchronized CallManager.DataMode callingDataMode() {
155 if (FeatureFlags.internalUser()) {
156 int index = getInteger(CALLING_DATA_MODE, CallManager.DataMode.NORMAL.ordinal());
157 CallManager.DataMode[] modes = CallManager.DataMode.values();
158
159 return index < modes.length ? modes[index] : CallManager.DataMode.NORMAL;
160 } else {
161 return CallManager.DataMode.NORMAL;
162 }
163 }
164
165 /**
166 * Whether or not Telecom integration is manually disabled.
167 */
168 public synchronized boolean callingDisableTelecom() {
169 if (FeatureFlags.internalUser()) {
170 return getBoolean(CALLING_DISABLE_TELECOM, true);
171 } else {
172 return false;
173 }
174 }
175
176 /**
177 * Whether or not LBRed for Opus is manually disabled.
178 */
179 public synchronized boolean callingDisableLBRed() {
180 if (FeatureFlags.internalUser()) {
181 return getBoolean(CALLING_DISABLE_LBRED, false);
182 } else {
183 return true;
184 }
185 }
186
187 /**
188 * Whether or not the system is forced to be in 'websocket mode', where FCM is ignored and we use a foreground service to keep the app alive.
189 */
190 public boolean isWebsocketModeForced() {
191 if (FeatureFlags.internalUser()) {
192 return getBoolean(FORCE_WEBSOCKET_MODE, false);
193 } else {
194 return false;
195 }
196 }
197
198 public void setLastScrollPosition(int position) {
199 putInteger(LAST_SCROLL_POSITION, position);
200 }
201
202 public int getLastScrollPosition() {
203 return getInteger(LAST_SCROLL_POSITION, 0);
204 }
205
206 public void setUseConversationItemV2Media(boolean useConversationFragmentV2Media) {
207 putBoolean(CONVERSATION_ITEM_V2_MEDIA, useConversationFragmentV2Media);
208 }
209
210 public boolean useConversationItemV2Media() {
211 return FeatureFlags.internalUser() && getBoolean(CONVERSATION_ITEM_V2_MEDIA, false);
212 }
213}