Re-enable and clean up Signal PINs.

- Require PINs during registration agian.
- Change min length to 4.
- Allow the full-screen megaphone to be enabled remotely.
- Clean up and remove some code.
This commit is contained in:
Greyson Parrelli
2020-04-01 19:55:18 -04:00
parent 6f961ade74
commit f1ea035197
16 changed files with 68 additions and 187 deletions

View File

@@ -98,74 +98,6 @@ public class PinsForAllScheduleTest {
assertTrue(result);
}
@Test
public void givenFirstVisibleIsZero_whenIGetDaysRemaining_thenIExpectMax() {
// GIVEN
long firstVisible = 0;
long expected = PinsForAllSchedule.DAYS_REMAINING_MAX;
// WHEN
long result = PinsForAllSchedule.getDaysRemaining(firstVisible, 0);
// THEN
assertEquals(expected, result);
}
@Test
public void givenFirstVisibleIsNow_whenIGetDaysRemaining_thenIExpectMax() {
// GIVEN
long now = System.currentTimeMillis();
long expected = PinsForAllSchedule.DAYS_REMAINING_MAX;
// WHEN
long result = PinsForAllSchedule.getDaysRemaining(now, now);
// THEN
assertEquals(expected, result);
}
@Test
public void givenFirstVisibleIsFiveSecondsAgo_whenIGetDaysRemaining_thenIExpectMax() {
// GIVEN
long now = System.currentTimeMillis();
long firstVisible = now - TimeUnit.SECONDS.toMillis(5);
long expected = PinsForAllSchedule.DAYS_REMAINING_MAX;
// WHEN
long result = PinsForAllSchedule.getDaysRemaining(firstVisible, now);
// THEN
assertEquals(expected, result);
}
@Test
public void givenFirstVisibleIsADayAgo_whenIGetDaysRemaining_thenIExpectMaxLessOne() {
// GIVEN
long now = System.currentTimeMillis();
long firstVisible = now - TimeUnit.DAYS.toMillis(1);
long expected = PinsForAllSchedule.DAYS_REMAINING_MAX - 1;
// WHEN
long result = PinsForAllSchedule.getDaysRemaining(firstVisible, now);
// THEN
assertEquals(expected, result);
}
@Test
public void givenFirstVisibleIsAMonthAgo_whenIGetDaysRemaining_thenIExpectZero() {
// GIVEN
long now = System.currentTimeMillis();
long firstVisible = now - TimeUnit.DAYS.toMillis(31);
long expected = 0;
// WHEN
long result = PinsForAllSchedule.getDaysRemaining(firstVisible, now);
// THEN
assertEquals(expected, result);
}
@Test
public void whenUserIsANewInstallAndFlagIsDisabled_whenIShouldDisplay_thenIExpectFalse() {
// GIVEN