mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Registration refactor initial scaffolding.
This commit is contained in:
committed by
Greyson Parrelli
parent
318b59a6b2
commit
eec2685e67
@@ -90,9 +90,9 @@ public final class FeatureFlags {
|
||||
private static final String CAMERAX_MODEL_BLOCKLIST = "android.cameraXModelBlockList";
|
||||
private static final String CAMERAX_MIXED_MODEL_BLOCKLIST = "android.cameraXMixedModelBlockList";
|
||||
private static final String PAYMENTS_REQUEST_ACTIVATE_FLOW = "android.payments.requestActivateFlow";
|
||||
public static final String GOOGLE_PAY_DISABLED_REGIONS = "global.donations.gpayDisabledRegions";
|
||||
public static final String CREDIT_CARD_DISABLED_REGIONS = "global.donations.ccDisabledRegions";
|
||||
public static final String PAYPAL_DISABLED_REGIONS = "global.donations.paypalDisabledRegions";
|
||||
public static final String GOOGLE_PAY_DISABLED_REGIONS = "global.donations.gpayDisabledRegions";
|
||||
public static final String CREDIT_CARD_DISABLED_REGIONS = "global.donations.ccDisabledRegions";
|
||||
public static final String PAYPAL_DISABLED_REGIONS = "global.donations.paypalDisabledRegions";
|
||||
private static final String CDS_HARD_LIMIT = "android.cds.hardLimit";
|
||||
private static final String PAYPAL_ONE_TIME_DONATIONS = "android.oneTimePayPalDonations.2";
|
||||
private static final String PAYPAL_RECURRING_DONATIONS = "android.recurringPayPalDonations.3";
|
||||
@@ -104,15 +104,15 @@ public final class FeatureFlags {
|
||||
private static final String SVR2_KILLSWITCH = "android.svr2.killSwitch";
|
||||
private static final String CDS_DISABLE_COMPAT_MODE = "cds.disableCompatibilityMode";
|
||||
private static final String FCM_MAY_HAVE_MESSAGES_KILL_SWITCH = "android.fcmNotificationFallbackKillSwitch";
|
||||
public static final String PROMPT_FOR_NOTIFICATION_LOGS = "android.logs.promptNotifications";
|
||||
public static final String PROMPT_FOR_NOTIFICATION_LOGS = "android.logs.promptNotifications";
|
||||
private static final String PROMPT_FOR_NOTIFICATION_CONFIG = "android.logs.promptNotificationsConfig";
|
||||
public static final String PROMPT_BATTERY_SAVER = "android.promptBatterySaver";
|
||||
public static final String INSTANT_VIDEO_PLAYBACK = "android.instantVideoPlayback.1";
|
||||
public static final String CRASH_PROMPT_CONFIG = "android.crashPromptConfig";
|
||||
public static final String PROMPT_BATTERY_SAVER = "android.promptBatterySaver";
|
||||
public static final String INSTANT_VIDEO_PLAYBACK = "android.instantVideoPlayback.1";
|
||||
public static final String CRASH_PROMPT_CONFIG = "android.crashPromptConfig";
|
||||
private static final String SEPA_DEBIT_DONATIONS = "android.sepa.debit.donations.5";
|
||||
private static final String IDEAL_DONATIONS = "android.ideal.donations.5";
|
||||
public static final String IDEAL_ENABLED_REGIONS = "global.donations.idealEnabledRegions";
|
||||
public static final String SEPA_ENABLED_REGIONS = "global.donations.sepaEnabledRegions";
|
||||
public static final String IDEAL_ENABLED_REGIONS = "global.donations.idealEnabledRegions";
|
||||
public static final String SEPA_ENABLED_REGIONS = "global.donations.sepaEnabledRegions";
|
||||
private static final String CALLING_REACTIONS = "android.calling.reactions";
|
||||
private static final String NOTIFICATION_THUMBNAIL_BLOCKLIST = "android.notificationThumbnailProductBlocklist";
|
||||
private static final String CALLING_RAISE_HAND = "android.calling.raiseHand";
|
||||
@@ -127,6 +127,7 @@ public final class FeatureFlags {
|
||||
private static final String LINKED_DEVICE_LIFESPAN_SECONDS = "android.linkedDeviceLifespanSeconds";
|
||||
private static final String MESSAGE_BACKUPS = "android.messageBackups";
|
||||
private static final String CAMERAX_CUSTOM_CONTROLLER = "android.cameraXCustomController";
|
||||
private static final String REGISTRATION_V2 = "android.registration.v2";
|
||||
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
@@ -209,7 +210,7 @@ public final class FeatureFlags {
|
||||
);
|
||||
|
||||
@VisibleForTesting
|
||||
static final Set<String> NOT_REMOTE_CAPABLE = SetUtil.newHashSet(MESSAGE_BACKUPS);
|
||||
static final Set<String> NOT_REMOTE_CAPABLE = SetUtil.newHashSet(MESSAGE_BACKUPS, REGISTRATION_V2);
|
||||
|
||||
/**
|
||||
* Values in this map will take precedence over any value. This should only be used for local
|
||||
@@ -741,6 +742,11 @@ public final class FeatureFlags {
|
||||
return getBoolean(CAMERAX_CUSTOM_CONTROLLER, false);
|
||||
}
|
||||
|
||||
/** Whether or not to use the V2 refactor of registration. */
|
||||
public static boolean registrationV2() {
|
||||
return getBoolean(REGISTRATION_V2, false);
|
||||
}
|
||||
|
||||
/** Only for rendering debug info. */
|
||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||
return new TreeMap<>(REMOTE_VALUES);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.util.livedata
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Observer
|
||||
|
||||
/**
|
||||
* A wrapper class that can be implemented in order to create a [LiveData] [Observer] that cleans up after itself.
|
||||
*
|
||||
* Useful for one-shot observers that can be executed as a callback on an asynchronous call that updates a [LiveData] upon completion.
|
||||
*/
|
||||
abstract class LiveDataObserverCallback<T>(private val liveData: LiveData<T>) : Observer<T> {
|
||||
final override fun onChanged(value: T) {
|
||||
val shouldRemove = onValue(value)
|
||||
if (shouldRemove) {
|
||||
liveData.removeObserver(this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The body of the observer that gets executed when the value is changed.
|
||||
* Recommended usage is to check some condition in the [LiveData] to determine whether the data has been handled and therefore can be removed.
|
||||
*
|
||||
* @return should remove this observer from the [LiveData]
|
||||
*/
|
||||
abstract fun onValue(value: T): Boolean
|
||||
}
|
||||
Reference in New Issue
Block a user