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

Perhaps a 'Reset to Default' button is needed in Settings #1848

Closed
nojunpark opened this issue Nov 30, 2017 · 7 comments
Closed

Perhaps a 'Reset to Default' button is needed in Settings #1848

nojunpark opened this issue Nov 30, 2017 · 7 comments

Comments

@nojunpark
Copy link

Now with many pref values in Settings, it would be handy to create a 'Reset to default' button in settings that resets the value. It'll definitely help UI automation too.

@pocmo
Copy link
Contributor

pocmo commented Nov 30, 2017

In UI automation you can just clear the settings yourself. ;)

    @Before 
    @After // Before/After - whatever you need.
    public void clearSettings() {
        PreferenceManager.getDefaultSharedPreferences(
                InstrumentationRegistry.getInstrumentation().getTargetContext())
                .edit()
                .clear()
                .apply();
    }

@grubdragon
Copy link
Contributor

Hey @pocmo is this still open?

@mcomella
Copy link
Contributor

@grubdragon Should be – we're still a new project so generally if an issue is open, it's something we want! Feel free to add it to the bottom of the bottom of the list. I have some UX concerns (what happens to custom URLs and search engines?) but we can deal with that when we get to it.

@grubdragon
Copy link
Contributor

Any guidance I could get here? The settings fragments/etc are pretty hard to understand.

@mcomella
Copy link
Contributor

@grubdragon You'll want to look in settings.xml to add the button and respond to the event in SettingsFragment. You can use something similar to the code Sebastian posted above to clear the SharedPreferences. Make sure any data stored outside of SharedPreferences is also cleared!

@ohodovaniuk
Copy link

Hey, since this issue has been inactive for a couple of month i would like to work on it. I will submit a pull request for your review and feedback tonight.

@pocmo
Copy link
Contributor

pocmo commented Apr 25, 2018

Do we really need that?

  • For testing there's an other solution (see above)
  • And users already have the ability to reset an app to the default state

Reasons for not doing it:

  • This is fragile. We are saving things in multiple places and whenever we add new things there's a high chance we forget about this reset button and it breaks (= Doesn't reset everything)

CC @bbinto

@pocmo pocmo removed the P4 label May 3, 2018
@bbinto bbinto closed this as completed Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants