mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-26 12:44:38 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user