TelegramMessenger / Telegram-iOS

Telegram-iOS
6.36k stars 1.67k forks source link

Communication Notifications on watch #665

Open Kamik423 opened 2 years ago

Kamik423 commented 2 years ago

556 describes the implementation of communication notifications on iOS. This allows for allowing certain contacts to pass through focus modes (the new evolution of the do not disturb feature) on iOS. For me and probably many people the Apple Watch is one of the main way we interact with notifications. And on the Apple Watch notifications do not obey this system. If I am in a focus mode I will not get any Telegram notifications on the watch anymore although they are shown on the iPhone the watch is connected to.

jwkicklighter commented 2 years ago

I got to this issue because I found that I couldn't get the Focus Mode "allowed contacts" to work properly for Telegram messages. After reading through what @Kamik423 said, I realized you actually can get that desired behavior if the Telegram contact is correctly associated with the phone contact.

That said, I now have the exact problem mentioned here. My iPhone properly displays notifications from allowed contacts while a particular Focus is active, but that same notification does not alert my Apple Watch. The notification is indeed forwarded to the watch, but it remains muted just like any other app that is not allowed to notify during that particular Focus Mode.

thebluepotato commented 2 years ago

I've been having issues getting iOS to "recognise" Telegram contacts as their Contacts.app counterparts, even before Focus modes. Phone calls made through Telegram would appear in the call list with a Siri suggestion to add them to the appropriate contact with a social profile called Telegram(id: xxxxxxx) or something. Adding that "profile" to the contact would associate that phone call to the contact, but opening and closing the list would reset that link.

Sending a message from the shortcut on the Contact page in Contacts.app also doesn't deep link to the conversation.

[...] I realized you actually can get that desired behavior if the Telegram contact is correctly associated with the phone contact.

So how did you manage to correctly associate them? From browsing the code it feels that Telegram only uses CNContacts to populate it's contact lists, but does not really "link" them...

jwkicklighter commented 2 years ago

This is from memory since I don't currently have one available to try, but the process was essentially this:

  1. Receive Telegram message notification from the person
  2. Half-swipe the notification so that the "Options" button is revealed
  3. Choose "Add to contacts" option
  4. Choose to update an existing contact
  5. Choose the appropriate contact from the list
  6. Scroll down to the "social profile" section and ensure that the new entry to that list says "Telegram" on the left, and not something generic

So far, that seems to work for showing notifications from that contact to be visible during a Focus mode that 1) mutes Telegram, and 2) allows notifications from that contact. The problem I'm having is that those notifications do not go to the Watch unless the Focus is disabled.

xenjke commented 2 years ago

Can confirm that "Add to contacts" action on the iPhone notification establishes that link and lets the message from that contact through the focus mode. Apple Watch still doesn't get the notification on iOS16 (watchOS 9)