mirror of
https://github.com/ouchadam/small-talk.git
synced 2024-12-22 07:55:36 +01:00
adding privacy policy link in settings
This commit is contained in:
parent
ab4ab5f2a1
commit
634fc15829
@ -32,6 +32,7 @@ import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.core.net.toUri
|
||||
import app.dapk.st.core.Lce
|
||||
import app.dapk.st.core.StartObserving
|
||||
import app.dapk.st.core.components.CenteredLoading
|
||||
@ -220,6 +221,9 @@ private fun SettingsViewModel.ObserveEvents(onSignOut: () -> Unit) {
|
||||
OpenEventLog -> {
|
||||
context.startActivity(Intent(context, EventLogActivity::class.java))
|
||||
}
|
||||
is OpenUrl -> {
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW).apply { data = it.url.toUri() })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ sealed interface SettingItem {
|
||||
ClearCache,
|
||||
EventLog,
|
||||
Encryption,
|
||||
PrivacyPolicy,
|
||||
Ignored,
|
||||
}
|
||||
}
|
||||
@ -52,6 +53,7 @@ sealed interface SettingsEvent {
|
||||
object SignedOut : SettingsEvent
|
||||
data class Toast(val message: String) : SettingsEvent
|
||||
object OpenEventLog : SettingsEvent
|
||||
data class OpenUrl(val url: String) : SettingsEvent
|
||||
data class CopyToClipboard(val message: String, val content: String) : SettingsEvent
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ class SettingsViewModel(
|
||||
SettingItem.Header("Account"),
|
||||
SettingItem.Text(SignOut, "Sign out"),
|
||||
SettingItem.Header("About"),
|
||||
SettingItem.Text(PrivacyPolicy, "Privacy policy"),
|
||||
SettingItem.Text(Ignored, "Version", buildMeta.versionName),
|
||||
)
|
||||
)
|
||||
@ -75,6 +76,10 @@ class SettingsViewModel(
|
||||
copy(page = SpiderPage(Page.Routes.encryption, "Encryption", Page.Routes.root, Page.Security))
|
||||
}
|
||||
}
|
||||
PrivacyPolicy -> _events.tryEmit(OpenUrl("https://ouchadam.github.io/small-talk/privacy/"))
|
||||
Ignored -> {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user