mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 14:48:41 +00:00
bug fix
This commit is contained in:
parent
0195daf709
commit
2e81c17eb7
1 changed files with 18 additions and 13 deletions
|
|
@ -64,7 +64,6 @@ func getPushNotificationData(pushData: String) -> (
|
||||||
do {
|
do {
|
||||||
let pushData = try EncryptedPushNotification(serializedBytes: data)
|
let pushData = try EncryptedPushNotification(serializedBytes: data)
|
||||||
|
|
||||||
|
|
||||||
var pushNotification: PushNotification?
|
var pushNotification: PushNotification?
|
||||||
var pushUser: PushUser?
|
var pushUser: PushUser?
|
||||||
|
|
||||||
|
|
@ -78,12 +77,13 @@ func getPushNotificationData(pushData: String) -> (
|
||||||
for tryPushUser in pushUsers! {
|
for tryPushUser in pushUsers! {
|
||||||
for pushKey in tryPushUser.pushKeys {
|
for pushKey in tryPushUser.pushKeys {
|
||||||
if pushKey.id == pushData.keyID {
|
if pushKey.id == pushData.keyID {
|
||||||
pushNotification = tryDecryptMessage(key: pushKey.key, pushData: pushData)
|
pushNotification = tryDecryptMessage(
|
||||||
|
key: pushKey.key, pushData: pushData)
|
||||||
if pushNotification != nil {
|
if pushNotification != nil {
|
||||||
if (pushNotification!.messageID <= pushUser!.lastMessageID) {
|
pushUser = tryPushUser
|
||||||
|
if pushNotification!.messageID <= pushUser!.lastMessageID {
|
||||||
return ("blocked", "blocked", 0)
|
return ("blocked", "blocked", 0)
|
||||||
}
|
}
|
||||||
pushUser = tryPushUser
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -105,9 +105,14 @@ func getPushNotificationData(pushData: String) -> (
|
||||||
if pushNotification.kind == .testNotification {
|
if pushNotification.kind == .testNotification {
|
||||||
return ("Test Notification", "This is a test notification.", 0)
|
return ("Test Notification", "This is a test notification.", 0)
|
||||||
} else if pushUser != nil {
|
} else if pushUser != nil {
|
||||||
return (pushUser!.displayName, getPushNotificationText(pushNotification: pushNotification), pushUser!.userID)
|
return (
|
||||||
|
pushUser!.displayName,
|
||||||
|
getPushNotificationText(pushNotification: pushNotification), pushUser!.userID
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
return ("", getPushNotificationTextWithoutUserId(pushKind: pushNotification.kind), 1)
|
return (
|
||||||
|
"", getPushNotificationTextWithoutUserId(pushKind: pushNotification.kind), 1
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -229,9 +234,9 @@ func getPushNotificationText(pushNotification: PushNotification) -> String {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
var content = pushNotificationText[pushNotification.kind] ?? "";
|
var content = pushNotificationText[pushNotification.kind] ?? ""
|
||||||
|
|
||||||
if (pushNotification.hasReactionContent) {
|
if pushNotification.hasReactionContent {
|
||||||
content.replace("{{reaction}}", with: pushNotification.reactionContent)
|
content.replace("{{reaction}}", with: pushNotification.reactionContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue