adds rest list receiver, adds local code storage

- rest class now receives a list as well as single
  messages
- adds support for threaded singleton which takes
  care of continuous checking of the bump server
  to get the most up-to-date list of messages
- adds local data class with tests to get locally saved
  code in preferences
This commit is contained in:
2021-12-29 19:42:43 +01:00
parent 7e4cfceab4
commit 734b64ce3b
10 changed files with 187 additions and 16 deletions

View File

@ -0,0 +1,24 @@
package com.example.bump
import android.content.Context
import android.content.Context.MODE_PRIVATE
import android.content.SharedPreferences
import com.maenle.bump.R
class LocalData(context: Context) {
private val codeKey = context.getString(R.string.code_key)
private val preferenceKey = context.getString(R.string.preference_file_key)
private val preferences: SharedPreferences =
context.getSharedPreferences(preferenceKey, MODE_PRIVATE)
var code: String?
get() {
return preferences.getString(codeKey, null)
}
set(codeValue) {
preferences.edit().putString(codeKey, codeValue).apply()
}
// var messages: List<>
}