From 527f3b263afb9f0c21bacfc9d244dbd18b9d4feb Mon Sep 17 00:00:00 2001 From: Leon Wu Date: Thu, 17 Aug 2017 18:55:17 +1000 Subject: [PATCH] When endpoint configuration was changed, the shared preference should clear all old data and store the modified data immediately. If the Editor isn't applied, it will return wrong or null endpoint. --- .../data/repository/VariantSharedPreferencesRepository.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/neanderthal/src/main/kotlin/au/com/outware/neanderthal/data/repository/VariantSharedPreferencesRepository.kt b/neanderthal/src/main/kotlin/au/com/outware/neanderthal/data/repository/VariantSharedPreferencesRepository.kt index 5405f30..c9a0699 100644 --- a/neanderthal/src/main/kotlin/au/com/outware/neanderthal/data/repository/VariantSharedPreferencesRepository.kt +++ b/neanderthal/src/main/kotlin/au/com/outware/neanderthal/data/repository/VariantSharedPreferencesRepository.kt @@ -74,6 +74,7 @@ class VariantSharedPreferencesRepository(val klass: Class, baseVariants.forEach { variant -> editor.putString(variant.key + VARIANT_DEFAULT, gson.toJson(variant.value)) } + editor.apply() } override fun addVariant(variant: Variant) {