-
Notifications
You must be signed in to change notification settings - Fork 26
added Tor disabled warning popup with informational dialog #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an informational dialog for the Tor toggle (disabled while the feature is under development), updates the supporting strings, adjusts the proof mode initialization logic by removing an Android version check, and adds a preview for the new dialog.
- Added string resources for the Tor warning dialog
- Enabled the Tor switch in settings to show an info dialog and prevent actual toggling
- Removed the legacy Android <M API check in
ProofModeHelper.init
, potentially altering init behavior on older devices - Updated
BaseDialog
with an Info icon import, centered title alignment, and a Tor warning preview
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
app/src/main/res/values/strings.xml | Added tor_disabled_title and tor_disabled_message entries |
app/src/main/java/net/opendasharchive/openarchive/util/ProofModeHelper.kt | Removed pre-M API level check and its fallback path |
app/src/main/java/net/opendasharchive/openarchive/features/settings/SettingsFragment.kt | Enabled Tor toggle to fire an informational dialog |
app/src/main/java/net/opendasharchive/openarchive/features/core/dialog/BaseDialog.kt | Imported Icons.Default.Info , centered BaseDialogTitle , and added preview |
Comments suppressed due to low confidence (2)
app/src/main/java/net/opendasharchive/openarchive/util/ProofModeHelper.kt:21
- Removal of the Build.VERSION.SDK_INT check drops the fallback path for pre-M devices, causing
finishInit
not to be called on older Android versions. Reintroduce a conditional or restructure the logic so thatfinishInit
always runs when initialization is required.
val encryptedPassphrase = Prefs.proofModeEncryptedPassphrase
app/src/main/java/net/opendasharchive/openarchive/features/settings/SettingsFragment.kt:144
- The new informational dialog flow for the Tor preference lacks unit or UI tests to verify it shows correctly and blocks toggling as intended. Consider adding preference interaction tests or a Compose preview assertion to cover this behavior.
setOnPreferenceClickListener {
setOnPreferenceChangeListener { _, newValue -> | ||
false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Combining both click and change listeners to disable state changes can be simplified. You could disable the preference entirely or handle the blocking logic solely in the click listener for clearer intent.
setOnPreferenceChangeListener { _, newValue -> | |
false | |
} | |
// Removed redundant setOnPreferenceChangeListener |
Copilot uses AI. Check for mistakes.
onClick = { | ||
btn.action() | ||
onDismiss() | ||
}) |
Check warning
Code scanning / detekt
Reports missing newlines (e.g. between parentheses of a multi-line function call Warning
onClick = { | ||
btn.action() | ||
onDismiss() | ||
}) |
Check warning
Code scanning / detekt
Reports incorrect argument list wrapping Warning
onClick = { | ||
btn.action() | ||
onDismiss() | ||
}) |
Check warning
Code scanning / detekt
Reports missing newlines (e.g. between parentheses of a multi-line function call Warning
onClick = { | ||
btn.action() | ||
onDismiss() | ||
}) |
Check warning
Code scanning / detekt
Reports incorrect argument list wrapping Warning
@Preview | ||
@Preview(uiMode = UI_MODE_NIGHT_YES) | ||
@Composable | ||
private fun TorWarningDialogPreview() { |
Check warning
Code scanning / detekt
Function names should follow the naming convention set in the configuration. Warning
@Preview | ||
@Preview(uiMode = UI_MODE_NIGHT_YES) | ||
@Composable | ||
private fun TorWarningDialogPreview() { |
Check warning
Code scanning / detekt
Private function is unused and should be removed. Warning
|
||
BaseDialog( |
Check warning
Code scanning / detekt
Reports methods that have an empty first line. Warning
if (e is UserNotAuthenticatedException) { | ||
Runtime.getRuntime().exit(0) | ||
} | ||
else { |
Check warning
Code scanning / detekt
Reports spaces around keywords Warning
No description provided.