ios: only show "entity" notifications if the are enabled in the conversation (#2899)
This commit is contained in:
parent
1bc880877d
commit
42324b515d
@ -127,7 +127,7 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
logger.debug("NotificationService: receiveNtfMessages: apiGetNtfMessage \(String(describing: ntfMsgInfo), privacy: .public)")
|
||||
if let connEntity = ntfMsgInfo.connEntity {
|
||||
setBestAttemptNtf(
|
||||
ntfMsgInfo.user.showNotifications
|
||||
ntfMsgInfo.ntfsEnabled
|
||||
? .nse(notification: createConnectionEventNtf(ntfMsgInfo.user, connEntity))
|
||||
: .empty
|
||||
)
|
||||
@ -401,4 +401,8 @@ struct NtfMessages {
|
||||
var connEntity: ConnectionEntity?
|
||||
var msgTs: Date?
|
||||
var ntfMessages: [NtfMsgInfo]
|
||||
|
||||
var ntfsEnabled: Bool {
|
||||
user.showNotifications && (connEntity?.ntfsEnabled ?? false)
|
||||
}
|
||||
}
|
||||
|
@ -1466,6 +1466,8 @@ public struct SecurityCode: Decodable, Equatable {
|
||||
|
||||
public struct UserContact: Decodable {
|
||||
public var userContactLinkId: Int64
|
||||
// public var connReqContact: String
|
||||
public var groupId: Int64?
|
||||
|
||||
public init(userContactLinkId: Int64) {
|
||||
self.userContactLinkId = userContactLinkId
|
||||
@ -1927,6 +1929,16 @@ public enum ConnectionEntity: Decodable {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
public var ntfsEnabled: Bool {
|
||||
switch self {
|
||||
case let .rcvDirectMsgConnection(contact): return contact?.chatSettings.enableNtfs ?? false
|
||||
case let .rcvGroupMsgConnection(groupInfo, _): return groupInfo.chatSettings.enableNtfs
|
||||
case .sndFileConnection: return false
|
||||
case .rcvFileConnection: return false
|
||||
case let .userContactConnection(userContact): return userContact.groupId == nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct NtfMsgInfo: Decodable {
|
||||
|
Loading…
Reference in New Issue
Block a user