diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-25 14:03:33 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-06-25 14:03:33 +0300 |
commit | e67d7e5872e1d93df55eea0119e5ca0bf0b14c49 (patch) | |
tree | 5b7087f63e8415acf97e1ca18b9d8f1b509e8d9a /lib/Notification/Notifier.php | |
parent | 5bdfb518144ca2b4664e2c762402e3d683a18bea (diff) |
Improve push notifications for upcoming iOS/Apple changes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Notification/Notifier.php')
-rw-r--r-- | lib/Notification/Notifier.php | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index a62b3b128..1ba377184 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -315,15 +315,38 @@ class Notifier implements INotifier { } } - $notification->setParsedMessage(str_replace($placeholders, $replacements, $message->getMessage())); - $notification->setRichMessage($message->getMessage(), $message->getMessageParameters()); + $parsedMessage = str_replace($placeholders, $replacements, $message->getMessage()); + if (!$this->notificationManager->isPreparingPushNotification()) { + $notification->setParsedMessage($parsedMessage); + $notification->setRichMessage($message->getMessage(), $message->getMessageParameters()); + } $richSubjectParameters = [ 'user' => $richSubjectUser, 'call' => $richSubjectCall, ]; - if ($notification->getSubject() === 'chat') { + if ($this->notificationManager->isPreparingPushNotification()) { + $richSubjectParameters['message'] = [ + 'type' => 'highlight', + 'id' => $message->getComment()->getId(), + 'name' => $parsedMessage, + ]; + if ($room->getType() === Room::ONE_TO_ONE_CALL) { + $subject = $l->t('{user}: {message}'); + } elseif ($richSubjectUser) { + $subject = $l->t('{user} in {call}: {message}'); + } elseif (!$isGuest) { + $subject = $l->t('Deleted user in {call}: {message}'); + } else { + try { + $richSubjectParameters['guest'] = $this->getGuestParameter($comment->getActorId()); + $subject = $l->t('{guest} (guest) in {call}: {message}'); + } catch (ParticipantNotFoundException $e) { + $subject = $l->t('Guest in {call}: {message}'); + } + } + } elseif ($notification->getSubject() === 'chat') { if ($room->getType() === Room::ONE_TO_ONE_CALL) { $subject = $l->t('{user} sent you a private message'); } elseif ($richSubjectUser) { |