adicionando datastore
This commit is contained in:
parent
06c9c4abea
commit
0b259035f9
@ -48,6 +48,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(files("libs/AditumSdkIntegration-2.3.6.67824-release.aar"))
|
implementation(files("libs/AditumSdkIntegration-2.3.6.67824-release.aar"))
|
||||||
implementation("com.google.code.gson:gson:2.13.1")
|
implementation("com.google.code.gson:gson:2.13.1")
|
||||||
|
implementation("androidx.datastore:datastore-preferences:1.1.7")
|
||||||
implementation(libs.androidx.core.ktx)
|
implementation(libs.androidx.core.ktx)
|
||||||
implementation(libs.androidx.lifecycle.runtime.ktx)
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
implementation(libs.androidx.activity.compose)
|
implementation(libs.androidx.activity.compose)
|
||||||
|
|||||||
14
app/src/main/java/com/example/mypos/preferences/PrefKeys.kt
Normal file
14
app/src/main/java/com/example/mypos/preferences/PrefKeys.kt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.example.mypos.preferences
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.datastore.core.DataStore
|
||||||
|
import androidx.datastore.preferences.core.Preferences
|
||||||
|
import androidx.datastore.preferences.core.booleanPreferencesKey
|
||||||
|
import androidx.datastore.preferences.core.stringPreferencesKey
|
||||||
|
import androidx.datastore.preferences.preferencesDataStore
|
||||||
|
|
||||||
|
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "my_session_prefs")
|
||||||
|
|
||||||
|
object PrefKeys {
|
||||||
|
val SERIAL_NUMBER = stringPreferencesKey("session_serial_number")
|
||||||
|
val ACTIVATION_CODE = stringPreferencesKey("session_activation_code")
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user