Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,27 @@ package org.microg.gms.potokens

import android.content.Context
import android.content.SharedPreferences
import com.google.android.gms.BuildConfig
import androidx.core.content.edit

private const val KEY_PO_TOKEN_WINDOW_STATE_VERSION = "po_token_window_state_version"

class PoTokenStore(context: Context) {

private val sp: SharedPreferences =
context.getSharedPreferences("com.google.android.gms.potokens", Context.MODE_PRIVATE)

init {
val storedVersion = sp.getInt(KEY_PO_TOKEN_WINDOW_STATE_VERSION, 0)
if (storedVersion < BuildConfig.VERSION_CODE) {
sp.edit {
remove(KEY_PO_TOKEN_ACCESSED_TIME)
remove(KEY_PO_TOKEN_INTERVAL_FLAG)
putInt(KEY_PO_TOKEN_WINDOW_STATE_VERSION, BuildConfig.VERSION_CODE)
}
}
}

fun getString(key: String, defValue: String?): String? {
return sp.getString(key, defValue)
}
Expand Down
Loading