mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 11:20:47 +01:00
Add Pins for All Megaphone Kill Switch.
This commit is contained in:
committed by
Greyson Parrelli
parent
5e83206e6e
commit
e1b75c78ab
@@ -17,7 +17,6 @@ class PinsForAllSchedule implements MegaphoneSchedule {
|
||||
static final long DAYS_REMAINING_MAX = DAYS_UNTIL_FULLSCREEN - 1;
|
||||
|
||||
private final MegaphoneSchedule schedule = new RecurringSchedule(TimeUnit.DAYS.toMillis(2));
|
||||
private final boolean enabled = !SignalStore.registrationValues().isPinRequired() || FeatureFlags.pinsForAll();
|
||||
|
||||
static boolean shouldDisplayFullScreen(long firstVisible, long currentTime) {
|
||||
if (firstVisible == 0L) {
|
||||
@@ -37,7 +36,7 @@ class PinsForAllSchedule implements MegaphoneSchedule {
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplay(int seenCount, long lastSeen, long firstVisible, long currentTime) {
|
||||
if (!enabled) return false;
|
||||
if (!isEnabled()) return false;
|
||||
|
||||
if (shouldDisplayFullScreen(firstVisible, currentTime)) {
|
||||
return true;
|
||||
@@ -45,4 +44,12 @@ class PinsForAllSchedule implements MegaphoneSchedule {
|
||||
return schedule.shouldDisplay(seenCount, lastSeen, firstVisible, currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEnabled() {
|
||||
if (FeatureFlags.pinsForAllMegaphoneKillSwitch() || SignalStore.registrationValues().pinWasRequiredAtRegistration()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return FeatureFlags.pinsForAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user