add: donation selection to support

This commit is contained in:
Zane Schepke 2024-11-12 22:46:06 -05:00
parent 5cc2ae0d01
commit e9ae48f96c
2 changed files with 82 additions and 48 deletions

View File

@ -1,10 +1,12 @@
package com.zaneschepke.wireguardautotunnel.ui.screens.support package com.zaneschepke.wireguardautotunnel.ui.screens.support
import android.os.Build
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AttachMoney
import androidx.compose.material.icons.filled.Book import androidx.compose.material.icons.filled.Book
import androidx.compose.material.icons.filled.LineStyle import androidx.compose.material.icons.filled.LineStyle
import androidx.compose.material.icons.filled.Mail import androidx.compose.material.icons.filled.Mail
@ -19,6 +21,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.zaneschepke.wireguardautotunnel.BuildConfig
import com.zaneschepke.wireguardautotunnel.R import com.zaneschepke.wireguardautotunnel.R
import com.zaneschepke.wireguardautotunnel.ui.Route import com.zaneschepke.wireguardautotunnel.ui.Route
import com.zaneschepke.wireguardautotunnel.ui.common.button.surface.SelectionItem import com.zaneschepke.wireguardautotunnel.ui.common.button.surface.SelectionItem
@ -101,54 +104,83 @@ fun SupportScreen() {
), ),
) )
SurfaceSelectionGroupButton( SurfaceSelectionGroupButton(
listOf( buildList {
SelectionItem( addAll(
ImageVector.vectorResource(R.drawable.telegram), listOf(
title = { SelectionItem(
Text( ImageVector.vectorResource(R.drawable.telegram),
stringResource(R.string.chat_description), title = {
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface), Text(
) stringResource(R.string.chat_description),
}, style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
trailing = { )
ForwardButton { },
context.openWebUrl(context.getString(R.string.telegram_url)) trailing = {
} ForwardButton {
}, context.openWebUrl(context.getString(R.string.telegram_url))
onClick = { }
context.openWebUrl(context.getString(R.string.telegram_url)) },
}, onClick = {
), context.openWebUrl(context.getString(R.string.telegram_url))
SelectionItem( },
ImageVector.vectorResource(R.drawable.github), ),
title = { Text(stringResource(R.string.open_issue), style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface)) }, SelectionItem(
trailing = { ImageVector.vectorResource(R.drawable.github),
ForwardButton { title = {
context.openWebUrl(context.getString(R.string.github_url)) Text(
} stringResource(R.string.open_issue),
}, style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface))
onClick = { },
context.openWebUrl(context.getString(R.string.github_url)) trailing = {
}, ForwardButton {
), context.openWebUrl(context.getString(R.string.github_url))
SelectionItem( }
Icons.Filled.Mail, },
title = { onClick = {
Text( context.openWebUrl(context.getString(R.string.github_url))
stringResource(R.string.email_description), },
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface), ),
) SelectionItem(
}, Icons.Filled.Mail,
trailing = { title = {
ForwardButton { Text(
context.launchSupportEmail() stringResource(R.string.email_description),
} style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
}, )
onClick = { },
context.launchSupportEmail() trailing = {
}, ForwardButton {
), context.launchSupportEmail()
), }
},
onClick = {
context.launchSupportEmail()
},
),
)
)
if (BuildConfig.FLAVOR == "fdroid") {
add(
SelectionItem(
Icons.Filled.AttachMoney,
title = {
Text(
stringResource(R.string.donate),
style = MaterialTheme.typography.bodyMedium.copy(MaterialTheme.colorScheme.onSurface),
)
},
trailing = {
ForwardButton {
context.openWebUrl(context.getString(R.string.donate_url))
}
},
onClick = {
context.openWebUrl(context.getString(R.string.donate_url))
},
),
)
}
}
) )
VersionLabel() VersionLabel()
} }

View File

@ -9,6 +9,7 @@
<string name="docs_features" translatable="false">https://zaneschepke.com/wgtunnel-docs/features.html</string> <string name="docs_features" translatable="false">https://zaneschepke.com/wgtunnel-docs/features.html</string>
<string name="privacy_policy_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/privacypolicy.html</string> <string name="privacy_policy_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/privacypolicy.html</string>
<string name="docs_wildcards" translatable="false" >https://zaneschepke.com/wgtunnel-docs/features.html#wildcard-wi-fi-name-support</string> <string name="docs_wildcards" translatable="false" >https://zaneschepke.com/wgtunnel-docs/features.html#wildcard-wi-fi-name-support</string>
<string name="donate_url" translatable="false">https://zaneschepke.com/donate/</string>
<string name="error_file_extension">File is not a .conf or .zip</string> <string name="error_file_extension">File is not a .conf or .zip</string>
<string name="turn_off_tunnel">Action requires tunnel off</string> <string name="turn_off_tunnel">Action requires tunnel off</string>
<string name="no_tunnels">No tunnels added yet!</string> <string name="no_tunnels">No tunnels added yet!</string>
@ -227,4 +228,5 @@
<string name="stop_auto">Stop auto-tunnel</string> <string name="stop_auto">Stop auto-tunnel</string>
<string name="tunnel_running">Tunnel running</string> <string name="tunnel_running">Tunnel running</string>
<string name="monitoring_state_changes">Monitoring state changes</string> <string name="monitoring_state_changes">Monitoring state changes</string>
<string name="donate">Donate to project</string>
</resources> </resources>