element-hq / element-ios

A glossy Matrix collaboration client for iOS
https://element.io
Apache License 2.0
1.73k stars 486 forks source link

Push notification issues and documentation #5735

Open dkrasner opened 2 years ago

dkrasner commented 2 years ago

Steps to reproduce

  1. Where are you starting? What can you see?

    • I am running a matrix-synapse homeserver and have a custom build of the element-ios app.
    • I am not running my own push notification server, such as sygnal, but have kept the default static let serverConfigSygnalAPIUrlString = "https://matrix.org/_matrix/push/v1/notify" setting in the build pointing to the matrix run notification server.
    • I cannot get push notifications to show up in the app. I have tested this in the simulator, local xcode build/installs, and via testflight.
  2. Current debugging steps

  1. More steps… I have reached out in the element-ios:matrix.org room and have gone through all the available documentation for element-ios, sygnal and synapse.

I can't tell if this is a bug in element-ios or there if the documentation is lacking on the subject. Thank you!

Outcome

What did you expect?

Expect to see notifications.

What happened instead?

No notifications.

Your phone model

IphoneX

Operating system version

15.3.1

Application version

1.6.6

Homeserver

Synapse 1.52.0

Will you send logs?

Yes

pixlwave commented 2 years ago

Hi @dkrasner thanks for opening this issue. You are correct, I have had a look and the documentation around this area could do with some improvements. Unfortunately if you are creating a fork of Element you will need to host your own push notification server, and configure this with your own certificates (sygnal docs). Also worth noting that the simulator only supports simulating push notifications by use of a .apns JSON file, so any testing you do would need to be on a real device (but a debug build connected to Xcode is fine).

Sorry I can't provide much more help in this regard.

dkrasner commented 2 years ago

@pixlwave thanks for the confirmation.

Is the need to self-host a notification a question of Apple's security requirements, or a choice by element?

Also is there anything else other than pointing to your proper notification/sygnal server, adding the certificates as in the doc I should be aware of?

Finally, would it be helpful if I added a section about this in the element-ios documentation?

pixlwave commented 2 years ago

Is the need to self-host a notification a question of Apple's security requirements, or a choice by element?

I haven't specifically asked anyone about this, but I would imagine this was a decision made by Matrix / Element not wanting to host, update and be responsible for the certificates from every matrix client that supports push.

Also is there anything else other than pointing to your proper notification/sygnal server, adding the certificates as in the doc I should be aware of?

This should be all that you need to do yes, although I've been told it is not super simple. There is an old guide on how to set up your certificates, but it's worth pointing out that we no longer use the Info.plist for this and instead use .xcconfig files: https://www.keyvanfatehi.com/2017/03/27/how-to-configure-matrix-sygnal-push-gateway-server-with-apple/

Finally, would it be helpful if I added a section about this in the element-ios documentation?

This would be wonderful if you are willing to do so 🙌

dkrasner commented 2 years ago

@pixlwave Finally got around to writing this up. PR. I decided to make a general configuration md and notifications as a subsection. Let me know if you prefer something else or if there is anything else.

stavoltafunzia commented 1 year ago

Does the methodology discussed here apply also to the situation where someone is running his own matrix-synapse homeserver, but using standard (non custom build) of the Element iOS and Android apps?

pixlwave commented 1 year ago

@stavoltafunzia If you're using Element iOS from the App Store or TestFlight, then no this is not necessary to do for a custom homeserver.

x-mentat commented 1 year ago

@stavoltafunzia If you're using Element iOS from the App Store or TestFlight, then no this is not necessary to do for a custom homeserver.

so I build own matrix server, but use standard client - push will work ?

pixlwave commented 1 year ago

@x-mentat Yes, correct 👍