Skip to content

Commit

Permalink
Fix ios build
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Nov 25, 2023
1 parent bec5222 commit f7cfc69
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/ios/src/appleMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

allprojects {
group = "dev.schlaubi.tonbrett"
version = "1.16.28"
version = "1.16.29"

repositories {
mavenCentral()
Expand Down

0 comments on commit f7cfc69

Please sign in to comment.