home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.32k stars 642 forks source link

Inclusions in Recent app list for Shortcuts #3781

Open Nornode opened 1 year ago

Nornode commented 1 year ago

Is your feature request related to a problem? Please describe.

I'm frustrated with the fact that when working between two different HA servers started with shortcuts the servers never end up in the recently used apps list (app switching). I have to go back to "desktop" use the shortcut to come to the dashboard of server 1 click all way in to something to consider and then desktop, shortcut to server2 and click and adjust... There is never a possibility to go back from e.g. chrome to Ha companion app either...

Describe the solution you'd like

When initiated a session to a ha a server it should end up in the app switching ability on the Android OS so I can go back and switch between e.g. chrome and my HA server1

Describe alternatives you've considered, if any

HA companion App && Chrome shortcut 😔

Additional context

dshokouhi commented 1 year ago

we actually received numerous complaints about too many instances of the app open so we opted to not show in the recents sections as a result. It caused too much confusion because users expect to see 1 instance of the app but they were seeing multiple.

Given the amount of issues it caused in the past i dont think we should do this.

jpelgrom commented 1 year ago

Even if you could switch it wouldn't work as expected, because the 'most recently used' server is updated when you use a shortcut and (re)loaded when you open any HA activity. As a result, if you opend 1 -> 2, and switched back to 1, it would reload immediately to show 2.

What you are asking for is essentially multi-window support, a much larger task.

Nornode commented 1 year ago

I believe we are using different words for same thing now?

"Recent app list" for me is the OS gesture "pull up and hold from bottom of screen" - HA app never shown in that list if it's opened through a shortcut.

Doesn't matter if I switch between servers or not.

However opening HA companion app directly (not through shortcut) it does show.

dshokouhi commented 1 year ago

"Recent app list" for me is the OS gesture "pull up and hold from bottom of screen" - HA app never shown in that list if it's opened through a shortcut.

yes this is intentional to prevent numerous entries into the recents area

Some other issues reported by users who did not want the behavior you are requesting.

https://github.com/home-assistant/android/issues/2843 https://github.com/home-assistant/android/issues/2436

also PR discussion on why this was done

https://github.com/home-assistant/android/pull/2805

Nornode commented 1 year ago

Humm, Okay. I get that it's pretty clumsy to add in the recents list if you are using one single server and that it opens many different views.

However I got the tips from you @dshokouhi in #3550 to use shortcut s. Seems (to me) like there's an edge case (Multi server setup) where instances in recent list would be a good use case.

dshokouhi commented 1 year ago

Seems (to me) like there's an edge case (Multi server setup) where instances in recent list would be a good use case.

Even if we account for multiple servers the issue will still be there taht you will have too many instances of the same server instead of just one per server. On top of that the app will still default to whichever server was considered active at the time. This seems like a very big edge case to me as the app launcher will still remain in teh recents list.

I have to go back to "desktop" use the shortcut to come to the dashboard of server 1 click all way in to something to consider and then desktop, shortcut to server2 and click and adjust...

Given what you said here, did you know about swipe gestures to switch between servers when the app is active? You dont have to leave the app to switch servers.

https://companion.home-assistant.io/docs/integrations/android-webview#swipe-gestures

Nornode commented 1 year ago

Thing is that I have all but abandoned the standard app icon as I can't trust that it will bring me to the desired server.

So, ummh, yes but not exactly.

If I could, I would have the app installed twice (two APKs) as that's the kind of behaviour I'm looking for.

No, I didn't consider the built-in swipe features, but it's not up to the task. 1, not one-handed as in #3550. 2, can't switch between the instances via application switching.

dshokouhi commented 1 year ago

If I could, I would have the app installed twice (two APKs) as that's the kind of behaviour I'm looking for.

You can, install the minimal version of the app and you'll have 2.

afflux commented 10 months ago

I have a single server setup and I find it very confusing that using the shortcuts results in the app not showing in the app switcher.

It seems to me that the real problem is the fact that shortcuts spawn new tasks. Android docs say this regarding FLAG_ACTIVITY_MULTIPLE_TASKS:

When used with FLAG_ACTIVITY_NEW_TASK do not use this flag unless you are implementing your own top-level application launcher.

dshokouhi commented 10 months ago

It seems to me that the real problem is the fact that shortcuts spawn new tasks.

No that's not the issue as to why we need to use that flag. We need to create a new task otherwise you wouldn't be able to switch dashboards reliably with shortcut they simply would not take you to where you want to go. Please read all the linked discussions in previous comment in this issue.

afflux commented 10 months ago

Thanks, I did indeed read the linked discussions. And I did see that other ways have been suggested (first half of that comment), but have been rejected because they would be a larger change.

I'm just pointing out that this issue is a bug, not an enhancement.

dshokouhi commented 10 months ago

I'm just pointing out that this issue is a bug, not an enhancement.

Because we deliberately made changes for things to work properly it's a feature request.