mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Remove old donate megaphone and replace with sustainer megaphone.
This commit is contained in:
@@ -13,6 +13,7 @@ import com.annimon.stream.Stream;
|
||||
import org.signal.core.util.TranslationDetection;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.badges.models.Badge;
|
||||
import org.thoughtcrime.securesms.components.settings.app.AppSettingsActivity;
|
||||
import org.thoughtcrime.securesms.conversationlist.ConversationListFragment;
|
||||
import org.thoughtcrime.securesms.database.model.MegaphoneRecord;
|
||||
@@ -102,13 +103,12 @@ public final class Megaphones {
|
||||
put(Event.LINK_PREVIEWS, shouldShowLinkPreviewsMegaphone(context) ? ALWAYS : NEVER);
|
||||
put(Event.CLIENT_DEPRECATED, SignalStore.misc().isClientDeprecated() ? ALWAYS : NEVER);
|
||||
put(Event.RESEARCH, shouldShowResearchMegaphone(context) ? ShowForDurationSchedule.showForDays(7) : NEVER);
|
||||
put(Event.DONATE, shouldShowDonateMegaphone(context) ? ShowForDurationSchedule.showForDays(7) : NEVER);
|
||||
put(Event.GROUP_CALLING, shouldShowGroupCallingMegaphone() ? ALWAYS : NEVER);
|
||||
put(Event.ONBOARDING, shouldShowOnboardingMegaphone(context) ? ALWAYS : NEVER);
|
||||
put(Event.NOTIFICATIONS, shouldShowNotificationsMegaphone(context) ? RecurringSchedule.every(TimeUnit.DAYS.toMillis(30)) : NEVER);
|
||||
put(Event.CHAT_COLORS, ALWAYS);
|
||||
put(Event.ADD_A_PROFILE_PHOTO, shouldShowAddAProfilePhotoMegaphone(context) ? ALWAYS : NEVER);
|
||||
put(Event.BECOME_A_SUSTAINER, shouldShowBecomeASustainerMegaphone() ? ALWAYS : NEVER);
|
||||
put(Event.BECOME_A_SUSTAINER, shouldShowDonateMegaphone(context) ? ShowForDurationSchedule.showForDays(7) : NEVER);
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -128,8 +128,6 @@ public final class Megaphones {
|
||||
return buildClientDeprecatedMegaphone(context);
|
||||
case RESEARCH:
|
||||
return buildResearchMegaphone(context);
|
||||
case DONATE:
|
||||
return buildDonateMegaphone(context);
|
||||
case GROUP_CALLING:
|
||||
return buildGroupCallingMegaphone(context);
|
||||
case ONBOARDING:
|
||||
@@ -253,21 +251,6 @@ public final class Megaphones {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static @NonNull Megaphone buildDonateMegaphone(@NonNull Context context) {
|
||||
return new Megaphone.Builder(Event.DONATE, Megaphone.Style.BASIC)
|
||||
.disableSnooze()
|
||||
.setTitle(R.string.DonateMegaphone_donate_to_signal)
|
||||
.setBody(R.string.DonateMegaphone_Signal_is_powered_by_people_like_you_show_your_support_today)
|
||||
.setImage(R.drawable.ic_donate_megaphone)
|
||||
.setActionButton(R.string.DonateMegaphone_donate, (megaphone, controller) -> {
|
||||
controller.onMegaphoneCompleted(megaphone.getEvent());
|
||||
CommunicationActions.openBrowserLink(controller.getMegaphoneActivity(), context.getString(R.string.donate_url));
|
||||
})
|
||||
.setSecondaryButton(R.string.DonateMegaphone_no_thanks, (megaphone, controller) -> controller.onMegaphoneCompleted(megaphone.getEvent()))
|
||||
.setPriority(Megaphone.Priority.DEFAULT)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static @NonNull Megaphone buildGroupCallingMegaphone(@NonNull Context context) {
|
||||
return new Megaphone.Builder(Event.GROUP_CALLING, Megaphone.Style.BASIC)
|
||||
.disableSnooze()
|
||||
@@ -368,7 +351,12 @@ public final class Megaphones {
|
||||
}
|
||||
|
||||
private static boolean shouldShowDonateMegaphone(@NonNull Context context) {
|
||||
return VersionTracker.getDaysSinceFirstInstalled(context) > 7 && LocaleFeatureFlags.isInDonateMegaphone();
|
||||
return VersionTracker.getDaysSinceFirstInstalled(context) > 7 && LocaleFeatureFlags.isInDonateMegaphone() &&
|
||||
Recipient.self()
|
||||
.getBadges()
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.noneMatch(badge -> badge.getCategory() == Badge.Category.Donor);
|
||||
}
|
||||
|
||||
private static boolean shouldShowLinkPreviewsMegaphone(@NonNull Context context) {
|
||||
@@ -383,10 +371,6 @@ public final class Megaphones {
|
||||
return SignalStore.onboarding().hasOnboarding(context);
|
||||
}
|
||||
|
||||
private static boolean shouldShowBecomeASustainerMegaphone() {
|
||||
return FeatureFlags.donorBadgesMegaphone();
|
||||
}
|
||||
|
||||
private static boolean shouldShowNotificationsMegaphone(@NonNull Context context) {
|
||||
boolean shouldShow = !SignalStore.settings().isMessageNotificationsEnabled() ||
|
||||
!NotificationChannels.isMessageChannelEnabled(context) ||
|
||||
@@ -428,7 +412,6 @@ public final class Megaphones {
|
||||
LINK_PREVIEWS("link_previews"),
|
||||
CLIENT_DEPRECATED("client_deprecated"),
|
||||
RESEARCH("research"),
|
||||
DONATE("donate"),
|
||||
GROUP_CALLING("group_calling"),
|
||||
ONBOARDING("onboarding"),
|
||||
NOTIFICATIONS("notifications"),
|
||||
|
||||
@@ -61,7 +61,7 @@ public final class FeatureFlags {
|
||||
private static final String VERIFY_V2 = "android.verifyV2";
|
||||
private static final String PHONE_NUMBER_PRIVACY_VERSION = "android.phoneNumberPrivacyVersion";
|
||||
private static final String CLIENT_EXPIRATION = "android.clientExpiration";
|
||||
public static final String DONATE_MEGAPHONE = "android.donate";
|
||||
public static final String DONATE_MEGAPHONE = "android.donate.2";
|
||||
private static final String CUSTOM_VIDEO_MUXER = "android.customVideoMuxer";
|
||||
private static final String CDS_REFRESH_INTERVAL = "cds.syncInterval.seconds";
|
||||
private static final String AUTOMATIC_SESSION_RESET = "android.automaticSessionReset.2";
|
||||
@@ -85,7 +85,6 @@ public final class FeatureFlags {
|
||||
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.6";
|
||||
private static final String DONOR_BADGES_MEGAPHONE = "android.donorBadges.megaphone.3";
|
||||
private static final String DONOR_BADGES_DISPLAY = "android.donorBadges.display.4";
|
||||
private static final String CDSH = "android.cdsh";
|
||||
|
||||
@@ -127,7 +126,6 @@ public final class FeatureFlags {
|
||||
CDSH,
|
||||
SENDER_KEY_MAX_AGE,
|
||||
DONOR_BADGES,
|
||||
DONOR_BADGES_MEGAPHONE,
|
||||
DONOR_BADGES_DISPLAY
|
||||
);
|
||||
|
||||
@@ -419,10 +417,6 @@ public final class FeatureFlags {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean donorBadgesMegaphone() {
|
||||
return getBoolean(DONOR_BADGES_MEGAPHONE, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not donor badges should be displayed throughout the app.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user