Add group calling tooltip and megaphone.

This commit is contained in:
Alex Hart
2020-12-14 18:26:07 -04:00
committed by Greyson Parrelli
parent 7227b43bbe
commit fa7346f79b
12 changed files with 81 additions and 9 deletions

View File

@@ -54,6 +54,7 @@ public class MegaphoneRepository {
database.markFinished(Event.MESSAGE_REQUESTS);
database.markFinished(Event.LINK_PREVIEWS);
database.markFinished(Event.RESEARCH);
database.markFinished(Event.GROUP_CALLING);
resetDatabaseCache();
});
}

View File

@@ -92,6 +92,7 @@ public final class Megaphones {
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);
}};
}
@@ -113,6 +114,8 @@ public final class Megaphones {
return buildResearchMegaphone(context);
case DONATE:
return buildDonateMegaphone(context);
case GROUP_CALLING:
return buildGroupCallingMegaphone(context);
default:
throw new IllegalArgumentException("Event not handled!");
}
@@ -239,6 +242,19 @@ public final class Megaphones {
.build();
}
private static @NonNull Megaphone buildGroupCallingMegaphone(@NonNull Context context) {
return new Megaphone.Builder(Event.GROUP_CALLING, Megaphone.Style.BASIC)
.disableSnooze()
.setTitle(R.string.GroupCallingMegaphone__introducing_group_calls)
.setBody(R.string.GroupCallingMegaphone__open_a_new_group_to_start)
.setImage(R.drawable.ic_group_calls_megaphone)
.setActionButton(android.R.string.ok, (megaphone, controller) -> {
controller.onMegaphoneCompleted(megaphone.getEvent());
})
.setPriority(Megaphone.Priority.DEFAULT)
.build();
}
private static boolean shouldShowMessageRequestsMegaphone() {
return Recipient.self().getProfileName() == ProfileName.EMPTY;
}
@@ -255,6 +271,10 @@ public final class Megaphones {
return TextSecurePreferences.wereLinkPreviewsEnabled(context) && !SignalStore.settings().isLinkPreviewsEnabled();
}
private static boolean shouldShowGroupCallingMegaphone() {
return FeatureFlags.groupCalling();
}
public enum Event {
REACTIONS("reactions"),
PINS_FOR_ALL("pins_for_all"),
@@ -263,7 +283,8 @@ public final class Megaphones {
LINK_PREVIEWS("link_previews"),
CLIENT_DEPRECATED("client_deprecated"),
RESEARCH("research"),
DONATE("donate");
DONATE("donate"),
GROUP_CALLING("group_calling");
private final String key;