mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Implement several pieces of UI polish for badges.
This commit is contained in:
committed by
Greyson Parrelli
parent
186bd9db48
commit
755ec672c0
@@ -108,6 +108,7 @@ public final class Megaphones {
|
||||
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);
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -139,6 +140,8 @@ public final class Megaphones {
|
||||
return buildChatColorsMegaphone(context);
|
||||
case ADD_A_PROFILE_PHOTO:
|
||||
return buildAddAProfilePhotoMegaphone(context);
|
||||
case BECOME_A_SUSTAINER:
|
||||
return buildBecomeASustainerMegaphone(context);
|
||||
default:
|
||||
throw new IllegalArgumentException("Event not handled!");
|
||||
}
|
||||
@@ -340,6 +343,22 @@ public final class Megaphones {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static @NonNull Megaphone buildBecomeASustainerMegaphone(@NonNull Context context) {
|
||||
return new Megaphone.Builder(Event.BECOME_A_SUSTAINER, Megaphone.Style.BASIC)
|
||||
.setTitle(R.string.BecomeASustainerMegaphone__become_a_sustainer)
|
||||
.setImage(R.drawable.ic_become_a_sustainer_megaphone)
|
||||
.setBody(R.string.BecomeASustainerMegaphone__signal_is_powered)
|
||||
.setActionButton(R.string.BecomeASustainerMegaphone__donate, (megaphone, listener) -> {
|
||||
listener.onMegaphoneNavigationRequested(AppSettingsActivity.subscriptions(context));
|
||||
listener.onMegaphoneCompleted(Event.BECOME_A_SUSTAINER);
|
||||
})
|
||||
.setSecondaryButton(R.string.BecomeASustainerMegaphone__no_thanks, (megaphone, listener) -> {
|
||||
listener.onMegaphoneCompleted(Event.BECOME_A_SUSTAINER);
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
private static boolean shouldShowMessageRequestsMegaphone() {
|
||||
return Recipient.self().getProfileName() == ProfileName.EMPTY;
|
||||
}
|
||||
@@ -364,6 +383,10 @@ public final class Megaphones {
|
||||
return SignalStore.onboarding().hasOnboarding(context);
|
||||
}
|
||||
|
||||
private static boolean shouldShowBecomeASustainerMegaphone() {
|
||||
return FeatureFlags.donorBadges();
|
||||
}
|
||||
|
||||
private static boolean shouldShowNotificationsMegaphone(@NonNull Context context) {
|
||||
boolean shouldShow = !SignalStore.settings().isMessageNotificationsEnabled() ||
|
||||
!NotificationChannels.isMessageChannelEnabled(context) ||
|
||||
@@ -410,7 +433,8 @@ public final class Megaphones {
|
||||
ONBOARDING("onboarding"),
|
||||
NOTIFICATIONS("notifications"),
|
||||
CHAT_COLORS("chat_colors"),
|
||||
ADD_A_PROFILE_PHOTO("add_a_profile_photo");
|
||||
ADD_A_PROFILE_PHOTO("add_a_profile_photo"),
|
||||
BECOME_A_SUSTAINER("become_a_sustainer");
|
||||
|
||||
private final String key;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user