adding privacy policy link in settings

This commit is contained in:
Adam Brown 2022-03-02 19:22:33 +00:00
parent ab4ab5f2a1
commit 634fc15829
3 changed files with 11 additions and 0 deletions

View File

@ -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() })
}
}
}
}

View File

@ -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
}

View File

@ -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
}
}
}