diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist
index 342d37adb..378a5f3ca 100644
--- a/Signal/Signal-Info.plist
+++ b/Signal/Signal-Info.plist
@@ -5,7 +5,7 @@
BuildDetails
CarthageVersion
- 0.34.0
+ 0.33.0
OSXVersion
10.15.3
WebRTCCommit
diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m
index 3039232bf..864ca3f2e 100644
--- a/Signal/src/AppDelegate.m
+++ b/Signal/src/AppDelegate.m
@@ -316,9 +316,6 @@ static NSTimeInterval launchStartedAt;
name:NSNotificationName_2FAStateDidChange
object:nil];
- // Loki - Observe new messages received notifications
- [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleNewMessagesReceived:) name:NSNotification.newMessagesReceived object:nil];
-
// Loki - Observe thread deleted notifications
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleThreadDeleted:) name:NSNotification.threadDeleted object:nil];
diff --git a/Signal/src/Loki/Components/ConversationTitleView.swift b/Signal/src/Loki/Components/ConversationTitleView.swift
index 411b19b79..6f9103012 100644
--- a/Signal/src/Loki/Components/ConversationTitleView.swift
+++ b/Signal/src/Loki/Components/ConversationTitleView.swift
@@ -7,8 +7,8 @@ final class ConversationTitleView : UIView {
// MARK: Types
private enum Status : Int {
case calculatingPoW = 1
- case contactingNetwork = 2
- case sendingMessage = 3
+ case routing = 2
+ case messageSending = 3
case messageSent = 4
case messageFailed = 5
}
@@ -40,8 +40,8 @@ final class ConversationTitleView : UIView {
let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self, selector: #selector(handleProfileChangedNotification(_:)), name: NSNotification.Name(rawValue: kNSNotificationName_OtherUsersProfileDidChange), object: nil)
notificationCenter.addObserver(self, selector: #selector(handleCalculatingPoWNotification(_:)), name: .calculatingPoW, object: nil)
- notificationCenter.addObserver(self, selector: #selector(handleContactingNetworkNotification(_:)), name: .contactingNetwork, object: nil)
- notificationCenter.addObserver(self, selector: #selector(handleSendingMessageNotification(_:)), name: .sendingMessage, object: nil)
+ notificationCenter.addObserver(self, selector: #selector(handleRoutingNotification(_:)), name: .routing, object: nil)
+ notificationCenter.addObserver(self, selector: #selector(handleMessageSendingNotification(_:)), name: .messageSending, object: nil)
notificationCenter.addObserver(self, selector: #selector(handleMessageSentNotification(_:)), name: .messageSent, object: nil)
notificationCenter.addObserver(self, selector: #selector(handleMessageFailedNotification(_:)), name: .messageFailed, object: nil)
}
@@ -99,14 +99,14 @@ final class ConversationTitleView : UIView {
setStatusIfNeeded(to: .calculatingPoW, forMessageWithTimestamp: timestamp)
}
- @objc private func handleContactingNetworkNotification(_ notification: Notification) {
+ @objc private func handleRoutingNotification(_ notification: Notification) {
guard let timestamp = notification.object as? NSNumber else { return }
- setStatusIfNeeded(to: .contactingNetwork, forMessageWithTimestamp: timestamp)
+ setStatusIfNeeded(to: .routing, forMessageWithTimestamp: timestamp)
}
- @objc private func handleSendingMessageNotification(_ notification: Notification) {
+ @objc private func handleMessageSendingNotification(_ notification: Notification) {
guard let timestamp = notification.object as? NSNumber else { return }
- setStatusIfNeeded(to: .sendingMessage, forMessageWithTimestamp: timestamp)
+ setStatusIfNeeded(to: .messageSending, forMessageWithTimestamp: timestamp)
}
@objc private func handleMessageSentNotification(_ notification: Notification) {
@@ -147,8 +147,8 @@ final class ConversationTitleView : UIView {
self.subtitleLabel.isHidden = false
switch self.currentStatus {
case .calculatingPoW: self.subtitleLabel.text = NSLocalizedString("Encrypting message", comment: "")
- case .contactingNetwork: self.subtitleLabel.text = NSLocalizedString("Tracing a path", comment: "")
- case .sendingMessage: self.subtitleLabel.text = NSLocalizedString("Sending message", comment: "")
+ case .routing: self.subtitleLabel.text = NSLocalizedString("Tracing a path", comment: "")
+ case .messageSending: self.subtitleLabel.text = NSLocalizedString("Sending message", comment: "")
case .messageSent: self.subtitleLabel.text = NSLocalizedString("Message sent securely", comment: "")
case .messageFailed: self.subtitleLabel.text = NSLocalizedString("Message failed to send", comment: "")
case nil:
diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m
index 691ee9e4f..741231a4e 100644
--- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m
+++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m
@@ -429,12 +429,12 @@ typedef enum : NSUInteger {
name:NSNotification.calculatingPoW
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(handleContactingNetworkNotification:)
- name:NSNotification.contactingNetwork
+ selector:@selector(handleRoutingNotification:)
+ name:NSNotification.routing
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(handleSendingMessageNotification:)
- name:NSNotification.sendingMessage
+ selector:@selector(handleMessageSendingNotification:)
+ name:NSNotification.messageSending
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMessageSentNotification:)
@@ -5419,13 +5419,13 @@ typedef enum : NSUInteger {
[self setProgressIfNeededTo:0.25f forMessageWithTimestamp:timestamp];
}
-- (void)handleContactingNetworkNotification:(NSNotification *)notification
+- (void)handleRoutingNotification:(NSNotification *)notification
{
NSNumber *timestamp = (NSNumber *)notification.object;
[self setProgressIfNeededTo:0.50f forMessageWithTimestamp:timestamp];
}
-- (void)handleSendingMessageNotification:(NSNotification *)notification
+- (void)handleMessageSendingNotification:(NSNotification *)notification
{
NSNumber *timestamp = (NSNumber *)notification.object;
[self setProgressIfNeededTo:0.75f forMessageWithTimestamp:timestamp];
diff --git a/SignalServiceKit/src/Loki/API/LokiAPI+SwarmAPI.swift b/SignalServiceKit/src/Loki/API/LokiAPI+SwarmAPI.swift
index ba3b130de..61ec13fce 100644
--- a/SignalServiceKit/src/Loki/API/LokiAPI+SwarmAPI.swift
+++ b/SignalServiceKit/src/Loki/API/LokiAPI+SwarmAPI.swift
@@ -1,7 +1,8 @@
import PromiseKit
public extension LokiAPI {
-
+
+ /// Only ever accessed from `LokiAPI.errorHandlingQueue` to avoid race conditions.
fileprivate static var failureCount: [LokiAPITarget:UInt] = [:]
// MARK: Settings
diff --git a/SignalServiceKit/src/Loki/API/LokiAPI.swift b/SignalServiceKit/src/Loki/API/LokiAPI.swift
index 54aad067a..126eac01b 100644
--- a/SignalServiceKit/src/Loki/API/LokiAPI.swift
+++ b/SignalServiceKit/src/Loki/API/LokiAPI.swift
@@ -187,10 +187,10 @@ public final class LokiAPI : NSObject {
func sendLokiMessageUsingSwarmAPI() -> Promise> {
notificationCenter.post(name: .calculatingPoW, object: NSNumber(value: signalMessage.timestamp))
return lokiMessage.calculatePoW().then { lokiMessageWithPoW -> Promise> in
- notificationCenter.post(name: .contactingNetwork, object: NSNumber(value: signalMessage.timestamp))
+ notificationCenter.post(name: .routing, object: NSNumber(value: signalMessage.timestamp))
return getTargetSnodes(for: destination).map { swarm in
return Set(swarm.map { target in
- notificationCenter.post(name: .sendingMessage, object: NSNumber(value: signalMessage.timestamp))
+ notificationCenter.post(name: .messageSending, object: NSNumber(value: signalMessage.timestamp))
return sendLokiMessage(lokiMessageWithPoW, to: target).map { rawResponse in
if let json = rawResponse as? JSON, let powDifficulty = json["difficulty"] as? Int {
guard powDifficulty != LokiAPI.powDifficulty else { return rawResponse }
diff --git a/SignalServiceKit/src/Loki/Messaging/Notification+Loki.swift b/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift
similarity index 78%
rename from SignalServiceKit/src/Loki/Messaging/Notification+Loki.swift
rename to SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift
index 176c3adef..f4ab9bef8 100644
--- a/SignalServiceKit/src/Loki/Messaging/Notification+Loki.swift
+++ b/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift
@@ -1,36 +1,40 @@
public extension Notification.Name {
+
+ // State changes
public static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged")
- public static let newMessagesReceived = Notification.Name("newMessagesReceived")
public static let threadFriendRequestStatusChanged = Notification.Name("threadFriendRequestStatusChanged")
public static let messageFriendRequestStatusChanged = Notification.Name("messageFriendRequestStatusChanged")
public static let threadDeleted = Notification.Name("threadDeleted")
- public static let dataNukeRequested = Notification.Name("dataNukeRequested")
public static let threadSessionRestoreDevicesChanged = Notification.Name("threadSessionRestoreDevicesChanged")
- // Message statuses
+ // Message status changes
public static let calculatingPoW = Notification.Name("calculatingPoW")
- public static let contactingNetwork = Notification.Name("contactingNetwork")
- public static let sendingMessage = Notification.Name("sendingMessage")
+ public static let routing = Notification.Name("routing")
+ public static let messageSending = Notification.Name("messageSending")
public static let messageSent = Notification.Name("messageSent")
public static let messageFailed = Notification.Name("messageFailed")
// Onboarding
public static let seedViewed = Notification.Name("seedViewed")
+ // Interaction
+ public static let dataNukeRequested = Notification.Name("dataNukeRequested")
}
@objc public extension NSNotification {
+
+ // State changes
@objc public static let contactOnlineStatusChanged = Notification.Name.contactOnlineStatusChanged.rawValue as NSString
- @objc public static let newMessagesReceived = Notification.Name.newMessagesReceived.rawValue as NSString
@objc public static let threadFriendRequestStatusChanged = Notification.Name.threadFriendRequestStatusChanged.rawValue as NSString
@objc public static let messageFriendRequestStatusChanged = Notification.Name.messageFriendRequestStatusChanged.rawValue as NSString
@objc public static let threadDeleted = Notification.Name.threadDeleted.rawValue as NSString
- @objc public static let dataNukeRequested = Notification.Name.dataNukeRequested.rawValue as NSString
@objc public static let threadSessionRestoreDevicesChanged = Notification.Name.threadSessionRestoreDevicesChanged.rawValue as NSString
// Message statuses
@objc public static let calculatingPoW = Notification.Name.calculatingPoW.rawValue as NSString
- @objc public static let contactingNetwork = Notification.Name.contactingNetwork.rawValue as NSString
- @objc public static let sendingMessage = Notification.Name.sendingMessage.rawValue as NSString
+ @objc public static let routing = Notification.Name.routing.rawValue as NSString
+ @objc public static let messageSending = Notification.Name.messageSending.rawValue as NSString
@objc public static let messageSent = Notification.Name.messageSent.rawValue as NSString
@objc public static let messageFailed = Notification.Name.messageFailed.rawValue as NSString
// Onboarding
@objc public static let seedViewed = Notification.Name.seedViewed.rawValue as NSString
+ // Interaction
+ @objc public static let dataNukeRequested = Notification.Name.dataNukeRequested.rawValue as NSString
}