App: add action button to persistent notification
-Only show notification if connected -Tapping persistent notification takes you to the app -Tapping action button disconnects without taking you to the app -Disconnecting dismisses the notification
Updates tailscale/tailscale#10104
I found a few issues in testing.
-
When I tap on the notification, it takes me back to whatever view I had open in the Tailscale app. I think it would be best to open the home screen.
-
When I tap on the notification, it dismisses the notification, even if I didn't disconnect. I think the notification should remain as long as Tailscale is on.
-
When I tap "disconnect", it does disconnect Tailscale, but the notification is not dismissed.
-
If I disconnect Tailscale from the Tailscale UI, the notification remains. It should disappear.
IIRC, what I did the last time I had something like this, I ended up using a bound foreground service along with the VPN. Something like this. The foreground service gets a persistent notification that sticks around as long as the service is running. Binding it to the VPNService makes the service go away when the VPN is stopped. And the nice thing about having a foreground service running is that it should make it less likely for the our app (and hence the VPN) to be killed.