mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
insert call missed message in NSE
This commit is contained in:
parent
e7094c3f44
commit
cab8b5e6d9
|
@ -93,6 +93,10 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
|
||||||
case let callMessage as CallMessage:
|
case let callMessage as CallMessage:
|
||||||
MessageReceiver.handleCallMessage(callMessage, using: transaction)
|
MessageReceiver.handleCallMessage(callMessage, using: transaction)
|
||||||
if !SSKPreferences.areCallsEnabled {
|
if !SSKPreferences.areCallsEnabled {
|
||||||
|
if let sender = callMessage.sender, let thread = TSContactThread.fetch(for: sender, using: transaction), thread.hasOutgoingInteraction(with: transaction) {
|
||||||
|
let infoMessage = TSInfoMessage.from(callMessage, associatedWith: thread)
|
||||||
|
infoMessage.updateCallInfoMessage(.missed, using: transaction)
|
||||||
|
}
|
||||||
return self.completeSilenty()
|
return self.completeSilenty()
|
||||||
}
|
}
|
||||||
notificationContent.userInfo = userInfo
|
notificationContent.userInfo = userInfo
|
||||||
|
@ -134,6 +138,7 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: Set up environment
|
||||||
private func setUpIfNecessary(completion: @escaping () -> Void) {
|
private func setUpIfNecessary(completion: @escaping () -> Void) {
|
||||||
AssertIsOnMainThread()
|
AssertIsOnMainThread()
|
||||||
|
|
||||||
|
@ -171,18 +176,6 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(storageIsReady), name: .StorageIsReady, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(storageIsReady), name: .StorageIsReady, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
override public func serviceExtensionTimeWillExpire() {
|
|
||||||
// Called just before the extension will be terminated by the system.
|
|
||||||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
|
||||||
let userInfo: [String:Any] = [ NotificationServiceExtension.isFromRemoteKey : true ]
|
|
||||||
let notificationContent = self.notificationContent!
|
|
||||||
notificationContent.userInfo = userInfo
|
|
||||||
notificationContent.badge = 1
|
|
||||||
notificationContent.title = "Session"
|
|
||||||
notificationContent.body = "You've got a new message"
|
|
||||||
handleSuccess(for: notificationContent)
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
private func versionMigrationsDidComplete() {
|
private func versionMigrationsDidComplete() {
|
||||||
AssertIsOnMainThread()
|
AssertIsOnMainThread()
|
||||||
|
@ -215,6 +208,19 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
|
||||||
AppReadiness.setAppIsReady()
|
AppReadiness.setAppIsReady()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: Completion
|
||||||
|
override public func serviceExtensionTimeWillExpire() {
|
||||||
|
// Called just before the extension will be terminated by the system.
|
||||||
|
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
||||||
|
let userInfo: [String:Any] = [ NotificationServiceExtension.isFromRemoteKey : true ]
|
||||||
|
let notificationContent = self.notificationContent!
|
||||||
|
notificationContent.userInfo = userInfo
|
||||||
|
notificationContent.badge = 1
|
||||||
|
notificationContent.title = "Session"
|
||||||
|
notificationContent.body = "You've got a new message"
|
||||||
|
handleSuccess(for: notificationContent)
|
||||||
|
}
|
||||||
|
|
||||||
private func completeSilenty() {
|
private func completeSilenty() {
|
||||||
contentHandler!(.init())
|
contentHandler!(.init())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue