Skip to content

Commit

Permalink
Open "Manage apps" instead of manual
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc2822 committed Jan 24, 2025
1 parent 94b40fb commit 6db4fc5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
1 change: 0 additions & 1 deletion app/src/main/kotlin/at/bitfire/davdroid/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ object Constants {

val MANUAL_URL = "https://manual.davx5.com".toUri()
const val MANUAL_PATH_ACCOUNTS_COLLECTIONS = "accounts_collections.html"
const val MANUAL_PATH_INTRODUCTION = "introduction.html"
const val MANUAL_FRAGMENT_SERVICE_DISCOVERY = "how-does-service-discovery-work"
const val MANUAL_PATH_SETTINGS = "settings.html"
const val MANUAL_FRAGMENT_APP_SETTINGS = "app-wide-settings"
Expand Down
19 changes: 6 additions & 13 deletions app/src/main/kotlin/at/bitfire/davdroid/ui/AccountsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
Expand All @@ -75,7 +74,6 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import at.bitfire.davdroid.BuildConfig
import at.bitfire.davdroid.Constants
import at.bitfire.davdroid.R
import at.bitfire.davdroid.ui.account.AccountProgress
import at.bitfire.davdroid.ui.composable.ActionCard
Expand Down Expand Up @@ -272,11 +270,6 @@ fun AccountsScreen(

// Warnings show as action cards
val context = LocalContext.current
val uriHandler = LocalUriHandler.current
val manualUrl = Constants.MANUAL_URL.buildUpon()
.appendPath(Constants.MANUAL_PATH_INTRODUCTION)
.build()
.toString()
SyncWarnings(
notificationsWarning = notificationsPermissionState?.status?.isGranted == false,
onManagePermissions = onManagePermissions,
Expand Down Expand Up @@ -311,7 +304,8 @@ fun AccountsScreen(
contactsStorageDisabled = contactsStorageDisabled,
onManageApps = {
val intent = Intent(Settings.ACTION_APPLICATION_SETTINGS)
context.startActivity(intent)
if (intent.resolveActivity(context.packageManager) != null)
context.startActivity(intent)
},
)

Expand Down Expand Up @@ -506,9 +500,8 @@ fun SyncWarnings(
lowStorageWarning: Boolean = true,
onManageStorage: () -> Unit = {},
calendarStorageDisabled: Boolean = false,
onManageApps: () -> Unit = {},
contactsStorageDisabled: Boolean = false,
onManageContactsStorage: () -> Unit = {}
onManageApps: () -> Unit = {}
) {
Column(Modifier.padding(horizontal = 8.dp)) {
if (notificationsWarning)
Expand Down Expand Up @@ -564,7 +557,7 @@ fun SyncWarnings(
if (calendarStorageDisabled)
ActionCard(
icon = ImageVector.vectorResource(R.drawable.ic_database_off),
actionText = stringResource(R.string.account_list_learn_more),
actionText = stringResource(R.string.account_list_manage_apps),
onAction = onManageApps,
modifier = Modifier.padding(vertical = 4.dp)
) {
Expand All @@ -574,8 +567,8 @@ fun SyncWarnings(
if (contactsStorageDisabled)
ActionCard(
icon = ImageVector.vectorResource(R.drawable.ic_database_off),
actionText = stringResource(R.string.account_list_learn_more),
onAction = onManageContactsStorage,
actionText = stringResource(R.string.account_list_manage_apps),
onAction = onManageApps,
modifier = Modifier.padding(vertical = 4.dp)
) {
Text(stringResource(R.string.account_list_contacts_storage_disabled))
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@
<string name="navigation_drawer_support_project">Support the project</string>
<string name="navigation_drawer_contribute">How to contribute</string>
<string name="navigation_drawer_privacy_policy">Privacy policy</string>
<string name="account_list_calendar_storage_disabled">Calendar storage missing. Did you disable the calendar storage system app?</string>
<string name="account_list_contacts_storage_disabled">Contacts storage missing. Did you disable the contacts storage system app?</string>
<string name="account_list_no_notification_permission">Notifications disabled. You won\'t be notified about sync errors.</string>
<string name="account_list_no_internet">Automatic synchronization not active (no verified Internet connection).</string>
<string name="account_list_manage_connections">Manage connections</string>
Expand All @@ -143,7 +141,9 @@
<string name="account_list_manage_battery_saver">Manage battery saver</string>
<string name="account_list_low_storage">Storage space low. Android will not sync local changes immediately, but during the next regular sync.</string>
<string name="account_list_manage_storage">Manage storage</string>
<string name="account_list_learn_more">Learn more</string>
<string name="account_list_calendar_storage_disabled">Calendar provider missing. Did you disable the \"Calendar storage\" system app?</string>
<string name="account_list_contacts_storage_disabled">Contacts provider missing. Did you disable the \"Contacts storage\" system app?</string>
<string name="account_list_manage_apps">Manage apps</string>
<string name="account_list_welcome">Welcome to DAVx⁵!</string>
<string name="account_list_empty">Connect to your server and keep your calendars and contacts synchronized.</string>
<string name="accounts_sync_all">Sync all accounts</string>
Expand Down

0 comments on commit 6db4fc5

Please sign in to comment.