Skip to content
Snippets Groups Projects
Unverified Commit f8de1560 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Small LocalData cleanup (DEV, EXPOSUREAPP-2126) #2183


* Remove unused getters.

* Don't use XML for preference keys.
(Affects all items in LocalData, but this one may fit a bug description, the others are scheduled for refactoring in another PR)

Co-authored-by: default avatarMohamed Metwalli <Mohamed.Metwalli@sap.com>
parent 917bdc3a
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ object LocalData { ...@@ -22,6 +22,7 @@ object LocalData {
private const val PREFERENCE_HAS_RISK_STATUS_LOWERED = private const val PREFERENCE_HAS_RISK_STATUS_LOWERED =
"preference_has_risk_status_lowered" "preference_has_risk_status_lowered"
/**************************************************** /****************************************************
* ONBOARDING DATA * ONBOARDING DATA
****************************************************/ ****************************************************/
...@@ -342,40 +343,19 @@ object LocalData { ...@@ -342,40 +343,19 @@ object LocalData {
putInt(PKEY_POSITIVE_TEST_RESULT_REMINDER_COUNT, value) putInt(PKEY_POSITIVE_TEST_RESULT_REMINDER_COUNT, value)
} }
/**
* Gets the decision if background jobs are enabled
*
* @return
*/
fun isBackgroundJobEnabled(): Boolean = getSharedPreferenceInstance().getBoolean(
CoronaWarnApplication.getAppContext().getString(R.string.preference_background_job_allowed),
false
)
/**
* Gets the boolean if the user has mobile data enabled
*
* @return
*/
fun isMobileDataEnabled(): Boolean = getSharedPreferenceInstance().getBoolean(
CoronaWarnApplication.getAppContext().getString(R.string.preference_mobile_data_allowed),
false
)
/**************************************************** /****************************************************
* SUBMISSION DATA * SUBMISSION DATA
****************************************************/ ****************************************************/
private const val PREFERENCE_REGISTRATION_TOKEN = "preference_registration_token"
/** /**
* Gets the registration token that is needed for the submission process * Gets the registration token that is needed for the submission process
* *
* @return the registration token * @return the registration token
*/ */
fun registrationToken(): String? = getSharedPreferenceInstance().getString( fun registrationToken(): String? = getSharedPreferenceInstance()
CoronaWarnApplication.getAppContext() .getString(PREFERENCE_REGISTRATION_TOKEN, null)
.getString(R.string.preference_registration_token),
null
)
/** /**
* Sets the registration token that is needed for the submission process * Sets the registration token that is needed for the submission process
...@@ -384,11 +364,7 @@ object LocalData { ...@@ -384,11 +364,7 @@ object LocalData {
*/ */
fun registrationToken(value: String?) { fun registrationToken(value: String?) {
getSharedPreferenceInstance().edit(true) { getSharedPreferenceInstance().edit(true) {
putString( putString(PREFERENCE_REGISTRATION_TOKEN, value)
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_registration_token),
value
)
} }
} }
......
...@@ -23,12 +23,6 @@ ...@@ -23,12 +23,6 @@
<!-- NOTR --> <!-- NOTR -->
<string name="preference_timestamp_manual_diagnosis_keys_retrieval"><xliff:g id="preference">"preference_timestamp_manual_diagnosis_keys_retrieval"</xliff:g></string> <string name="preference_timestamp_manual_diagnosis_keys_retrieval"><xliff:g id="preference">"preference_timestamp_manual_diagnosis_keys_retrieval"</xliff:g></string>
<!-- NOTR --> <!-- NOTR -->
<string name="preference_background_job_allowed"><xliff:g id="preference">"preference_background_job_enabled"</xliff:g></string>
<!-- NOTR -->
<string name="preference_mobile_data_allowed"><xliff:g id="preference">"preference_mobile_data_enabled"</xliff:g></string>
<!-- NOTR -->
<string name="preference_registration_token"><xliff:g id="preference">"preference_registration_token"</xliff:g></string>
<!-- NOTR -->
<string name="preference_device_pairing_successful_time"><xliff:g id="preference">"preference_device_pairing_successful_time"</xliff:g></string> <string name="preference_device_pairing_successful_time"><xliff:g id="preference">"preference_device_pairing_successful_time"</xliff:g></string>
<!-- NOTR --> <!-- NOTR -->
<string name="preference_initial_tracing_activation_time"><xliff:g id="preference">"preference_initial_tracing_activation_time"</xliff:g></string> <string name="preference_initial_tracing_activation_time"><xliff:g id="preference">"preference_initial_tracing_activation_time"</xliff:g></string>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment