mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +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"),
|
||||
|
||||
Reference in New Issue
Block a user