mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
FeatureSwitchのOverrideができるように
This commit is contained in:
parent
d40f61928c
commit
2dc3407217
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext;
|
import dagger.hilt.android.qualifiers.ApplicationContext;
|
||||||
|
import one.nem.lacerta.model.pref.FeatureSwitchOverride;
|
||||||
import one.nem.lacerta.utils.repository.SharedPrefUtils;
|
import one.nem.lacerta.utils.repository.SharedPrefUtils;
|
||||||
|
|
||||||
public class SharedPrefUtilsImpl implements SharedPrefUtils{
|
public class SharedPrefUtilsImpl implements SharedPrefUtils{
|
||||||
|
@ -36,4 +37,14 @@ public class SharedPrefUtilsImpl implements SharedPrefUtils{
|
||||||
public SharedPreferences getSharedPreferences() {
|
public SharedPreferences getSharedPreferences() {
|
||||||
return applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE); // TODO-rca: 決め打ちやめる?
|
return applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE); // TODO-rca: 決め打ちやめる?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFeatureSwitchOverride(FeatureSwitchOverride featureSwitchOverride) {
|
||||||
|
return getSharedPreferences().getBoolean(featureSwitchOverride.getKey(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFeatureSwitchOverride(FeatureSwitchOverride featureSwitchOverride, boolean value) {
|
||||||
|
getEditor().putBoolean(featureSwitchOverride.getKey(), value).apply();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package one.nem.lacerta.utils.repository;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import one.nem.lacerta.model.pref.FeatureSwitchOverride;
|
||||||
|
|
||||||
public interface SharedPrefUtils {
|
public interface SharedPrefUtils {
|
||||||
|
|
||||||
// Shared preferences editorの取得
|
// Shared preferences editorの取得
|
||||||
|
@ -14,4 +16,7 @@ public interface SharedPrefUtils {
|
||||||
|
|
||||||
SharedPreferences getSharedPreferences();
|
SharedPreferences getSharedPreferences();
|
||||||
|
|
||||||
|
boolean getFeatureSwitchOverride(FeatureSwitchOverride featureSwitchOverride);
|
||||||
|
|
||||||
|
void setFeatureSwitchOverride(FeatureSwitchOverride featureSwitchOverride, boolean value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user