diff --git a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/Link.kt b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/Link.kt new file mode 100644 index 00000000..cf1935cb --- /dev/null +++ b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/components/prefs/Link.kt @@ -0,0 +1,33 @@ +package com.machiav3lli.fdroid.ui.compose.components.prefs + +import android.content.Intent +import android.net.Uri +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import com.machiav3lli.fdroid.entity.LinkRef + +@Composable +fun LinkPreference( + modifier: Modifier = Modifier, + link: LinkRef, + index: Int = 1, + groupSize: Int = 1, +) { + val context = LocalContext.current + + BasePreference( + modifier = modifier, + titleId = link.titleId, + index = index, + groupSize = groupSize, + onClick = { + context.startActivity( + Intent( + Intent.ACTION_VIEW, + Uri.parse(link.url) + ) + ) + } + ) +} \ No newline at end of file