mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Initial work to support Change Number.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user