mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add a feature flag for badge display.
This commit is contained in:
committed by
Greyson Parrelli
parent
33dbf316a9
commit
392d582865
@@ -21,6 +21,7 @@ import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.util.BottomSheetUtil
|
||||
import org.thoughtcrime.securesms.util.CommunicationActions
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.MappingAdapter
|
||||
import org.thoughtcrime.securesms.util.PlayServicesUtil
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
@@ -47,6 +48,7 @@ class ViewBadgeBottomSheetDialogFragment : FixedRoundedCornerBottomSheetDialogFr
|
||||
action.visible = false
|
||||
}
|
||||
|
||||
@Suppress("CascadeIf")
|
||||
if (PlayServicesUtil.getPlayServicesStatus(requireContext()) != PlayServicesUtil.PlayServicesStatus.SUCCESS) {
|
||||
noSupport.visible = true
|
||||
action.icon = ContextCompat.getDrawable(requireContext(), R.drawable.ic_open_20)
|
||||
@@ -54,10 +56,12 @@ class ViewBadgeBottomSheetDialogFragment : FixedRoundedCornerBottomSheetDialogFr
|
||||
action.setOnClickListener {
|
||||
CommunicationActions.openBrowserLink(requireContext(), getString(R.string.donate_url))
|
||||
}
|
||||
} else {
|
||||
} else if (FeatureFlags.donorBadges()) {
|
||||
action.setOnClickListener {
|
||||
startActivity(AppSettingsActivity.subscriptions(requireContext()))
|
||||
}
|
||||
} else {
|
||||
action.visible = false
|
||||
}
|
||||
|
||||
val adapter = MappingAdapter()
|
||||
@@ -116,6 +120,10 @@ class ViewBadgeBottomSheetDialogFragment : FixedRoundedCornerBottomSheetDialogFr
|
||||
recipientId: RecipientId,
|
||||
startBadge: Badge? = null
|
||||
) {
|
||||
if (!FeatureFlags.displayDonorBadges()) {
|
||||
return
|
||||
}
|
||||
|
||||
ViewBadgeBottomSheetDialogFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putParcelable(ARG_START_BADGE, startBadge)
|
||||
|
||||
@@ -1028,7 +1028,7 @@ public class Recipient {
|
||||
}
|
||||
|
||||
public @NonNull List<Badge> getBadges() {
|
||||
return badges;
|
||||
return FeatureFlags.displayDonorBadges() ? badges : Collections.emptyList();
|
||||
}
|
||||
|
||||
public @Nullable Badge getFeaturedBadge() {
|
||||
|
||||
@@ -84,8 +84,9 @@ public final class FeatureFlags {
|
||||
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";
|
||||
private static final String DONOR_BADGES = "android.donorBadges.2";
|
||||
private static final String DONOR_BADGES = "android.donorBadges.3";
|
||||
private static final String DONOR_BADGES_MEGAPHONE = "android.donorBadges.megaphone";
|
||||
private static final String DONOR_BADGES_DISPLAY = "android.donorBadges.display";
|
||||
private static final String CDSH = "android.cdsh";
|
||||
|
||||
/**
|
||||
@@ -126,7 +127,8 @@ public final class FeatureFlags {
|
||||
CDSH,
|
||||
SENDER_KEY_MAX_AGE,
|
||||
DONOR_BADGES,
|
||||
DONOR_BADGES_MEGAPHONE
|
||||
DONOR_BADGES_MEGAPHONE,
|
||||
DONOR_BADGES_DISPLAY
|
||||
);
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -179,7 +181,8 @@ public final class FeatureFlags {
|
||||
MAX_GROUP_CALL_RING_SIZE,
|
||||
GROUP_CALL_RINGING,
|
||||
CDSH,
|
||||
SENDER_KEY_MAX_AGE
|
||||
SENDER_KEY_MAX_AGE,
|
||||
DONOR_BADGES_DISPLAY
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -420,6 +423,13 @@ public final class FeatureFlags {
|
||||
return getBoolean(DONOR_BADGES_MEGAPHONE, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not donor badges should be displayed throughout the app.
|
||||
*/
|
||||
public static boolean displayDonorBadges() {
|
||||
return getBoolean(DONOR_BADGES_DISPLAY, false);
|
||||
}
|
||||
|
||||
public static boolean cdsh() {
|
||||
return Environment.IS_STAGING && getBoolean(CDSH, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user