Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to clear preferences #92

Merged
merged 2 commits into from
Jun 10, 2017
Merged

Conversation

nekdenis
Copy link
Contributor

If you do not want keep reference to SharedPreferences this method may be helpful

If you do not want keep reference to SharedPreferences this method may be helpful
Copy link
Contributor

@NightlyNexus NightlyNexus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me.
Needs a test.

@@ -170,4 +170,8 @@ public void onSharedPreferenceChanged(SharedPreferences preferences, String key)
checkNotNull(defaultValue, "defaultValue == null");
return new RealPreference<>(preferences, key, defaultValue, StringSetAdapter.INSTANCE, keyChanges);
}

public void clear() {
preferences.edit().clear().apply()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a semicolon. also, two space indent.

@MyDogTom
Copy link

Looks like more and more people wants be able to delete all data from preferences without keeping reference to SharedPreferences.
Would it be possible to resurrect / accept #38 ? :)

@f2prateek
Copy link
Owner

@MyDogTom #38 was rejected because it instruments it's own custom behaviour which IMO is surprising. Having a passthrough to the standard equivalent SharedPreferences method is fine though.

@f2prateek f2prateek merged commit c1c3a58 into f2prateek:master Jun 10, 2017
@f2prateek
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants