Modern Apps git

← Modern-Apps.git

findfamily: add broken lock icon for non-pqc connections with quantum unprotected info dialog

Commit
00ded2a9e117e128994b364a086696be1804dc7b
Author
Vayun Mathur <[email protected]>
When
2026-07-29 17:05 UTC (4 months ago)
Parents
4e5c0a8

Diff

findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.ktindex 1e3badced7..5784a5aee5 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt@@ -43,6 +43,8 @@ import com.vayunmathur.library.ui.IconLink import com.vayunmathur.library.ui.IconLocationOn import com.vayunmathur.library.ui.IconPerson import com.vayunmathur.library.ui.IconButton+import com.vayunmathur.library.ui.IconLock+import com.vayunmathur.library.ui.IconLockOpen import com.vayunmathur.library.ui.ListItem import com.vayunmathur.library.ui.ListItemDefaults import com.vayunmathur.library.ui.MaterialTheme@@ -57,6 +59,8 @@ import com.vayunmathur.library.ui.Switch import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.ToggleFloatingActionButton import com.vayunmathur.library.ui.TopAppBar+import com.vayunmathur.library.ui.AlertDialog+import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.ui.dynamicLightColorScheme import com.vayunmathur.library.ui.rememberBottomSheetScaffoldState import com.vayunmathur.library.ui.rememberSliderState@@ -697,17 +701,36 @@ fun UserCard(user: User, locationValue: LocationValue?, showSupportingContent: B             stringResource(R.string.since_time_date, formattedTime, formattedDate)         }     }+    // PQC status: show broken lock if peer lacks PQC key (not protected against quantum computers).+    val isPqcProtected = user.id == Networking.userid || user.pqcEncryptionKey != null+    var showPqcInfo by remember(user.id) { mutableStateOf(false) }     Card(if (showSupportingContent) Modifier.clickable(onClick = onClick) else Modifier) {         ListItem(             leadingContent = { UserPicture(user, 40.dp) },             colors = ListItemDefaults.colors(containerColor = Color.Transparent),             content = {-                Text(-                    user.name,-                    style = MaterialTheme.typography.titleMediumEmphasized,-                    maxLines = 1,-                    overflow = TextOverflow.Ellipsis-                )+                Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp)) {+                    Text(+                        user.name,+                        style = MaterialTheme.typography.titleMediumEmphasized,+                        maxLines = 1,+                        overflow = TextOverflow.Ellipsis,+                        modifier = Modifier.weight(1f, fill = false)+                    )+                    // Lock icon: only in list view (supporting content shown) and for non-self.+                    if (showSupportingContent && user.id != Networking.userid) {+                        Box(Modifier.clickable(+                            interactionSource = remember { androidx.compose.foundation.interaction.MutableInteractionSource() },+                            indication = null+                        ) { if (!isPqcProtected) showPqcInfo = true }) {+                            if (isPqcProtected) {+                                IconLock(tint = Color(0xFF4CAF50), modifier = Modifier.size(18.dp))+                            } else {+                                IconLockOpen(tint = Color(0xFFF44336), modifier = Modifier.size(18.dp))+                            }+                        }+                    }+                }             },             supportingContent = {                 if (showSupportingContent) {@@ -725,6 +748,14 @@ fun UserCard(user: User, locationValue: LocationValue?, showSupportingContent: B             }         )     }+    if (showPqcInfo) {+        AlertDialog(+            onDismissRequest = { showPqcInfo = false },+            title = { Text(stringResource(R.string.pqc_unprotected_title)) },+            text = { Text(stringResource(R.string.pqc_unprotected_message)) },+            confirmButton = { TextButton(onClick = { showPqcInfo = false }) { Text(stringResource(R.string.ok)) } }+        )+    } }  @Composable
findfamily/src/main/res/values/strings.xml
diff --git a/findfamily/src/main/res/values/strings.xml b/findfamily/src/main/res/values/strings.xmlindex 46b8a201df..adac6ede47 100644--- a/findfamily/src/main/res/values/strings.xml+++ b/findfamily/src/main/res/values/strings.xml@@ -244,4 +244,9 @@     <string name="el">   el: </string>     <!-- UwbRangingScreen: Hint when azimuth null. Instruction sentence -->     <string name="point_the_back_of_your_phone_toward_your">Point the back of your phone toward your contact</string>++    <!-- PQC: Shown when tapping broken-lock icon for connections without PQC key. Sentence, explains quantum risk. -->+    <string name="pqc_unprotected_title">Quantum protection</string>+    <string name="pqc_unprotected_message">Unprotected against quantum computers: this person needs to update their app.</string>+    <string name="ok">OK</string> </resources>
library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.ktindex 30f4f80a92..12e57e77db 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt@@ -139,6 +139,7 @@ import androidx.compose.material.icons.filled.History import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.HourglassBottom import androidx.compose.material.icons.filled.Image+import androidx.compose.material.icons.filled.GppBad import androidx.compose.material.icons.filled.Info import androidx.compose.material.icons.filled.InsertDriveFile import androidx.compose.material.icons.filled.Iso@@ -711,6 +712,10 @@ fun IconKey(modifier: Modifier = Modifier, tint: Color = LocalContentColor.curre fun IconLock(modifier: Modifier = Modifier, tint: Color = LocalContentColor.current) =     AppIcon(Icons.Filled.Lock, "Lock", modifier, tint) +@Composable+fun IconLockOpen(modifier: Modifier = Modifier, tint: Color = LocalContentColor.current) =+    AppIcon(Icons.Filled.GppBad, "Not PQC", modifier, tint)+ @Composable fun IconPlayCircle(modifier: Modifier = Modifier, tint: Color = LocalContentColor.current) =     AppIcon(Icons.Filled.PlayCircle, "Play", modifier, tint)