slapperwan / gh4a

Github client for Android
Apache License 2.0
1.73k stars 221 forks source link

Opening a notification closes all other activities of the app #1192

Open Fs00 opened 2 years ago

Fs00 commented 2 years ago

As the issue title says, tapping on an OctoDroid notification opens the Notifications screen but also closes all the other open activities of the app. I find this behavior very annoying, especially when you're writing a comment or a new issue since everything you've written will be lost. The problem lies here: https://github.com/slapperwan/gh4a/blob/6e0a8ed0fa75f204c23e2175fd785f2a0291f9b7/app/src/main/java/com/gh4a/worker/NotificationHandlingService.java#L97-L99

Since the HomeActivity is always the root activity of the stack, FLAG_ACTIVITY_CLEAR_TOP will cause all other activities to be destroyed and removed from the back stack.

I see two possible solutions here:

maniac103 commented 2 years ago

Both seem rather ugly. I do not want to allow multiple instances for the home (launcher) activity, because that way navigation becomes confusing (which instance is opened when opening the launcher again?). Having notifications in a separate activity also doesn't fit the home activity navigation model at all. Unfortunately, I can't think of a good solution for that issue either. One basically would have to detach the activity stack of the old home activity (excluding home itself) into a new task, but I don't think that's possible.