home-assistant / iOS

:iphone: Home Assistant for Apple platforms
https://companion.home-assistant.io
Other
1.6k stars 309 forks source link

Local notification with url on iPad not working (closing app) #2117

Open roflchopper opened 2 years ago

roflchopper commented 2 years ago

iOS device model, version and app version

Model Name: iPad Air (3rd Generation) and iPad mini 4 Software Version: iOS 15.3.1 App version: 2022.3 (2022.358)

Home Assistant Core Version Home Assistant 2022.4.6

Describe the bug When using an automation to send a notification via local push notifications, and passing the url, the home assistant app will minimise.

The notification appears on the screen, but when clicked, HA app flashes up then minimises back to the dock (and the main ipad home screen re-appears). The app doesn't crash. If you re-open the HA app - it's back where it left off (so it hasn't navigated to the new view)

This works fine on iPhone XS running 15.4.1

To Reproduce Create an automation similar to below :

service: notify.mobile_app_ipad
data:
  message: Doorbell pressed
  data:
    url: /lovelace-testing/sip-testing

Expected behavior When notification pressed, HA app will navigate to the lovelace view specified in

Screenshots N/A can't capture

Additional context Found below in logs which might be helpful - PromiseKit:cauterized-error: missingURL

2022-04-24 14:30:59.979 [Verbose] [main] [NotificationManager.swift:236] userNotificationCenter(_:didReceive:withCompletionHandler:) > User info in incoming notification [AnyHashable("url"): /lovelace-testing/sip-testing, AnyHashable("aps"): {
    alert =     {
        body = "Doorbell pressed";
    };
    sound = default;
}, AnyHashable("webhook_id"): <redacted>] with response <UNNotificationResponse: <redacted>; actionIdentifier: com.apple.UNNotificationDefaultActionIdentifier, notification: <UNNotification: <redacted>; source: io.robbie.HomeAssistant date: 2022-04-24 04:30:58 +0000, request: <UNNotificationRequest: <redacted>; identifier: <redacted>, content: <UNNotificationContent: 0x283186200; title: (null), subtitle: (null), body: <redacted>, summaryArgument: , summaryArgumentCount: 0, categoryIdentifier: , launchImageName: , threadIdentifier: , attachments: (
), badge: (null), sound: <UNNotificationSound: <redacted>>, realert: 0, interruptionLevel: 1, relevanceScore: 0.00, trigger: (null)>, intents: (
)>>
2022-04-24 14:30:59.980 [Info] [main] [NotificationManager.swift:250] userNotificationCenter(_:didReceive:withCompletionHandler:) > launching URL /lovelace-testing/sip-testing
2022-04-24 14:31:00.054 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Received: event: for HARequestIdentifier(rawValue: 14)
2022-04-24 14:31:00.054 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Received: event: for HARequestIdentifier(rawValue: 14)
2022-04-24 14:31:00.056 [Info] [main] [Environment.swift:54] init() > PromiseKit:cauterized-error: missingURL
2022-04-24 14:31:00.058 [Info] [main] [Environment.swift:54] init() > PromiseKit:cauterized-error: missingURL
2022-04-24 14:31:00.066 [Info] [hakit-work-queue] [Environment.swift:71] init() > WebSocket: Received: event: for HARequestIdentifier(rawValue: 14)
2022-04-24 14:31:00.068 [Info] [main] [Environment.swift:54] init() > PromiseKit:cauterized-error: missingURL
mundschenk-at commented 2 years ago

Mhm, I am not sure it is related to local push, I've got similar behavior when receiving the notification on a remote network (in my case, the notification has both url and clickAction set as per the documentation example, and after reopening the HA app, the correct dashboard is selected, but as described here, the app minimizes when the notification is clicked on).

This happens on both iPad and iPhone devices.

sazun commented 2 years ago

Hi, I have same exact problem. Did any of you managed to solve it?

janusn commented 1 year ago

I experience this problem as well. I used it with remote network. The same url on the notification work on an iPhone but not on an iPad.

birlaakhand commented 10 months ago

I was facing the same Issue - was able to get around it by NOT using URL and only using clickaction.

janusn commented 10 months ago

@birlaakhand Unforutnately, the clickaction does not work on my iPad Mini 6 either. 😕

lclem commented 6 months ago

same issue here on an iPad