This commit is contained in:
2024-08-03 15:58:19 +08:00
parent b17ac76005
commit 2dc0ee3307
9 changed files with 269 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ package com.aiosman.riderpro
import android.content.Context
import android.content.SharedPreferences
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
/**
* 持久化本地数据
@@ -12,10 +13,16 @@ object AppStore {
var token: String? = null
var rememberMe: Boolean = false
private lateinit var sharedPreferences: SharedPreferences
lateinit var googleSignInOptions: GoogleSignInOptions
fun init(context: Context) {
sharedPreferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
this.loadData()
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken("754277015802-uarf8br8k8gkpbj0t9g65bvkvit630q5.apps.googleusercontent.com") // Replace with your server's client ID
.requestEmail()
.build()
googleSignInOptions = gso
}
suspend fun saveData() {