Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.ktlint)
alias(libs.plugins.roborazzi)
alias(libs.plugins.kover)
alias(libs.plugins.oss.licenses)
}

// Apply the Firebase plugin only when its expected config file is present.
Expand Down Expand Up @@ -628,6 +629,7 @@ dependencies {
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.messaging)
implementation(libs.play.services.base)
implementation(libs.play.services.oss.licenses)
implementation(libs.androidx.security.crypto)
implementation(libs.androidx.biometric)
implementation(libs.androidx.work.runtime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,30 @@ internal enum class SettingsDetail {
FontSize,
Data,
Profile,
Identity,
AccountKeys,
Relays,
KeyPackages,
Notifications,
SecurityPrivacy,
DevicePrivacy,
Help,
About,
Developer,
Donate,
}

private val defaultSettingsHomeDetails =
listOf(
SettingsDetail.Notifications,
SettingsDetail.DevicePrivacy,
SettingsDetail.Data,
SettingsDetail.Appearance,
SettingsDetail.Relays,
SettingsDetail.AccountKeys,
SettingsDetail.Help,
)

private val developerSettingsHomeDetails = defaultSettingsHomeDetails + SettingsDetail.Developer

internal fun settingsHomeDetails(developerMode: Boolean): List<SettingsDetail> = if (developerMode) developerSettingsHomeDetails else defaultSettingsHomeDetails

internal fun shouldUnlockDeveloperMode(versionTapCount: Int): Boolean = versionTapCount >= 7
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ internal fun MainShell(
},
onOpenDiagnostics = {
// Preserve `settingsDetailName` so backing out of
// Diagnostics returns to Security & Privacy (its only
// Diagnostics returns to Developer settings (its only
// entry point) rather than the Settings home, restoring
// the breadcrumb the user walked in on (#412).
sectionName = MainSection.Diagnostics.name
Expand All @@ -485,7 +485,7 @@ internal fun MainShell(
appState = appState,
onBack = {
// Leave `settingsDetailName` alone — it still holds the
// detail (Security & Privacy) the user opened Diagnostics
// Developer detail the user opened Diagnostics
// from, so Settings re-enters that screen directly (#412).
sectionName = MainSection.Settings.name
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ private const val WIPE_ENGINE_FFI_AVAILABLE = true

@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable
internal fun IdentityScreen(
internal fun AccountKeysScreen(
appState: WhiteNoiseAppState,
onBack: () -> Unit,
onOpenKeyPackages: () -> Unit,
) {
// The screen surfaces the raw nsec; keep it out of Recents thumbnails and
// screenshots, matching the encrypted-backup sheet's posture.
Expand Down Expand Up @@ -154,7 +155,7 @@ internal fun IdentityScreen(
Scaffold(
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.identity)) },
title = { Text(stringResource(R.string.account_and_keys)) },
navigationIcon = {
IconButton(onClick = onBack) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
Expand Down Expand Up @@ -217,6 +218,13 @@ internal fun IdentityScreen(
}
}
}
item {
SettingsCardRow(
title = stringResource(R.string.key_packages),
subtitle = stringResource(R.string.key_packages_settings_subtitle),
onClick = onOpenKeyPackages,
)
}
item {
SectionCard(title = stringResource(R.string.account_session)) {
Text(
Expand Down Expand Up @@ -371,7 +379,7 @@ internal fun IdentityScreen(
// screen's rememberCoroutineScope. signOutAndWipeActiveAccount
// flips activeAccountRef partway through and keeps suspending
// (push teardown, notification refresh); the account-change nav
// reset in MainShell then pops IdentityScreen out of composition,
// reset in MainShell then pops AccountKeysScreen out of composition,
// which would cancel a screen-scoped coroutine before the wipe
// finishes and before the outcome is presented (#547).
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
Expand Down Expand Up @@ -116,7 +117,11 @@ internal fun AppearanceScreen(
}
}
item {
SectionCard(title = stringResource(R.string.enter_key_behavior_title)) {
SectionCard(title = stringResource(R.string.composer)) {
Text(
text = stringResource(R.string.enter_key_behavior_title),
style = MaterialTheme.typography.labelLarge,
)
EnterKeyBehavior.entries.forEach { behavior ->
SelectableSettingsRow(
title = stringResource(behavior.labelRes),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package dev.ipf.whitenoise.android.ui.settings

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import dev.ipf.whitenoise.android.R
import dev.ipf.whitenoise.android.state.WhiteNoiseAppState
import dev.ipf.whitenoise.android.ui.common.SectionCard

@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun DeveloperScreen(
appState: WhiteNoiseAppState,
onBack: () -> Unit,
onOpenDiagnostics: () -> Unit,
) {
Scaffold(
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.developer)) },
navigationIcon = {
IconButton(onClick = onBack) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
}
},
)
},
) { padding ->
LazyColumn(
Modifier.fillMaxSize().padding(padding).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
item {
SectionCard(title = stringResource(R.string.developer)) {
SettingsSwitchRow(
title = stringResource(R.string.developer_mode),
subtitle = stringResource(R.string.developer_mode_subtitle),
checked = appState.developerMode,
onCheckedChange = { appState.updateDeveloperMode(it) },
)
if (appState.developerMode) {
HorizontalDivider(Modifier.padding(vertical = 12.dp))
SettingsRow(
title = stringResource(R.string.diagnostics),
subtitle = stringResource(R.string.diagnostics_settings_subtitle),
onClick = onOpenDiagnostics,
)
HorizontalDivider(Modifier.padding(vertical = 12.dp))
SettingsSwitchRow(
title = stringResource(R.string.streaming_debug),
subtitle = stringResource(R.string.streaming_debug_subtitle),
checked = appState.streamingDebugMode,
onCheckedChange = { appState.updateStreamingDebugMode(it) },
)
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ import kotlinx.coroutines.delay

@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun SecurityPrivacyScreen(
internal fun DevicePrivacyScreen(
appState: WhiteNoiseAppState,
onBack: () -> Unit,
onOpenDiagnostics: () -> Unit,
) {
var telemetryBusy by remember { mutableStateOf(false) }
var auditLogsBusy by remember { mutableStateOf(false) }
Expand All @@ -59,7 +58,7 @@ internal fun SecurityPrivacyScreen(
Scaffold(
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.security_and_privacy)) },
title = { Text(stringResource(R.string.device_privacy)) },
navigationIcon = {
IconButton(onClick = onBack) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
Expand All @@ -70,7 +69,7 @@ internal fun SecurityPrivacyScreen(
) { padding ->
LazyColumn(Modifier.fillMaxSize().padding(padding).padding(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
item {
SectionCard(title = stringResource(R.string.security_and_privacy)) {
SectionCard(title = stringResource(R.string.device_privacy)) {
SettingsSwitchRow(
title = stringResource(R.string.require_app_unlock),
subtitle =
Expand Down Expand Up @@ -208,27 +207,6 @@ internal fun SecurityPrivacyScreen(
}
}
}
item {
SectionCard(title = stringResource(R.string.developer)) {
SettingsSwitchRow(
title = stringResource(R.string.developer_mode),
subtitle = stringResource(R.string.developer_mode_subtitle),
checked = appState.developerMode,
onCheckedChange = { appState.updateDeveloperMode(it) },
)
if (appState.developerMode) {
HorizontalDivider(Modifier.padding(vertical = 12.dp))
SettingsRow(stringResource(R.string.diagnostics), stringResource(R.string.diagnostics_settings_subtitle)) { onOpenDiagnostics() }
HorizontalDivider(Modifier.padding(vertical = 12.dp))
SettingsSwitchRow(
title = stringResource(R.string.streaming_debug),
subtitle = stringResource(R.string.streaming_debug_subtitle),
checked = appState.streamingDebugMode,
onCheckedChange = { appState.updateStreamingDebugMode(it) },
)
}
}
}
}
}
}
Loading
Loading