tj
2025-04-07 3433f3e9a0254b24cec2836b112267b1af3f9101
app/src/main/java/com/example/firstapp/utils/PreferencesManager.kt
@@ -7,6 +7,8 @@
    private const val PREF_NAME = "app_preferences"
    private const val KEY_TOKEN = "user_token"
    private const val KEY_PHONE = "user_phone"
    private const val KEY_FIRST_INSTALL = "first_install"
    private const val LAST_LOGIN_PHONE = "last_login_phone"
    private lateinit var preferences: SharedPreferences
@@ -37,4 +39,20 @@
            apply()
        }
    }
    fun isFirstInstall(): Boolean {
        return preferences.getBoolean(KEY_FIRST_INSTALL, true)
    }
    fun setFirstInstall(isFirst: Boolean) {
        preferences.edit().putBoolean(KEY_FIRST_INSTALL, isFirst).apply()
    }
    fun saveLastLoginPhone(phone: String) {
        preferences.edit().putString(LAST_LOGIN_PHONE, phone).apply()
    }
    fun getLastLoginPhone(): String {
        return preferences.getString(LAST_LOGIN_PHONE, "") ?: ""
    }