From c1f0efb29e8225eeeccec1af7e11f45d2d32c80d Mon Sep 17 00:00:00 2001 From: Marvin W Date: Mon, 13 Jul 2026 11:52:07 +0200 Subject: [PATCH] potoken: Drop state from previous version on update --- .../org/microg/gms/potokens/PoTokenStore.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/potokens/PoTokenStore.kt b/play-services-core/src/main/kotlin/org/microg/gms/potokens/PoTokenStore.kt index cef17e7776..dd5e69c94e 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/potokens/PoTokenStore.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/potokens/PoTokenStore.kt @@ -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) }