Created
September 8, 2020 15:36
-
-
Save StephenVinouze/a5bf0ea99fb7e1980ff09af86c3fa4c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpdatePreferences @Inject constructor(context: Context) { | |
companion object { | |
private const val UPDATE_DETECTOR_SHARED_PREFERENCES = "updateDetector" | |
private const val VERSION = "updateDetector:version" | |
} | |
private val sharedPreferences: SharedPreferences by lazy { context.getSharedPreferences(UPDATE_DETECTOR_SHARED_PREFERENCES, Activity.MODE_PRIVATE) } | |
var version: String? | |
get() = sharedPreferences.getString(VERSION, null) | |
set(value) { | |
value?.let { sharedPreferences.putString(VERSION, it) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment