mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Re-order files
This commit is contained in:
parent
1a8175472a
commit
1c73cf5114
|
@ -19,5 +19,5 @@
|
||||||
#import <SignalCoreKit/OWSAsserts.h>
|
#import <SignalCoreKit/OWSAsserts.h>
|
||||||
#import <SignalServiceKit/SSKAsserts.h>
|
#import <SignalServiceKit/SSKAsserts.h>
|
||||||
#import <SignalServiceKit/OWSAnalytics.h>
|
#import <SignalServiceKit/OWSAnalytics.h>
|
||||||
#import <SignalServiceKit/NSObject.h>
|
#import <SignalServiceKit/NSObject+Casting.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -158,7 +158,7 @@ static NSTimeInterval launchStartedAt;
|
||||||
return AppEnvironment.shared.legacyNotificationActionHandler;
|
return AppEnvironment.shared.legacyNotificationActionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OWSLokiFriendRequestExpireJob *)lokiFriendRequestExpireJob
|
- (LKFriendRequestExpirationJob *)lokiFriendRequestExpireJob
|
||||||
{
|
{
|
||||||
return SSKEnvironment.shared.lokiFriendRequestExpireJob;
|
return SSKEnvironment.shared.lokiFriendRequestExpireJob;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class SessionResetOperation: OWSOperation, DurableOperation {
|
||||||
message.save(with: transaction)
|
message.save(with: transaction)
|
||||||
|
|
||||||
// Loki: We have initiated a session reset
|
// Loki: We have initiated a session reset
|
||||||
Logger.debug("[Loki] Session reset has been initiated.")
|
Logger.debug("[Loki] Session reset initiated.")
|
||||||
self.contactThread.sessionResetState = .initiated
|
self.contactThread.sessionResetState = .initiated
|
||||||
self.contactThread.save(with: transaction)
|
self.contactThread.save(with: transaction)
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
#import <SignalServiceKit/Contact.h>
|
#import <SignalServiceKit/Contact.h>
|
||||||
#import <SignalServiceKit/ContactsUpdater.h>
|
#import <SignalServiceKit/ContactsUpdater.h>
|
||||||
#import <SignalServiceKit/DataSource.h>
|
#import <SignalServiceKit/DataSource.h>
|
||||||
#import <SignalServiceKit/ECKeyPair.h>
|
#import <SignalServiceKit/ECKeyPair+Loki.h>
|
||||||
#import <SignalServiceKit/MIMETypeUtil.h>
|
#import <SignalServiceKit/MIMETypeUtil.h>
|
||||||
#import <SignalServiceKit/NSData+Image.h>
|
#import <SignalServiceKit/NSData+Image.h>
|
||||||
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
||||||
|
@ -90,10 +90,10 @@
|
||||||
#import <SignalServiceKit/OWSContactsOutputStream.h>
|
#import <SignalServiceKit/OWSContactsOutputStream.h>
|
||||||
#import <SignalServiceKit/OWSDispatch.h>
|
#import <SignalServiceKit/OWSDispatch.h>
|
||||||
#import <SignalServiceKit/OWSEndSessionMessage.h>
|
#import <SignalServiceKit/OWSEndSessionMessage.h>
|
||||||
#import <SignalServiceKit/OWSEphemeralMessage.h>
|
#import <SignalServiceKit/LKEphemeralMessage.h>
|
||||||
#import <SignalServiceKit/OWSError.h>
|
#import <SignalServiceKit/OWSError.h>
|
||||||
#import <SignalServiceKit/OWSFileSystem.h>
|
#import <SignalServiceKit/OWSFileSystem.h>
|
||||||
#import <SignalServiceKit/OWSFriendRequestMessage.h>
|
#import <SignalServiceKit/LKFriendRequestMessage.h>
|
||||||
#import <SignalServiceKit/OWSIdentityManager.h>
|
#import <SignalServiceKit/OWSIdentityManager.h>
|
||||||
#import <SignalServiceKit/OWSMediaGalleryFinder.h>
|
#import <SignalServiceKit/OWSMediaGalleryFinder.h>
|
||||||
#import <SignalServiceKit/OWSMessageManager.h>
|
#import <SignalServiceKit/OWSMessageManager.h>
|
||||||
|
|
|
@ -127,7 +127,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
attachmentDownloads:attachmentDownloads]];
|
attachmentDownloads:attachmentDownloads]];
|
||||||
|
|
||||||
// Loki
|
// Loki
|
||||||
OWSLokiFriendRequestExpireJob *lokiFriendRequestExpireJob = [[OWSLokiFriendRequestExpireJob alloc] initWithPrimaryStorage:primaryStorage];
|
LKFriendRequestExpirationJob *lokiFriendRequestExpireJob = [[LKFriendRequestExpirationJob alloc] initWithPrimaryStorage:primaryStorage];
|
||||||
SSKEnvironment.shared.lokiFriendRequestExpireJob = lokiFriendRequestExpireJob;
|
SSKEnvironment.shared.lokiFriendRequestExpireJob = lokiFriendRequestExpireJob;
|
||||||
|
|
||||||
appSpecificSingletonBlock();
|
appSpecificSingletonBlock();
|
||||||
|
|
|
@ -85,9 +85,9 @@ typedef void (^BuildOutgoingMessageCompletionBlock)(TSOutgoingMessage *savedMess
|
||||||
|
|
||||||
#pragma mark - Durable Message Enqueue
|
#pragma mark - Durable Message Enqueue
|
||||||
|
|
||||||
+ (OWSEphemeralMessage *)enqueueAcceptFriendRequestMessageInThread:(TSThread *)thread
|
+ (LKEphemeralMessage *)enqueueAcceptFriendRequestMessageInThread:(TSThread *)thread
|
||||||
{
|
{
|
||||||
OWSEphemeralMessage *emptyMessage = [OWSEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
LKEphemeralMessage *emptyMessage = [LKEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
||||||
[self.dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
[self.dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||||
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
||||||
}];
|
}];
|
||||||
|
@ -185,7 +185,7 @@ typedef void (^BuildOutgoingMessageCompletionBlock)(TSOutgoingMessage *savedMess
|
||||||
|
|
||||||
// Loki: If we're not friends then always set the message to a friend request message
|
// Loki: If we're not friends then always set the message to a friend request message
|
||||||
// If we're friends then the assumption is that we have the other user's prekey bundle
|
// If we're friends then the assumption is that we have the other user's prekey bundle
|
||||||
NSString *messageClassAsString = thread.isContactFriend ? @"TSOutgoingMessage" : @"OWSFriendRequestMessage";
|
NSString *messageClassAsString = thread.isContactFriend ? @"TSOutgoingMessage" : @"LKFriendRequestMessage";
|
||||||
Class messageClass = NSClassFromString(messageClassAsString);
|
Class messageClass = NSClassFromString(messageClassAsString);
|
||||||
|
|
||||||
TSOutgoingMessage *message =
|
TSOutgoingMessage *message =
|
||||||
|
|
|
@ -37,7 +37,7 @@ public extension LokiAPI {
|
||||||
let destination = signalMessage["destination"] as! String
|
let destination = signalMessage["destination"] as! String
|
||||||
let ttl = LokiAPI.defaultMessageTTL
|
let ttl = LokiAPI.defaultMessageTTL
|
||||||
if isPoWRequired {
|
if isPoWRequired {
|
||||||
// Storage server takes a time interval in milliseconds
|
// The storage server takes a time interval in milliseconds
|
||||||
let now = NSDate.ows_millisecondTimeStamp()
|
let now = NSDate.ows_millisecondTimeStamp()
|
||||||
if let nonce = ProofOfWork.calculate(data: data, pubKey: destination, timestamp: now, ttl: ttl) {
|
if let nonce = ProofOfWork.calculate(data: data, pubKey: destination, timestamp: now, ttl: ttl) {
|
||||||
let result = Message(destination: destination, data: data, ttl: ttl, timestamp: now, nonce: nonce)
|
let result = Message(destination: destination, data: data, ttl: ttl, timestamp: now, nonce: nonce)
|
||||||
|
|
|
@ -46,7 +46,7 @@ extension LokiAPI {
|
||||||
let envelope = webSocketMessage.request!.body!
|
let envelope = webSocketMessage.request!.body!
|
||||||
return try SSKProtoEnvelope.parseData(envelope)
|
return try SSKProtoEnvelope.parseData(envelope)
|
||||||
} catch let error {
|
} catch let error {
|
||||||
owsFailDebug("[Loki API] Failed to unwrap data: \(error).")
|
owsFailDebug("[Loki] Failed to unwrap data: \(error).")
|
||||||
throw WrappingError.failedToUnwrapData
|
throw WrappingError.failedToUnwrapData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ extension LokiAPI {
|
||||||
messageBuilder.setRequest(try requestBuilder.build())
|
messageBuilder.setRequest(try requestBuilder.build())
|
||||||
return try messageBuilder.build()
|
return try messageBuilder.build()
|
||||||
} catch let error {
|
} catch let error {
|
||||||
owsFailDebug("[Loki API] - Failed to wrap envelope in web socket message: \(error).")
|
owsFailDebug("[Loki] Failed to wrap envelope in web socket message: \(error).")
|
||||||
throw WrappingError.failedToWrapEnvelopeInWebSocketMessage
|
throw WrappingError.failedToWrapEnvelopeInWebSocketMessage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,14 +68,14 @@ extension LokiAPI {
|
||||||
/// Wrap a `SignalMessage` in an `SSKProtoEnvelope`.
|
/// Wrap a `SignalMessage` in an `SSKProtoEnvelope`.
|
||||||
private static func createEnvelope(around signalMessage: SignalMessage, timestamp: UInt64) throws -> SSKProtoEnvelope {
|
private static func createEnvelope(around signalMessage: SignalMessage, timestamp: UInt64) throws -> SSKProtoEnvelope {
|
||||||
guard let keyPair = SSKEnvironment.shared.identityManager.identityKeyPair() else {
|
guard let keyPair = SSKEnvironment.shared.identityManager.identityKeyPair() else {
|
||||||
owsFailDebug("[Loki API] - Failed to wrap message in envelope: identityManager.identityKeyPair() is invalid.")
|
owsFailDebug("[Loki] Failed to wrap message in envelope: identityManager.identityKeyPair() is invalid.")
|
||||||
throw WrappingError.failedToWrapMessageInEnvelope
|
throw WrappingError.failedToWrapMessageInEnvelope
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
let hexEncodedPublicKey = keyPair.hexEncodedPublicKey
|
let hexEncodedPublicKey = keyPair.hexEncodedPublicKey
|
||||||
let parameters = ParamParser(dictionary: signalMessage)
|
let parameters = ParamParser(dictionary: signalMessage)
|
||||||
let rawType: Int32 = try parameters.required(key: "type")
|
let rawType: Int32 = try parameters.required(key: "type")
|
||||||
guard let type: SSKProtoEnvelope.SSKProtoEnvelopeType = SSKProtoEnvelope.SSKProtoEnvelopeType(rawValue: rawType) else {
|
guard let type = SSKProtoEnvelope.SSKProtoEnvelopeType(rawValue: rawType) else {
|
||||||
Logger.error("Invalid envelope type: \(rawType).")
|
Logger.error("Invalid envelope type: \(rawType).")
|
||||||
throw ParamParser.ParseError.invalidFormat("type")
|
throw ParamParser.ParseError.invalidFormat("type")
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ extension LokiAPI {
|
||||||
}
|
}
|
||||||
return try builder.build()
|
return try builder.build()
|
||||||
} catch let error {
|
} catch let error {
|
||||||
owsFailDebug("[Loki API] Failed to wrap message in envelope: \(error).")
|
owsFailDebug("[Loki] Failed to wrap message in envelope: \(error).")
|
||||||
throw WrappingError.failedToWrapMessageInEnvelope
|
throw WrappingError.failedToWrapMessageInEnvelope
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,11 @@ import PromiseKit
|
||||||
guard let json = rawResponse as? JSON, let messages = json["messages"] as? [JSON] else { return [] }
|
guard let json = rawResponse as? JSON, let messages = json["messages"] as? [JSON] else { return [] }
|
||||||
return messages.compactMap { message in
|
return messages.compactMap { message in
|
||||||
guard let base64EncodedData = message["data"] as? String, let data = Data(base64Encoded: base64EncodedData) else {
|
guard let base64EncodedData = message["data"] as? String, let data = Data(base64Encoded: base64EncodedData) else {
|
||||||
Logger.warn("[Loki API] Failed to decode data for message: \(message).")
|
Logger.warn("[Loki] Failed to decode data for message: \(message).")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
guard let envelope = try? unwrap(data: data) else {
|
guard let envelope = try? unwrap(data: data) else {
|
||||||
Logger.warn("[Loki API] Failed to unwrap data for message: \(message).")
|
Logger.warn("[Loki] Failed to unwrap data for message: \(message).")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return envelope
|
return envelope
|
||||||
|
@ -82,7 +82,7 @@ import PromiseKit
|
||||||
@objc public static func objc_sendSignalMessage(_ signalMessage: SignalMessage, to destination: String, timestamp: UInt64, requiringPoW isPoWRequired: Bool) -> AnyPromise {
|
@objc public static func objc_sendSignalMessage(_ signalMessage: SignalMessage, to destination: String, timestamp: UInt64, requiringPoW isPoWRequired: Bool) -> AnyPromise {
|
||||||
let promise = Message.from(signalMessage: signalMessage, timestamp: timestamp, requiringPoW: isPoWRequired)
|
let promise = Message.from(signalMessage: signalMessage, timestamp: timestamp, requiringPoW: isPoWRequired)
|
||||||
.then(sendMessage)
|
.then(sendMessage)
|
||||||
.recoverNetworkError(on: DispatchQueue.global())
|
.recoverNetworkErrorIfNeeded(on: DispatchQueue.global())
|
||||||
let anyPromise = AnyPromise(promise)
|
let anyPromise = AnyPromise(promise)
|
||||||
anyPromise.retainUntilComplete()
|
anyPromise.retainUntilComplete()
|
||||||
return anyPromise
|
return anyPromise
|
||||||
|
@ -93,13 +93,11 @@ import PromiseKit
|
||||||
|
|
||||||
private extension Promise {
|
private extension Promise {
|
||||||
|
|
||||||
func recoverNetworkError(on queue: DispatchQueue) -> Promise<T> {
|
func recoverNetworkErrorIfNeeded(on queue: DispatchQueue) -> Promise<T> {
|
||||||
return self.recover(on: queue) { error -> Promise<T> in
|
return self.recover(on: queue) { error -> Promise<T> in
|
||||||
switch error {
|
switch error {
|
||||||
case NetworkManagerError.taskError(_, let underlyingError):
|
case NetworkManagerError.taskError(_, let underlyingError): throw underlyingError
|
||||||
throw underlyingError
|
default: throw error
|
||||||
default:
|
|
||||||
throw error
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#import "ECKeyPair.h"
|
#import "ECKeyPair+Loki.h"
|
||||||
|
|
||||||
extern void curve25519_donna(unsigned char *output, const unsigned char *a, const unsigned char *b);
|
extern void curve25519_donna(unsigned char *output, const unsigned char *a, const unsigned char *b);
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
@try {
|
@try {
|
||||||
return [self throws_loadPreKey:preKeyId];
|
return [self throws_loadPreKey:preKeyId];
|
||||||
} @catch (NSException *exception) {
|
} @catch (NSException *exception) {
|
||||||
OWSLogWarn(@"[Loki] New prekey had to be generated for %@.", pubKey);
|
OWSLogWarn(@"[Loki] New prekey generated for %@.", pubKey);
|
||||||
return [self generateAndStorePreKeyForContact:pubKey];
|
return [self generateAndStorePreKeyForContact:pubKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -43,7 +43,7 @@ private extension MutableCollection where Element == UInt8, Index == Int {
|
||||||
* This was copied from the desktop messenger.
|
* This was copied from the desktop messenger.
|
||||||
* Ref: libloki/proof-of-work.js
|
* Ref: libloki/proof-of-work.js
|
||||||
*/
|
*/
|
||||||
@objc public final class ProofOfWork : NSObject {
|
public enum ProofOfWork {
|
||||||
|
|
||||||
// If this changes then we also have to use something other than UInt64 to support the new length
|
// If this changes then we also have to use something other than UInt64 to support the new length
|
||||||
private static let nonceLength = 8
|
private static let nonceLength = 8
|
||||||
|
@ -54,8 +54,6 @@ private extension MutableCollection where Element == UInt8, Index == Int {
|
||||||
case .production: return 100
|
case .production: return 100
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private override init() { }
|
|
||||||
|
|
||||||
/// Calculate a proof of work with the given configuration
|
/// Calculate a proof of work with the given configuration
|
||||||
///
|
///
|
||||||
|
@ -67,7 +65,7 @@ private extension MutableCollection where Element == UInt8, Index == Int {
|
||||||
/// - timestamp: The timestamp
|
/// - timestamp: The timestamp
|
||||||
/// - ttl: The message time to live
|
/// - ttl: The message time to live
|
||||||
/// - Returns: A nonce string or `nil` if it failed
|
/// - Returns: A nonce string or `nil` if it failed
|
||||||
@objc public static func calculate(data: String, pubKey: String, timestamp: UInt64, ttl: UInt64) -> String? {
|
public static func calculate(data: String, pubKey: String, timestamp: UInt64, ttl: UInt64) -> String? {
|
||||||
let payload = createPayload(pubKey: pubKey, data: data, timestamp: timestamp, ttl: ttl)
|
let payload = createPayload(pubKey: pubKey, data: data, timestamp: timestamp, ttl: ttl)
|
||||||
let target = calcTarget(ttl: ttl, payloadLength: payload.count, nonceTrials: nonceTrialCount)
|
let target = calcTarget(ttl: ttl, payloadLength: payload.count, nonceTrials: nonceTrialCount)
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This class is used for settings friend requests to expired
|
Modeled after `OWSDisappearingMessagesJob`.
|
||||||
This is modelled after `OWSDisappearingMessagesJob`.
|
|
||||||
*/
|
*/
|
||||||
@objc(OWSLokiFriendRequestExpireJob)
|
@objc(LKFriendRequestExpirationJob)
|
||||||
public final class FriendRequestExpireJob : NSObject {
|
public final class FriendRequestExpirationJob : NSObject {
|
||||||
private let databaseConnection: YapDatabaseConnection
|
private let databaseConnection: YapDatabaseConnection
|
||||||
private let messageFinder = FriendRequestExpireMessageFinder()
|
private let messageFinder = FriendRequestExpirationMessageFinder()
|
||||||
|
|
||||||
// These properties should only be accessed on the main thread.
|
// These properties should only be accessed on the main thread.
|
||||||
private var hasStarted = false
|
private var hasStarted = false
|
||||||
|
@ -18,26 +17,21 @@ public final class FriendRequestExpireJob : NSObject {
|
||||||
fileprivate static let serialQueue = DispatchQueue(label: "network.loki.friendrequest.expire")
|
fileprivate static let serialQueue = DispatchQueue(label: "network.loki.friendrequest.expire")
|
||||||
|
|
||||||
/// Create a `FriendRequestExpireJob`.
|
/// Create a `FriendRequestExpireJob`.
|
||||||
/// This will create a auto-running job which will set friend requests to expired.
|
/// This will create an auto-running job which will set friend requests to expired.
|
||||||
///
|
|
||||||
/// - Parameter primaryStorage: The primary storage.
|
|
||||||
@objc public init(withPrimaryStorage primaryStorage: OWSPrimaryStorage) {
|
@objc public init(withPrimaryStorage primaryStorage: OWSPrimaryStorage) {
|
||||||
databaseConnection = primaryStorage.newDatabaseConnection()
|
databaseConnection = primaryStorage.newDatabaseConnection()
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
// This makes sure we only ever have one instance of this class
|
// This ensures we only ever have one instance of this class
|
||||||
SwiftSingletons.register(self)
|
SwiftSingletons.register(self)
|
||||||
|
|
||||||
// Setup a timer that runs periodically to check for new friend request messages that will soon expire
|
// Set up a timer that runs periodically to check for new friend request messages that will soon expire
|
||||||
AppReadiness.runNowOrWhenAppDidBecomeReady {
|
AppReadiness.runNowOrWhenAppDidBecomeReady {
|
||||||
if CurrentAppContext().isMainApp {
|
if CurrentAppContext().isMainApp {
|
||||||
let fallbackInterval = 5 * kMinuteInterval
|
let fallbackInterval = 5 * kMinuteInterval
|
||||||
self.fallbackTimer = WeakTimer.scheduledTimer(timeInterval: fallbackInterval, target: self, userInfo: nil, repeats: true) { [weak self] _ in
|
self.fallbackTimer = WeakTimer.scheduledTimer(timeInterval: fallbackInterval, target: self, userInfo: nil, repeats: true) { [weak self] _ in
|
||||||
AssertIsOnMainThread()
|
AssertIsOnMainThread()
|
||||||
|
self?.timerDidFire(isMainTimer: false)
|
||||||
guard let strongSelf = self else { return }
|
|
||||||
|
|
||||||
strongSelf.timerDidFire(mainTimer: false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,19 +44,19 @@ public final class FriendRequestExpireJob : NSObject {
|
||||||
NotificationCenter.default.removeObserver(self)
|
NotificationCenter.default.removeObserver(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start the job if we haven't done it yet
|
/// Start the job if we haven't done so yet.
|
||||||
@objc public func startIfNecessary() {
|
@objc public func startIfNecessary() {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
guard !self.hasStarted else { return }
|
guard !self.hasStarted else { return }
|
||||||
|
|
||||||
self.hasStarted = true;
|
self.hasStarted = true;
|
||||||
FriendRequestExpireJob.serialQueue.async {
|
FriendRequestExpirationJob.serialQueue.async {
|
||||||
self.runLoop()
|
self.runLoop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The main loop
|
/// The main loop.
|
||||||
private func runLoop() {
|
private func runLoop() {
|
||||||
AssertIsOnFriendRequestExpireQueue();
|
AssertIsOnFriendRequestExpireQueue();
|
||||||
|
|
||||||
|
@ -83,27 +77,19 @@ public final class FriendRequestExpireJob : NSObject {
|
||||||
// Schedule the next timer to run
|
// Schedule the next timer to run
|
||||||
private func scheduleRun(by date: Date) {
|
private func scheduleRun(by date: Date) {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
guard CurrentAppContext().isMainAppAndActive else {
|
guard CurrentAppContext().isMainAppAndActive else { return } // Don't schedule run when inactive or not in main app
|
||||||
// Don't schedule run when inactive or not in main app.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let minDelaySeconds: TimeInterval = 1
|
let minDelaySeconds: TimeInterval = 1
|
||||||
let delaySeconds = max(minDelaySeconds, date.timeIntervalSinceNow)
|
let delaySeconds = max(minDelaySeconds, date.timeIntervalSinceNow)
|
||||||
let newTimerScheduleDate = Date(timeIntervalSinceNow: delaySeconds)
|
let newTimerScheduleDate = Date(timeIntervalSinceNow: delaySeconds)
|
||||||
|
|
||||||
// check that we only set the date if needed
|
// Check that we only set the date if needed
|
||||||
if let previousDate = self.nextExpireDate, previousDate < date {
|
if let previousDate = self.nextExpireDate, previousDate < date { return } // If the date is later than the one we have stored then just ignore
|
||||||
// If the date is later than the one we have stored then just ignore
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
self.resetNextExpireTimer()
|
self.resetNextExpireTimer()
|
||||||
self.nextExpireDate = newTimerScheduleDate
|
self.nextExpireDate = newTimerScheduleDate
|
||||||
self.nextExpireTimer = WeakTimer.scheduledTimer(timeInterval: delaySeconds, target: self, userInfo: nil, repeats: false) { [weak self] _ in
|
self.nextExpireTimer = WeakTimer.scheduledTimer(timeInterval: delaySeconds, target: self, userInfo: nil, repeats: false) { [weak self] _ in
|
||||||
guard let strongSelf = self else { return }
|
self?.timerDidFire(isMainTimer: true)
|
||||||
|
|
||||||
strongSelf.timerDidFire(mainTimer: true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,15 +111,15 @@ public final class FriendRequestExpireJob : NSObject {
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
guard message.friendRequestExpiresAt <= now else {
|
guard message.friendRequestExpiresAt <= now else {
|
||||||
owsFailDebug("Refusing to expire friend request which doesn't expire until: \(message.friendRequestExpiresAt)")
|
owsFailDebug("Refusing to expire friend request which doesn't expire until: \(message.friendRequestExpiresAt).")
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that we only expire sent friend requests
|
// Check that we only expire sent friend requests
|
||||||
guard message is TSOutgoingMessage && message.friendRequestStatus == .pending else {
|
guard message is TSOutgoingMessage && message.friendRequestStatus == .pending else {
|
||||||
// Set message to not expire, so our other logic works correctly
|
// Set message to not expire, so our other logic works correctly
|
||||||
message.saveFriendRequestExpires(at: 0, with: transaction)
|
message.saveFriendRequestExpires(at: 0, with: transaction)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loki: Expire the friend request message
|
// Loki: Expire the friend request message
|
||||||
|
@ -151,16 +137,16 @@ public final class FriendRequestExpireJob : NSObject {
|
||||||
nextExpireDate = nil
|
nextExpireDate = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
private func timerDidFire(mainTimer: Bool) {
|
private func timerDidFire(isMainTimer: Bool) {
|
||||||
guard CurrentAppContext().isMainAppAndActive else {
|
guard CurrentAppContext().isMainAppAndActive else {
|
||||||
let infoString = mainTimer ? "Main timer fired while main app is inactive" : "Ignoring fallbacktimer for app which is not main and active."
|
let infoString = isMainTimer ? "Main timer fired while main app is inactive." : "Ignoring fallback timer for app which is not main and active."
|
||||||
Logger.info("[Loki Friend Request Expire Job] \(infoString)")
|
Logger.info("[Loki] Friend request expiration job: \(infoString)")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainTimer) { self.resetNextExpireTimer() }
|
if (isMainTimer) { self.resetNextExpireTimer() }
|
||||||
|
|
||||||
FriendRequestExpireJob.serialQueue.async {
|
FriendRequestExpirationJob.serialQueue.async {
|
||||||
self.runLoop()
|
self.runLoop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,12 +154,12 @@ public final class FriendRequestExpireJob : NSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Events
|
// MARK: Events
|
||||||
private extension FriendRequestExpireJob {
|
private extension FriendRequestExpirationJob {
|
||||||
|
|
||||||
@objc func didBecomeActive() {
|
@objc func didBecomeActive() {
|
||||||
AssertIsOnMainThread()
|
AssertIsOnMainThread()
|
||||||
AppReadiness.runNowOrWhenAppDidBecomeReady {
|
AppReadiness.runNowOrWhenAppDidBecomeReady {
|
||||||
FriendRequestExpireJob.serialQueue.async {
|
FriendRequestExpirationJob.serialQueue.async {
|
||||||
self.runLoop()
|
self.runLoop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,12 +173,12 @@ private extension FriendRequestExpireJob {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Asserts
|
// MARK: Asserts
|
||||||
private extension FriendRequestExpireJob {
|
private extension FriendRequestExpirationJob {
|
||||||
|
|
||||||
func AssertIsOnFriendRequestExpireQueue() {
|
func AssertIsOnFriendRequestExpireQueue() {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
guard #available(iOS 10.0, *) else { return }
|
guard #available(iOS 10.0, *) else { return }
|
||||||
dispatchPrecondition(condition: .onQueue(FriendRequestExpireJob.serialQueue))
|
dispatchPrecondition(condition: .onQueue(FriendRequestExpirationJob.serialQueue))
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +1,19 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This class is used for finding friend request messages which are expired.
|
This class is used for finding friend request messages which are pending expiration.
|
||||||
This is modelled after `OWSDisappearingMessagesFinder`.
|
Modeled after `OWSDisappearingMessagesFinder`.
|
||||||
*/
|
*/
|
||||||
@objc(OWSLokiFriendRequestExpireMessageFinder)
|
@objc(LKFriendRequestExpirationMessageFinder)
|
||||||
public class FriendRequestExpireMessageFinder : NSObject {
|
public final class FriendRequestExpirationMessageFinder : NSObject {
|
||||||
public static let friendRequestExpireColumn = "friend_request_expires_at"
|
|
||||||
public static let friendRequestExpireIndex = "loki_index_friend_request_expires_at"
|
private static let friendRequestExpireColumn = "friend_request_expires_at"
|
||||||
|
private static let friendRequestExpireIndex = "loki_index_friend_request_expires_at"
|
||||||
|
|
||||||
public func nextExpirationTimestamp(with transaction: YapDatabaseReadTransaction) -> UInt64? {
|
public func nextExpirationTimestamp(with transaction: YapDatabaseReadTransaction) -> UInt64? {
|
||||||
let query = "WHERE \(FriendRequestExpireMessageFinder.friendRequestExpireColumn) > 0 ORDER BY \(FriendRequestExpireMessageFinder.friendRequestExpireColumn) ASC"
|
let query = "WHERE \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) > 0 ORDER BY \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) ASC"
|
||||||
|
|
||||||
let dbQuery = YapDatabaseQuery(string: query, parameters: [])
|
let dbQuery = YapDatabaseQuery(string: query, parameters: [])
|
||||||
let ext = transaction.ext(FriendRequestExpireMessageFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction
|
let ext = transaction.ext(FriendRequestExpirationMessageFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction
|
||||||
var firstMessage: TSMessage? = nil
|
var firstMessage: TSMessage? = nil
|
||||||
ext?.enumerateKeysAndObjects(matching: dbQuery) { (collection, key, object, stop) in
|
ext?.enumerateKeysAndObjects(matching: dbQuery) { (collection, key, object, stop) in
|
||||||
firstMessage = object as? TSMessage
|
firstMessage = object as? TSMessage
|
||||||
|
@ -35,10 +36,10 @@ public class FriendRequestExpireMessageFinder : NSObject {
|
||||||
var messageIds = [String]()
|
var messageIds = [String]()
|
||||||
let now = NSDate.ows_millisecondTimeStamp()
|
let now = NSDate.ows_millisecondTimeStamp()
|
||||||
|
|
||||||
let query = "WHERE \(FriendRequestExpireMessageFinder.friendRequestExpireColumn) > 0 AND \(FriendRequestExpireMessageFinder.friendRequestExpireColumn) <= \(now)"
|
let query = "WHERE \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) > 0 AND \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) <= \(now)"
|
||||||
// When (friendRequestExpiresAt == 0) then the friend request SHOULD NOT be set to expired
|
// When (friendRequestExpiresAt == 0) then the friend request SHOULD NOT be set to expired
|
||||||
let dbQuery = YapDatabaseQuery(string: query, parameters: [])
|
let dbQuery = YapDatabaseQuery(string: query, parameters: [])
|
||||||
if let ext = transaction.ext(FriendRequestExpireMessageFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction {
|
if let ext = transaction.ext(FriendRequestExpirationMessageFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction {
|
||||||
ext.enumerateKeys(matching: dbQuery) { (_, key, _) in
|
ext.enumerateKeys(matching: dbQuery) { (_, key, _) in
|
||||||
messageIds.append(key)
|
messageIds.append(key)
|
||||||
}
|
}
|
||||||
|
@ -49,9 +50,9 @@ public class FriendRequestExpireMessageFinder : NSObject {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: YapDatabaseExtension
|
// MARK: Database Extension
|
||||||
|
|
||||||
public extension FriendRequestExpireMessageFinder {
|
public extension FriendRequestExpirationMessageFinder {
|
||||||
|
|
||||||
@objc public static var indexDatabaseExtension: YapDatabaseSecondaryIndex {
|
@objc public static var indexDatabaseExtension: YapDatabaseSecondaryIndex {
|
||||||
let setup = YapDatabaseSecondaryIndexSetup()
|
let setup = YapDatabaseSecondaryIndexSetup()
|
|
@ -3,10 +3,10 @@
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
NS_SWIFT_NAME(EphemeralMessage)
|
NS_SWIFT_NAME(EphemeralMessage)
|
||||||
@interface OWSEphemeralMessage : TSOutgoingMessage
|
@interface LKEphemeralMessage : TSOutgoingMessage
|
||||||
|
|
||||||
/// Used to establish sessions.
|
/// Used to establish sessions.
|
||||||
+ (OWSEphemeralMessage *)createEmptyOutgoingMessageInThread:(TSThread *)thread;
|
+ (LKEphemeralMessage *)createEmptyOutgoingMessageInThread:(TSThread *)thread;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
13
SignalServiceKit/src/Loki/Messages/LKEphemeralMessage.m
Normal file
13
SignalServiceKit/src/Loki/Messages/LKEphemeralMessage.m
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#import "LKEphemeralMessage.h"
|
||||||
|
#import <SignalCoreKit/NSDate+OWS.h>
|
||||||
|
|
||||||
|
@implementation LKEphemeralMessage
|
||||||
|
|
||||||
|
+ (LKEphemeralMessage *)createEmptyOutgoingMessageInThread:(TSThread *)thread {
|
||||||
|
return [[LKEphemeralMessage alloc] initOutgoingMessageWithTimestamp:NSDate.ows_millisecondTimeStamp inThread:thread messageBody:@"" attachmentIds:[NSMutableArray<NSString *> new]
|
||||||
|
expiresInSeconds:0 expireStartedAt:0 isVoiceMessage:NO groupMetaMessage:TSGroupMetaMessageUnspecified quotedMessage:nil contactShare:nil linkPreview:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)shouldBeSaved { return NO; }
|
||||||
|
|
||||||
|
@end
|
|
@ -3,7 +3,7 @@
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
NS_SWIFT_NAME(FriendRequestMessage)
|
NS_SWIFT_NAME(FriendRequestMessage)
|
||||||
@interface OWSFriendRequestMessage : TSOutgoingMessage
|
@interface LKFriendRequestMessage : TSOutgoingMessage
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#import "OWSFriendRequestMessage.h"
|
#import "LKFriendRequestMessage.h"
|
||||||
#import "OWSPrimaryStorage+Loki.h"
|
#import "OWSPrimaryStorage+Loki.h"
|
||||||
#import "SignalRecipient.h"
|
#import "SignalRecipient.h"
|
||||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||||
|
|
||||||
@implementation OWSFriendRequestMessage
|
@implementation LKFriendRequestMessage
|
||||||
|
|
||||||
-(BOOL)isFriendRequest { return YES; }
|
-(BOOL)isFriendRequest { return YES; }
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#import "OWSEphemeralMessage.h"
|
|
||||||
#import <SignalCoreKit/NSDate+OWS.h>
|
|
||||||
|
|
||||||
@implementation OWSEphemeralMessage
|
|
||||||
|
|
||||||
+ (OWSEphemeralMessage *)createEmptyOutgoingMessageInThread:(TSThread *)thread {
|
|
||||||
return [[OWSEphemeralMessage alloc] initOutgoingMessageWithTimestamp:NSDate.ows_millisecondTimeStamp inThread:thread messageBody:@"" attachmentIds:[NSMutableArray<NSString *> new]
|
|
||||||
expiresInSeconds:0 expireStartedAt:0 isVoiceMessage:NO groupMetaMessage:TSGroupMetaMessageUnspecified quotedMessage:nil contactShare:nil linkPreview:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)shouldBeSaved { return NO; }
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,4 +1,4 @@
|
||||||
#import "NSObject.h"
|
#import "NSObject+Casting.h"
|
||||||
|
|
||||||
@implementation NSObject (Casting)
|
@implementation NSObject (Casting)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#import "OWSDisappearingConfigurationUpdateInfoMessage.h"
|
#import "OWSDisappearingConfigurationUpdateInfoMessage.h"
|
||||||
#import "OWSDisappearingMessagesConfiguration.h"
|
#import "OWSDisappearingMessagesConfiguration.h"
|
||||||
#import "OWSDisappearingMessagesJob.h"
|
#import "OWSDisappearingMessagesJob.h"
|
||||||
#import "OWSEphemeralMessage.h"
|
#import "LKEphemeralMessage.h"
|
||||||
#import "OWSIdentityManager.h"
|
#import "OWSIdentityManager.h"
|
||||||
#import "OWSIncomingMessageFinder.h"
|
#import "OWSIncomingMessageFinder.h"
|
||||||
#import "OWSIncomingSentMessageTranscript.h"
|
#import "OWSIncomingSentMessageTranscript.h"
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
#import "TSQuotedMessage.h"
|
#import "TSQuotedMessage.h"
|
||||||
#import <SignalCoreKit/Cryptography.h>
|
#import <SignalCoreKit/Cryptography.h>
|
||||||
#import <SignalCoreKit/NSDate+OWS.h>
|
#import <SignalCoreKit/NSDate+OWS.h>
|
||||||
#import <SignalServiceKit/NSObject.h>
|
#import <SignalServiceKit/NSObject+Casting.h>
|
||||||
#import <SignalServiceKit/SignalRecipient.h>
|
#import <SignalServiceKit/SignalRecipient.h>
|
||||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||||
#import <YapDatabase/YapDatabase.h>
|
#import <YapDatabase/YapDatabase.h>
|
||||||
|
@ -1022,10 +1022,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[thread saveWithTransaction:transaction];
|
[thread saveWithTransaction:transaction];
|
||||||
|
|
||||||
/// Loki: Send an empty message to trigger the session reset code for both parties
|
/// Loki: Send an empty message to trigger the session reset code for both parties
|
||||||
OWSEphemeralMessage *emptyMessage = [OWSEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
LKEphemeralMessage *emptyMessage = [LKEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
||||||
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
||||||
|
|
||||||
OWSLogDebug(@"[Loki] Session reset has been received from %@.", envelope.source);
|
OWSLogDebug(@"[Loki] Session reset received from %@.", envelope.source);
|
||||||
|
|
||||||
/* Loki: Original code
|
/* Loki: Original code
|
||||||
* ================
|
* ================
|
||||||
|
@ -1481,7 +1481,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[existingFriendRequestMessage saveFriendRequestStatus:TSMessageFriendRequestStatusAccepted withTransaction:transaction];
|
[existingFriendRequestMessage saveFriendRequestStatus:TSMessageFriendRequestStatusAccepted withTransaction:transaction];
|
||||||
}
|
}
|
||||||
// The two lines below are equivalent to calling [ThreadUtil enqueueAcceptFriendRequestMessageInThread:thread]
|
// The two lines below are equivalent to calling [ThreadUtil enqueueAcceptFriendRequestMessageInThread:thread]
|
||||||
OWSEphemeralMessage *emptyMessage = [OWSEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
LKEphemeralMessage *emptyMessage = [LKEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
||||||
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
||||||
} else if (!thread.isContactFriend) {
|
} else if (!thread.isContactFriend) {
|
||||||
// Checking that the sender of the message isn't already a friend is necessary because otherwise
|
// Checking that the sender of the message isn't already a friend is necessary because otherwise
|
||||||
|
@ -1707,13 +1707,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
TSContactThread *_Nullable thread = [TSContactThread getThreadWithContactId:pubKey transaction:transaction];
|
TSContactThread *_Nullable thread = [TSContactThread getThreadWithContactId:pubKey transaction:transaction];
|
||||||
if (!thread) {
|
if (!thread) {
|
||||||
OWSLogDebug(@"[Loki] New session was adopted but we failed to get the thread for %@.", pubKey);
|
OWSLogDebug(@"[Loki] A new session was adopted but we failed to get the thread for %@.", pubKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we were the ones to initiate the reset then we need to send back an empty message
|
// If we were the ones to initiate the reset then we need to send back an empty message
|
||||||
if (thread.sessionResetState == TSContactThreadSessionResetStateInitiated) {
|
if (thread.sessionResetState == TSContactThreadSessionResetStateInitiated) {
|
||||||
OWSEphemeralMessage *emptyMessage = [OWSEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
LKEphemeralMessage *emptyMessage = [LKEphemeralMessage createEmptyOutgoingMessageInThread:thread];
|
||||||
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#import "TSRequest.h"
|
#import "TSRequest.h"
|
||||||
#import "TSSocketManager.h"
|
#import "TSSocketManager.h"
|
||||||
#import "TSThread.h"
|
#import "TSThread.h"
|
||||||
#import "OWSFriendRequestMessage.h"
|
#import "LKFriendRequestMessage.h"
|
||||||
#import <AxolotlKit/AxolotlExceptions.h>
|
#import <AxolotlKit/AxolotlExceptions.h>
|
||||||
#import <AxolotlKit/CipherMessage.h>
|
#import <AxolotlKit/CipherMessage.h>
|
||||||
#import <AxolotlKit/PreKeyBundle.h>
|
#import <AxolotlKit/PreKeyBundle.h>
|
||||||
|
@ -1573,7 +1573,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
||||||
|
|
||||||
// A friend request means we don't have a session with the person
|
// A friend request means we don't have a session with the person
|
||||||
// There's no point to check for it
|
// There's no point to check for it
|
||||||
Boolean isFriendRequest = [messageSend.message isKindOfClass:OWSFriendRequestMessage.class];
|
Boolean isFriendRequest = [messageSend.message isKindOfClass:LKFriendRequestMessage.class];
|
||||||
if (!isFriendRequest) {
|
if (!isFriendRequest) {
|
||||||
[self throws_ensureRecipientHasSessionForMessageSend:messageSend deviceId:deviceId];
|
[self throws_ensureRecipientHasSessionForMessageSend:messageSend deviceId:deviceId];
|
||||||
}
|
}
|
||||||
|
@ -1818,7 +1818,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
||||||
OWSAssertDebug(recipientId.length > 0);
|
OWSAssertDebug(recipientId.length > 0);
|
||||||
|
|
||||||
// Loki: Handle friend requests differently
|
// Loki: Handle friend requests differently
|
||||||
Boolean isFriendRequest = [messageSend.message isKindOfClass:OWSFriendRequestMessage.class];
|
Boolean isFriendRequest = [messageSend.message isKindOfClass:LKFriendRequestMessage.class];
|
||||||
if (isFriendRequest) {
|
if (isFriendRequest) {
|
||||||
return [self throws_encryptedFriendMessageForMessageSend:messageSend deviceId:deviceId plainText:plainText];
|
return [self throws_encryptedFriendMessageForMessageSend:messageSend deviceId:deviceId plainText:plainText];
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
@class YapDatabaseConnection;
|
@class YapDatabaseConnection;
|
||||||
|
|
||||||
// Loki
|
// Loki
|
||||||
@class OWSLokiFriendRequestExpireJob;
|
@class LKFriendRequestExpirationJob;
|
||||||
|
|
||||||
@protocol ContactsManagerProtocol;
|
@protocol ContactsManagerProtocol;
|
||||||
@protocol NotificationsProtocol;
|
@protocol NotificationsProtocol;
|
||||||
|
@ -115,8 +115,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
@property (atomic, readonly) YapDatabaseConnection *analyticsDBConnection;
|
@property (atomic, readonly) YapDatabaseConnection *analyticsDBConnection;
|
||||||
|
|
||||||
// Loki
|
// Loki
|
||||||
@property (nonatomic, readonly) OWSLokiFriendRequestExpireJob *lokiFriendRequestExpireJob;
|
@property (nonatomic, readonly) LKFriendRequestExpirationJob *lokiFriendRequestExpireJob;
|
||||||
- (void)setLokiFriendRequestExpireJob:(OWSLokiFriendRequestExpireJob *)lokiFriendRequestExpireJob;
|
- (void)setLokiFriendRequestExpireJob:(LKFriendRequestExpirationJob *)lokiFriendRequestExpireJob;
|
||||||
|
|
||||||
- (BOOL)isComplete;
|
- (BOOL)isComplete;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
||||||
@property (nonatomic) OWSAttachmentDownloads *attachmentDownloads;
|
@property (nonatomic) OWSAttachmentDownloads *attachmentDownloads;
|
||||||
|
|
||||||
// Loki
|
// Loki
|
||||||
@property (nonatomic) OWSLokiFriendRequestExpireJob *lokiFriendRequestExpireJob;
|
@property (nonatomic) LKFriendRequestExpirationJob *lokiFriendRequestExpireJob;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ static SSKEnvironment *sharedSSKEnvironment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setLokiFriendRequestExpireJob:(OWSLokiFriendRequestExpireJob *)lokiFriendRequestExpireJob {
|
- (void)setLokiFriendRequestExpireJob:(LKFriendRequestExpirationJob *)lokiFriendRequestExpireJob {
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
OWSAssertDebug(lokiFriendRequestExpireJob);
|
OWSAssertDebug(lokiFriendRequestExpireJob);
|
||||||
OWSAssertDebug(!_lokiFriendRequestExpireJob);
|
OWSAssertDebug(!_lokiFriendRequestExpireJob);
|
||||||
|
|
|
@ -215,7 +215,7 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
|
||||||
[TSDatabaseView asyncRegisterLazyRestoreAttachmentsDatabaseView:self];
|
[TSDatabaseView asyncRegisterLazyRestoreAttachmentsDatabaseView:self];
|
||||||
[SSKJobRecordFinder asyncRegisterDatabaseExtensionObjCWithStorage:self];
|
[SSKJobRecordFinder asyncRegisterDatabaseExtensionObjCWithStorage:self];
|
||||||
|
|
||||||
[OWSLokiFriendRequestExpireMessageFinder asyncRegisterDatabaseExtensions:self];
|
[LKFriendRequestExpirationMessageFinder asyncRegisterDatabaseExtensions:self];
|
||||||
|
|
||||||
[self.database
|
[self.database
|
||||||
flushExtensionRequestsWithCompletionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
|
flushExtensionRequestsWithCompletionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
|
||||||
|
|
|
@ -12,7 +12,7 @@ static const NSUInteger ddLogLevel = DDLogLevelAll;
|
||||||
static const NSUInteger ddLogLevel = DDLogLevelInfo;
|
static const NSUInteger ddLogLevel = DDLogLevelInfo;
|
||||||
#endif
|
#endif
|
||||||
#import "OWSAnalytics.h"
|
#import "OWSAnalytics.h"
|
||||||
#import "NSObject.h"
|
#import "NSObject+Casting.h"
|
||||||
#import "SSKAsserts.h"
|
#import "SSKAsserts.h"
|
||||||
#import "TSConstants.h"
|
#import "TSConstants.h"
|
||||||
#import <SignalCoreKit/NSObject+OWS.h>
|
#import <SignalCoreKit/NSObject+OWS.h>
|
||||||
|
|
Loading…
Reference in a new issue