-
Notifications
You must be signed in to change notification settings - Fork 0
Wire up settings URLs #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,7 @@ import androidx.compose.material3.* | |||||||||||||||||
| import androidx.compose.runtime.* | ||||||||||||||||||
| import androidx.compose.ui.Alignment | ||||||||||||||||||
| import androidx.compose.ui.Modifier | ||||||||||||||||||
| import androidx.compose.ui.platform.LocalUriHandler | ||||||||||||||||||
| import androidx.compose.ui.text.font.FontWeight | ||||||||||||||||||
| import androidx.compose.ui.unit.dp | ||||||||||||||||||
| import androidx.lifecycle.Lifecycle | ||||||||||||||||||
|
|
@@ -36,6 +37,7 @@ fun SettingsScreen( | |||||||||||||||||
| LaunchedEffect(lifecycleState) { | ||||||||||||||||||
| if (lifecycleState == Lifecycle.State.RESUMED) viewModel.refresh() | ||||||||||||||||||
| } | ||||||||||||||||||
| val uriHandler = LocalUriHandler.current | ||||||||||||||||||
|
|
||||||||||||||||||
| if (showAccountsSheet) { | ||||||||||||||||||
| AccountsSheet( | ||||||||||||||||||
|
|
@@ -120,10 +122,10 @@ fun SettingsScreen( | |||||||||||||||||
| // More Options Section | ||||||||||||||||||
| item { | ||||||||||||||||||
| SettingsSectionHeader(stringResource(Res.string.settings_section_more_options)) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_share_feedback), onClick = { /* TODO */ }) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_get_help), onClick = { /* TODO */ }) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_terms_of_service), onClick = { /* TODO */ }) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_privacy_policy), onClick = { /* TODO */ }) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_share_feedback), onClick = { uriHandler.openUri("https://github.com/mobile/feedback") }) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_get_help), onClick = { uriHandler.openUri("https://support.github.com") }) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_terms_of_service), onClick = { uriHandler.openUri("https://docs.github.com/en/site-policy/github-terms/github-terms-of-service") }) | ||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_privacy_policy), onClick = { uriHandler.openUri("https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement") }) | ||||||||||||||||||
|
Comment on lines
+125
to
+128
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the
Suggested change
|
||||||||||||||||||
| SettingsRow(title = stringResource(Res.string.settings_open_source_libraries), onClick = { /* TODO */ }) | ||||||||||||||||||
| SettingsRow( | ||||||||||||||||||
| title = stringResource(Res.string.settings_sign_out), | ||||||||||||||||||
|
|
||||||||||||||||||
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.
To improve robustness and reduce duplication, consider creating a remembered helper function to handle URI opening. This allows you to centralize error handling (e.g., catching exceptions if no browser is installed on the device) and makes the UI code cleaner.