diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 0a7e86b..406acec 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -15,7 +15,6 @@
-
-
diff --git a/app/ios/src/appleMain/kotlin/Main.kt b/app/ios/src/appleMain/kotlin/Main.kt
index d6a64cf..61fe104 100644
--- a/app/ios/src/appleMain/kotlin/Main.kt
+++ b/app/ios/src/appleMain/kotlin/Main.kt
@@ -1,5 +1,4 @@
import androidx.compose.ui.window.ComposeUIViewController
-import com.liftric.kvault.KVault
import dev.schlaubi.tonbrett.app.MobileTonbrettApp
import dev.schlaubi.tonbrett.app.api.ProvideContext
import platform.UIKit.UIViewController
diff --git a/app/shared/src/appleMain/kotlin/dev/schlaubi/tonbrett/app/api/AppContext.kt b/app/shared/src/appleMain/kotlin/dev/schlaubi/tonbrett/app/api/AppContext.kt
index 34c0855..77c8e7a 100644
--- a/app/shared/src/appleMain/kotlin/dev/schlaubi/tonbrett/app/api/AppContext.kt
+++ b/app/shared/src/appleMain/kotlin/dev/schlaubi/tonbrett/app/api/AppContext.kt
@@ -4,13 +4,29 @@ import com.liftric.kvault.KVault
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
-import platform.UIKit.UIViewController
actual val Dispatchers.IO: CoroutineDispatcher
get() = IO
-actual open class AppContext : AppContextBase() {
- override val vault: KVault = KVault()
- open fun present(viewController: UIViewController): Unit = TODO("Please implement this")
- actual open fun reAuthorize() = onReAuthorize()
+actual open class AppContext : AppContextBase(), MobileAppContext {
+ private val vault: KVault = KVault()
+ override var onReAuthorize: () -> Unit = { TODO() }
+ actual override val isSignedIn: Boolean
+ get() = vault.existsObject(tokenKey)
+
+ actual override var token
+ get() = getTokenOrNull() ?: error("Please sign in")
+ set(value) {
+ vault.set(tokenKey, value)
+ }
+
+ fun getTokenOrNull() = vault.string(tokenKey)
+
+ /**
+ * Initiates authorization flow for the current platform.
+ */
+ actual fun reAuthorize() {
+ vault.deleteObject(tokenKey)
+ onReAuthorize()
+ }
}
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 26cb328..61dd99e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,7 +7,7 @@ plugins {
allprojects {
group = "dev.schlaubi.tonbrett"
- version = "1.16.28"
+ version = "1.16.29"
repositories {
mavenCentral()