notes-android icon indicating copy to clipboard operation
notes-android copied to clipboard

Ask confirmation to apply changes

Open TheSielo opened this issue 5 years ago β€’ 13 comments

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.

TheSielo avatar May 01 '20 13:05 TheSielo

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

stefan-niedermann avatar May 01 '20 13:05 stefan-niedermann

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 :)

TheSielo avatar May 01 '20 13:05 TheSielo

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

TheSielo avatar May 01 '20 14:05 TheSielo

That would indeed be nice.

We should first define the wanted behavior:

  • I don't want a dialog but prefer some kind of "undo"
  • and i don't want to introduce another UI element but rather go with
  • the back-button to "undo" and then
  • if the user went back one step in the history, display the "redo" button as a mini FAB (like the search prev/next) only on demand.

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 πŸ˜„

stefan-niedermann avatar May 01 '20 15:05 stefan-niedermann

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 :)

TheSielo avatar May 01 '20 16:05 TheSielo

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.

stefan-niedermann avatar May 01 '20 18:05 stefan-niedermann

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

TheSielo avatar May 20 '20 07:05 TheSielo

@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?

Cui-Yusong avatar Apr 23 '21 11:04 Cui-Yusong

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.

stefan-niedermann avatar Apr 23 '21 12:04 stefan-niedermann

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 πŸ˜ƒ)

Cui-Yusong avatar Apr 27 '21 15:04 Cui-Yusong

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 avatar Oct 02 '22 00:10 waltercool

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.

  • Just put a save button at top.
  • When some change is made, save button is enabled.
  • If save button is enabled and user goes back, then send a dialog to save changes or not.
  • When save button is pressed, will send changes to Nextcloud API.

waltercool avatar Oct 02 '22 00:10 waltercool

+1 to @waltercool 's solution

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

bohni avatar Jul 31 '23 08:07 bohni