From 6aec747709a8e8b6ea67b9bb3234c04af35126d1 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Mon, 6 Apr 2020 12:02:55 +1000 Subject: [PATCH] clean --- LokiPushNotificationService/NotificationService.swift | 2 +- SignalServiceKit/src/Loki/API/LokiAPI.swift | 2 +- .../src/Loki/Utilities/LokiPushNotificationManager.swift | 4 ++-- SignalServiceKit/src/Messages/OWSMessageManager.m | 9 --------- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/LokiPushNotificationService/NotificationService.swift b/LokiPushNotificationService/NotificationService.swift index 09768aa39..e8959d747 100644 --- a/LokiPushNotificationService/NotificationService.swift +++ b/LokiPushNotificationService/NotificationService.swift @@ -45,7 +45,7 @@ class NotificationService: UNNotificationServiceExtension { let contentProto = try? SSKProtoContent.parseData(result.plaintextData!) var thread: TSThread var newNotificationBody = "" - let masterHexEncodedPublicKey: String = LokiDatabaseUtilities.objc_getMasterHexEncodedPublicKey(for: result.source, in: transaction) ?? result.source + let masterHexEncodedPublicKey: String = OWSPrimaryStorage.shared().getMasterHexEncodedPublicKey(for: result.source, in: transaction) ?? result.source var displayName = masterHexEncodedPublicKey if let groupId = contentProto?.dataMessage?.group?.id { thread = TSGroupThread.getOrCreateThread(withGroupId: groupId, groupType: .closedGroup, transaction: transaction) diff --git a/SignalServiceKit/src/Loki/API/LokiAPI.swift b/SignalServiceKit/src/Loki/API/LokiAPI.swift index 7dedb1353..4727fa8f8 100644 --- a/SignalServiceKit/src/Loki/API/LokiAPI.swift +++ b/SignalServiceKit/src/Loki/API/LokiAPI.swift @@ -271,7 +271,7 @@ public final class LokiAPI : NSObject { if let lastMessage = rawMessages.last, let hashValue = lastMessage["hash"] as? String, let expirationDate = lastMessage["expiration"] as? Int { setLastMessageHashValue(for: target, hashValue: hashValue, expirationDate: UInt64(expirationDate)) if UserDefaults.standard[.isUsingFullAPNs] { - LokiPushNotificationManager.acknowledgeDeliveryForMessage(with: hashValue, expiration: expirationDate, hexEncodedPublicKey: userHexEncodedPublicKey) + LokiPushNotificationManager.acknowledgeDelivery(forMessageWithHash: hashValue, expiration: expirationDate, hexEncodedPublicKey: userHexEncodedPublicKey) } } else if (!rawMessages.isEmpty) { print("[Loki] Failed to update last message hash value from: \(rawMessages).") diff --git a/SignalServiceKit/src/Loki/Utilities/LokiPushNotificationManager.swift b/SignalServiceKit/src/Loki/Utilities/LokiPushNotificationManager.swift index 7785693b7..683bda36a 100644 --- a/SignalServiceKit/src/Loki/Utilities/LokiPushNotificationManager.swift +++ b/SignalServiceKit/src/Loki/Utilities/LokiPushNotificationManager.swift @@ -75,8 +75,8 @@ final class LokiPushNotificationManager : NSObject { } @objc(acknowledgeDeliveryForMessageWithHash:expiration:hexEncodedPublicKey:) - static func acknowledgeDeliveryForMessage(with hash: String, expiration:Int, hexEncodedPublicKey: String) { - let parameters: [String : Any] = [ "lastHash" : hash, + static func acknowledgeDelivery(forMessageWithHash hash: String, expiration:Int, hexEncodedPublicKey: String) { + let parameters: JSON = [ "lastHash" : hash, "pubKey" : hexEncodedPublicKey, "expiration": expiration] let url = URL(string: server + "acknowledge_message_delivery")! diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index 5fb0a33dc..861ce1fb5 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -1884,15 +1884,6 @@ NS_ASSUME_NONNULL_BEGIN if (incomingMessage.isFriendRequest) { [thread removeOldIncomingFriendRequestMessagesIfNeededWithTransaction:transaction]; } -// -// if (!CurrentAppContext().isMainApp) { -// dispatch_async(dispatch_get_main_queue(), ^{ -// [self.typingIndicators didReceiveIncomingMessageInThread:masterThread -// recipientId:(masterThread.contactIdentifier ?: envelope.source) -// deviceId:envelope.sourceDevice]; -// }); -// return; -// } // Any messages sent from the current user - from this device or another - should be automatically marked as read. if ([(masterThread.contactIdentifier ?: envelope.source) isEqualToString:self.tsAccountManager.localNumber]) {