Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Add Commit Flag to ensure synchronous consistent Updates to Disk
Browse files Browse the repository at this point in the history
Signed-off-by: d067928 <jakob.moeller@sap.com>
  • Loading branch information
jakobmoellerdev committed Jun 2, 2020
1 parent 5d29b72 commit 1d52126
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object LocalData {
*
* @param value boolean if onboarding was completed
*/
fun isOnboarded(value: Boolean) = getSharedPreferenceInstance().edit {
fun isOnboarded(value: Boolean) = getSharedPreferenceInstance().edit(true) {
putBoolean(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_onboarding_completed), value
Expand Down Expand Up @@ -73,7 +73,7 @@ object LocalData {
* @param value timestamp in ms
*/
fun initialTracingActivationTimestamp(value: Long) =
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putLong(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_initial_tracing_activation_time),
Expand Down Expand Up @@ -106,7 +106,7 @@ object LocalData {
*
* @param value timestamp in ms
*/
fun lastNonActiveTracingTimestamp(value: Long?) = getSharedPreferenceInstance().edit {
fun lastNonActiveTracingTimestamp(value: Long?) = getSharedPreferenceInstance().edit(true) {
// TODO need this for nullable ref, shout not be goto for nullable storage
putLong(
CoronaWarnApplication.getAppContext().getString(
Expand Down Expand Up @@ -139,7 +139,7 @@ object LocalData {
*/
fun totalNonActiveTracing(value: Long?) {
// TODO need this for nullable ref, shout not be goto for nullable storage
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putLong(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_total_non_active_tracing),
Expand Down Expand Up @@ -180,7 +180,7 @@ object LocalData {
*/
fun lastTimeDiagnosisKeysFromServerFetch(value: Date?) {
// TODO need this for nullable ref, shout not be goto for nullable storage
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putLong(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_m_timestamp_diagnosis_keys_fetch),
Expand All @@ -205,7 +205,7 @@ object LocalData {
* Sets the last timestamp the user manually triggered the key retrieval process
*/
fun lastTimeManualDiagnosisKeysRetrieved(value: Long) =
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putLong(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_m_timestamp_manual_diagnosis_keys_retrieval),
Expand Down Expand Up @@ -234,7 +234,7 @@ object LocalData {
*
* @param value UUID as string
*/
fun googleApiToken(value: String?) = getSharedPreferenceInstance().edit {
fun googleApiToken(value: String?) = getSharedPreferenceInstance().edit(true) {
putString(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_m_string_google_api_token),
Expand Down Expand Up @@ -262,7 +262,7 @@ object LocalData {
* Toggles the user decision if notification should be enabled for a risk change
*
*/
fun toggleNotificationsRiskEnabled() = getSharedPreferenceInstance().edit {
fun toggleNotificationsRiskEnabled() = getSharedPreferenceInstance().edit(true) {
putBoolean(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_notifications_risk_enabled),
Expand All @@ -277,7 +277,7 @@ object LocalData {
true
)

fun toggleNotificationsTestEnabled() = getSharedPreferenceInstance().edit {
fun toggleNotificationsTestEnabled() = getSharedPreferenceInstance().edit(true) {
putBoolean(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_notifications_test_enabled),
Expand All @@ -300,7 +300,7 @@ object LocalData {
* Toggles the decision if background jobs are enabled
*
*/
fun toggleBackgroundJobEnabled() = getSharedPreferenceInstance().edit {
fun toggleBackgroundJobEnabled() = getSharedPreferenceInstance().edit(true) {
putBoolean(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_background_job_allowed),
Expand All @@ -323,7 +323,7 @@ object LocalData {
* Toggles the boolean if the user has mobile data enabled
*
*/
fun toggleMobileDataEnabled() = getSharedPreferenceInstance().edit {
fun toggleMobileDataEnabled() = getSharedPreferenceInstance().edit(true) {
putBoolean(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_mobile_data_allowed),
Expand Down Expand Up @@ -353,7 +353,7 @@ object LocalData {
* @param value registration token as string
*/
fun registrationToken(value: String?) {
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putString(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_m_registration_token),
Expand All @@ -364,7 +364,7 @@ object LocalData {
}

fun inititalTestResultReceivedTimestamp(value: Long) =
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putLong(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_initial_result_received_time),
Expand All @@ -387,7 +387,7 @@ object LocalData {
}

fun numberOfSuccessfulSubmissions(value: Int) =
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putInt(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_number_successful_submissions),
Expand All @@ -411,7 +411,7 @@ object LocalData {
)

fun testGUID(value: String?) {
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putString(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_m_test_guid),
Expand All @@ -428,7 +428,7 @@ object LocalData {
)

fun authCode(value: String?) {
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putString(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_m_auth_code),
Expand All @@ -439,7 +439,7 @@ object LocalData {
}

fun isAllowedToSubmitDiagnosisKeys(isAllowedToSubmitDiagnosisKeys: Boolean) {
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putBoolean(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_m_is_allowed_to_submit_diagnosis_keys),
Expand All @@ -457,7 +457,7 @@ object LocalData {
)
}

fun teletan(value: String?) = getSharedPreferenceInstance().edit {
fun teletan(value: String?) = getSharedPreferenceInstance().edit(true) {
putString(
CoronaWarnApplication.getAppContext().getString(R.string.preference_teletan),
value
Expand All @@ -480,7 +480,7 @@ object LocalData {
)?.toCharArray()

fun databasePassword(password: CharArray) {
getSharedPreferenceInstance().edit {
getSharedPreferenceInstance().edit(true) {
putString(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_database_password),
Expand Down

0 comments on commit 1d52126

Please sign in to comment.