From 48b44a6e27b87ee8bf5340a8d7ff37afaf04b7f9 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 22 Oct 2026 12:04:10 +0200 Subject: Optional app PIN, settings header, pink selection ring - A PIN (4 to 8 digits, salted SHA-256 in prefs) set in Settings shows a logo splash with a PIN prompt at start and whenever the app returns after leaving the screen; Back there leaves the app. - Settings gets the back-arrow header shared with the folder grid (Ui.header) and scrolls, since the PIN fields overflow the screen. - Tile and list focus rings use the icon pink. Co-Authored-By: Claude Opus 5.5 --- app/src/test/java/mygram/droid/LogicTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app/src/test/java/mygram') diff --git a/app/src/test/java/mygram/droid/LogicTest.java b/app/src/test/java/mygram/droid/LogicTest.java index e807725..6fb45aa 100644 --- a/app/src/test/java/mygram/droid/LogicTest.java +++ b/app/src/test/java/mygram/droid/LogicTest.java @@ -107,4 +107,23 @@ public class LogicTest { assertFalse(d.press(2000)); assertFalse("301 ms is too slow", d.press(2301)); } + + @Test + public void validatesPins() { + assertTrue(Prefs.validPin("1234")); + assertTrue(Prefs.validPin("12345678")); + assertFalse(Prefs.validPin("123")); + assertFalse(Prefs.validPin("123456789")); + assertFalse(Prefs.validPin("12a4")); + assertFalse(Prefs.validPin("")); + } + + @Test + public void hashesPinsWithSalt() { + String h = Prefs.hash("00ff", "1234"); + assertEquals(64, h.length()); + assertEquals(h, Prefs.hash("00ff", "1234")); + assertFalse(h.equals(Prefs.hash("00fe", "1234"))); + assertFalse(h.equals(Prefs.hash("00ff", "1235"))); + } } -- cgit v1.2.3