Initial work to support Change Number.

This commit is contained in:
Cody Henthorne
2021-09-03 17:07:05 -04:00
parent e09d162c1e
commit f2ab0b6423
61 changed files with 3177 additions and 1176 deletions

View File

@@ -83,6 +83,7 @@ public final class FeatureFlags {
private static final String SUGGEST_SMS_BLACKLIST = "android.suggestSmsBlacklist";
private static final String MAX_GROUP_CALL_RING_SIZE = "global.calling.maxGroupCallRingSize";
private static final String GROUP_CALL_RINGING = "android.calling.groupCallRinging";
private static final String CHANGE_NUMBER_ENABLED = "android.changeNumber";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -124,7 +125,8 @@ public final class FeatureFlags {
@VisibleForTesting
static final Set<String> NOT_REMOTE_CAPABLE = SetUtil.newHashSet(
PHONE_NUMBER_PRIVACY_VERSION
PHONE_NUMBER_PRIVACY_VERSION,
CHANGE_NUMBER_ENABLED
);
/**
@@ -392,6 +394,11 @@ public final class FeatureFlags {
return getBoolean(GROUP_CALL_RINGING, false);
}
/** Weather or not to show change number in the UI. */
public static boolean changeNumber() {
return getBoolean(CHANGE_NUMBER_ENABLED, false);
}
/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);

View File

@@ -0,0 +1,19 @@
package org.thoughtcrime.securesms.util.rx
import com.google.android.gms.tasks.Task
import io.reactivex.rxjava3.core.Single
/**
* Convert a [Task] into a [Single].
*/
fun <T : Any> Task<T>.toSingle(): Single<T> {
return Single.create { emitter ->
addOnCompleteListener {
if (it.isSuccessful && !emitter.isDisposed) {
emitter.onSuccess(it.result)
} else if (!emitter.isDisposed) {
emitter.onError(it.exception)
}
}
}
}