From 34087b38d2cedc3d2b013d0588a5e70445e7fb49 Mon Sep 17 00:00:00 2001 From: Alexander Eggers <7427545+AlexanderEggers@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:17:38 +1000 Subject: [PATCH] feat: update example project --- .../alexandereggers/ksecurestorage/example/Greeting.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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}!" } }