Skip to content

Commit

Permalink
Include "Contact" and "Documentation" buttons also on Troubleshooting…
Browse files Browse the repository at this point in the history
… screen
  • Loading branch information
Waboodoo committed Dec 21, 2023
1 parent 5248f2d commit 5c80fe4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Article
import androidx.compose.material.icons.automirrored.outlined.Article
import androidx.compose.material.icons.automirrored.outlined.LiveHelp
import androidx.compose.material.icons.outlined.Code
import androidx.compose.material.icons.outlined.Email
import androidx.compose.material.icons.outlined.LiveHelp
import androidx.compose.material.icons.outlined.People
import androidx.compose.material.icons.outlined.Translate
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -47,7 +47,7 @@ fun AboutContent(
)

SettingsButton(
icon = Icons.Outlined.LiveHelp,
icon = Icons.AutoMirrored.Outlined.LiveHelp,
title = stringResource(R.string.settings_documentation),
subtitle = stringResource(R.string.settings_documentation_summary),
onClick = onDocumentationButtonClicked,
Expand Down Expand Up @@ -105,7 +105,7 @@ fun AboutContent(
)

SettingsButton(
icon = Icons.Outlined.Article,
icon = Icons.AutoMirrored.Outlined.Article,
title = stringResource(R.string.settings_privacy_policy),
subtitle = stringResource(R.string.settings_privacy_policy_summary),
onClick = onPrivacyPolicyButtonClicked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.LiveHelp
import androidx.compose.material.icons.outlined.BatteryFull
import androidx.compose.material.icons.outlined.Cookie
import androidx.compose.material.icons.outlined.Email
import androidx.compose.material.icons.outlined.History
import androidx.compose.material.icons.outlined.Layers
import androidx.compose.material.icons.outlined.Schedule
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand All @@ -28,6 +31,8 @@ fun TroubleShootingContent(
onAllowOverlayButtonClicked: () -> Unit,
onAllowXiaomiOverlayButtonClicked: () -> Unit,
onBatteryOptimizationButtonClicked: () -> Unit,
onDocumentationButtonClicked: () -> Unit,
onContactButtonClicked: () -> Unit,
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -78,5 +83,21 @@ fun TroubleShootingContent(
onClick = onBatteryOptimizationButtonClicked,
)
}

HorizontalDivider()

SettingsButton(
icon = Icons.AutoMirrored.Outlined.LiveHelp,
title = stringResource(R.string.settings_documentation),
subtitle = stringResource(R.string.settings_documentation_summary),
onClick = onDocumentationButtonClicked,
)

SettingsButton(
icon = Icons.Outlined.Email,
title = stringResource(R.string.settings_mail),
subtitle = stringResource(R.string.settings_mail_summary),
onClick = onContactButtonClicked,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ fun TroubleShootingScreen() {
onAllowOverlayButtonClicked = viewModel::onAllowOverlayButtonClicked,
onAllowXiaomiOverlayButtonClicked = viewModel::onAllowXiaomiOverlayButtonClicked,
onBatteryOptimizationButtonClicked = viewModel::onBatteryOptimizationButtonClicked,
onDocumentationButtonClicked = viewModel::onDocumentationButtonClicked,
onContactButtonClicked = viewModel::onContactButtonClicked,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ch.rmy.android.http_shortcuts.http.CookieManager
import ch.rmy.android.http_shortcuts.logging.Logging
import ch.rmy.android.http_shortcuts.navigation.NavigationDestination
import ch.rmy.android.http_shortcuts.utils.AppOverlayUtil
import ch.rmy.android.http_shortcuts.utils.ExternalURLs
import ch.rmy.android.http_shortcuts.utils.RestrictionsUtil
import ch.rmy.android.http_shortcuts.utils.Settings
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down Expand Up @@ -76,6 +77,14 @@ constructor(
sendIntent(restrictionsUtil.getRequestIgnoreBatteryOptimizationIntent() ?: skipAction())
}

fun onDocumentationButtonClicked() = runAction {
openURL(ExternalURLs.DOCUMENTATION_PAGE)
}

fun onContactButtonClicked() = runAction {
navigate(NavigationDestination.Contact)
}

fun onDialogDismissalRequested() = runAction {
updateDialogState(null)
}
Expand Down

0 comments on commit 5c80fe4

Please sign in to comment.