nextcloud / notes-android

✎ Android client for Nextcloud Notes app.
https://play.google.com/store/apps/details?id=it.niedermann.owncloud.notes
GNU General Public License v3.0
944 stars 135 forks source link

Ask confirmation to apply changes #812

Open marcellonobili opened 4 years ago

marcellonobili commented 4 years ago

Is your feature request related to a problem? Please describe. Sometimes I accidentally delete some text inside a note while editing it. If it wasn't intentional, the content is lost forever.

Describe the solution you'd like It would be nice if after editing a note, a dialog could ask to apply or discard the changes. Ideally the option to ask for confirmation could be added in the settings, if some people is annoyed by a dialog for every edit.

Describe alternatives you've considered If the dialog is not accettable, another option would be to have a "back" button to undo in a ctrl+z style, but that would be harder to implement, I think.

stefan-niedermann commented 4 years ago

Did you swipe to delete the file in the list or using the context menu?

marcellonobili commented 4 years ago

Did you swipe to delete the file in the list or using the context menu?

I'm talking about deleting some text inside the note, not the note itself. I edited the question to make that more clear :)

marcellonobili commented 4 years ago

I am an Android developer, so I could in case look at the code and create a pull request.

stefan-niedermann commented 4 years ago

That would indeed be nice.

We should first define the wanted behavior:

What do you think about that?

The code base is quiet legacy, i planned to move to ViewModel with LiveData in the future, i guess this would make it all easier. Don't know if this scares you off πŸ˜„

marcellonobili commented 4 years ago

Don't worry about the legacy code😁

The problem with the undo thing is that if I press the back button after editing accidentally or without noticing, the edit will be saved anyway.

I agree with you that adding dialogs should be avoided when possible.

One simple solution could be to show a snackbar when exiting the note, with a message like "The changes have been saved" and the UNDO button on the side (much like when deleting the notes).

What do you think about that?

The undo thing would be really useful, but it seems to me a bit more challenging. Sadly I haven't a lot of time but I could do it in the future πŸ™‚

Anyway I will start to clone the repo and to look at it :)

stefan-niedermann commented 4 years ago

Hm, i see the problem, yes.

To be honest, a Snackbar everytime a user changes the note doesn't seem to be constructive neither.

The best approach would maybe be to support multiple files versions (the server does provide an app for it AFAIK), but this might need changes in the Notes-API, so that's a bigger wheel to turn.

marcellonobili commented 4 years ago

Unfortunately it seems that there isn't a quick solution to this problem then. πŸ€”

Cui-Yusong commented 3 years ago

@stefan-niedermann I have an idea. Is it possible to add an UNDO button at the edit page instead of adding dialogs? If the user exits directly after editing, the edited content will be saved. But if the user produces some errors while editing, they can click this button go back. Is it a good idea?

stefan-niedermann commented 3 years ago

Well, as i said:

To be honest, a Snackbar everytime a user changes the note doesn't seem to be constructive neither.

and this

Sometimes I accidentally delete some text inside a note

is not the default case. It is the exception. And putting an element like a snackbar or a dialog into the UI every time one updates a note for the sake of handling the exception is nothing i want to do.

In fact it is the mistake of the user in the first place - Our job / this issue is about a safety net to catch the mistake and provide the user a way to restore data which he deleted.

The correct approach seems to be some kind of versioning / history, not prompting each user after each change with "Sure?" "Really sure?" "Do you REALLY want to have this change?" - that's the wrong approach in my opinion.

Cui-Yusong commented 3 years ago

Personally, I feel that adding a function to confirm changes before the versioning is implemented might solve some people's problems. Because in many cases, it's possible to make a small change to your note and then want to abandon it, just like a notebook on the computer, where changes can be reverted back to where they were before you saved them. Personally, I think this is probably more popular than versioning (after consulting with my classmates πŸ˜ƒ)

waltercool commented 2 years ago

Please up on this.

Each time by mistake I do cut or paste by mistake instead of copying text, everything is lost, and no way to recover it unless you take out internet from your device and reinstall the app.

This is not acceptable by any means.

waltercool commented 2 years ago

Personally, I feel that adding a function to confirm changes before the versioning is implemented might solve some people's problems. Because in many cases, it's possible to make a small change to your note and then want to abandon it, just like a notebook on the computer, where changes can be reverted back to where they were before you saved them. Personally, I think this is probably more popular than versioning (after consulting with my classmates smiley)

This problem can be resolved even easier.

bohni commented 1 year ago

+1 to @waltercool 's solution

It's the way, Google does it in the Android Contacts app.