diff --git a/example/shared/src/commonMain/kotlin/io/github/alexandereggers/ksecurestorage/example/Greeting.kt b/example/shared/src/commonMain/kotlin/io/github/alexandereggers/ksecurestorage/example/Greeting.kt index e96205d..326987b 100644 --- a/example/shared/src/commonMain/kotlin/io/github/alexandereggers/ksecurestorage/example/Greeting.kt +++ b/example/shared/src/commonMain/kotlin/io/github/alexandereggers/ksecurestorage/example/Greeting.kt @@ -1,7 +1,9 @@ package io.github.alexandereggers.ksecurestorage.example import io.github.alexandereggers.ksecurestorage.KSecureStorage +import io.github.alexandereggers.ksecurestorage.getBoolean import io.github.alexandereggers.ksecurestorage.hasItem +import io.github.alexandereggers.ksecurestorage.setItem const val TEST_STORAGE_KEY = "hasDisplayedBefore" @@ -10,13 +12,13 @@ class Greeting { private val kSecureStorage = KSecureStorage() fun greet(): String { - val hasDisplayedBefore = kSecureStorage.hasItem(TEST_STORAGE_KEY) + val hasDisplayedBefore = kSecureStorage.getBoolean(TEST_STORAGE_KEY) ?: false return if (hasDisplayedBefore) { kSecureStorage.removeItem(TEST_STORAGE_KEY) "Welcome back, ${platform.name}!" } else { - kSecureStorage.setItem(TEST_STORAGE_KEY, "${true}") + kSecureStorage.setItem(TEST_STORAGE_KEY, true) "Hello, ${platform.name}!" } }