mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'dev'
This commit is contained in:
commit
cde644e693
4 changed files with 40 additions and 38 deletions
|
@ -5142,7 +5142,7 @@
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 248;
|
CURRENT_PROJECT_VERSION = 249;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||||
|
@ -5163,7 +5163,7 @@
|
||||||
INFOPLIST_FILE = SessionShareExtension/Meta/Info.plist;
|
INFOPLIST_FILE = SessionShareExtension/Meta/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 1.11.1;
|
MARKETING_VERSION = 1.11.2;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
@ -5211,7 +5211,7 @@
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 248;
|
CURRENT_PROJECT_VERSION = 249;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
@ -5237,7 +5237,7 @@
|
||||||
INFOPLIST_FILE = SessionShareExtension/Meta/Info.plist;
|
INFOPLIST_FILE = SessionShareExtension/Meta/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 1.11.1;
|
MARKETING_VERSION = 1.11.2;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
@ -5272,7 +5272,7 @@
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 248;
|
CURRENT_PROJECT_VERSION = 249;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||||
|
@ -5291,7 +5291,7 @@
|
||||||
INFOPLIST_FILE = SessionNotificationServiceExtension/Meta/Info.plist;
|
INFOPLIST_FILE = SessionNotificationServiceExtension/Meta/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 1.11.1;
|
MARKETING_VERSION = 1.11.2;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
|
||||||
|
@ -5342,7 +5342,7 @@
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 248;
|
CURRENT_PROJECT_VERSION = 249;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
@ -5366,7 +5366,7 @@
|
||||||
INFOPLIST_FILE = SessionNotificationServiceExtension/Meta/Info.plist;
|
INFOPLIST_FILE = SessionNotificationServiceExtension/Meta/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 1.11.1;
|
MARKETING_VERSION = 1.11.2;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
|
||||||
|
@ -6227,7 +6227,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CURRENT_PROJECT_VERSION = 248;
|
CURRENT_PROJECT_VERSION = 249;
|
||||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -6263,7 +6263,7 @@
|
||||||
"$(SRCROOT)",
|
"$(SRCROOT)",
|
||||||
);
|
);
|
||||||
LLVM_LTO = NO;
|
LLVM_LTO = NO;
|
||||||
MARKETING_VERSION = 1.11.1;
|
MARKETING_VERSION = 1.11.2;
|
||||||
OTHER_LDFLAGS = "$(inherited)";
|
OTHER_LDFLAGS = "$(inherited)";
|
||||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
|
||||||
|
@ -6295,7 +6295,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CURRENT_PROJECT_VERSION = 248;
|
CURRENT_PROJECT_VERSION = 249;
|
||||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -6331,7 +6331,7 @@
|
||||||
"$(SRCROOT)",
|
"$(SRCROOT)",
|
||||||
);
|
);
|
||||||
LLVM_LTO = NO;
|
LLVM_LTO = NO;
|
||||||
MARKETING_VERSION = 1.11.1;
|
MARKETING_VERSION = 1.11.2;
|
||||||
OTHER_LDFLAGS = "$(inherited)";
|
OTHER_LDFLAGS = "$(inherited)";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
|
||||||
PRODUCT_NAME = Session;
|
PRODUCT_NAME = Session;
|
||||||
|
|
|
@ -13,12 +13,6 @@ public final class BackgroundPoller : NSObject {
|
||||||
promises = []
|
promises = []
|
||||||
promises.append(pollForMessages())
|
promises.append(pollForMessages())
|
||||||
promises.append(contentsOf: pollForClosedGroupMessages())
|
promises.append(contentsOf: pollForClosedGroupMessages())
|
||||||
let openGroups: [String:OpenGroup] = Storage.shared.getAllUserOpenGroups()
|
|
||||||
openGroups.values.forEach { openGroup in
|
|
||||||
let poller = OpenGroupPoller(for: openGroup)
|
|
||||||
poller.stop()
|
|
||||||
promises.append(poller.pollForNewMessages(isBackgroundPoll: true))
|
|
||||||
}
|
|
||||||
let v2OpenGroupServers = Set(Storage.shared.getAllV2OpenGroups().values.map { $0.server })
|
let v2OpenGroupServers = Set(Storage.shared.getAllV2OpenGroups().values.map { $0.server })
|
||||||
v2OpenGroupServers.forEach { server in
|
v2OpenGroupServers.forEach { server in
|
||||||
let poller = OpenGroupPollerV2(for: server)
|
let poller = OpenGroupPollerV2(for: server)
|
||||||
|
@ -27,7 +21,8 @@ public final class BackgroundPoller : NSObject {
|
||||||
}
|
}
|
||||||
when(resolved: promises).done { _ in
|
when(resolved: promises).done { _ in
|
||||||
completionHandler(.newData)
|
completionHandler(.newData)
|
||||||
}.catch { _ in
|
}.catch { error in
|
||||||
|
SNLog("Background poll failed due to error: \(error)")
|
||||||
completionHandler(.failed)
|
completionHandler(.failed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +38,9 @@ public final class BackgroundPoller : NSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func getMessages(for publicKey: String) -> Promise<Void> {
|
private static func getMessages(for publicKey: String) -> Promise<Void> {
|
||||||
return SnodeAPI.getSwarm(for: publicKey).then2 { swarm -> Promise<Void> in
|
return SnodeAPI.getSwarm(for: publicKey).then(on: DispatchQueue.main) { swarm -> Promise<Void> in
|
||||||
guard let snode = swarm.randomElement() else { throw SnodeAPI.Error.generic }
|
guard let snode = swarm.randomElement() else { throw SnodeAPI.Error.generic }
|
||||||
|
return attempt(maxRetryCount: 4, recoveringOn: DispatchQueue.main) {
|
||||||
return SnodeAPI.getRawMessages(from: snode, associatedWith: publicKey).then(on: DispatchQueue.main) { rawResponse -> Promise<Void> in
|
return SnodeAPI.getRawMessages(from: snode, associatedWith: publicKey).then(on: DispatchQueue.main) { rawResponse -> Promise<Void> in
|
||||||
let messages = SnodeAPI.parseRawMessagesResponse(rawResponse, from: snode, associatedWith: publicKey)
|
let messages = SnodeAPI.parseRawMessagesResponse(rawResponse, from: snode, associatedWith: publicKey)
|
||||||
let promises = messages.compactMap { json -> Promise<Void>? in
|
let promises = messages.compactMap { json -> Promise<Void>? in
|
||||||
|
@ -59,4 +55,5 @@ public final class BackgroundPoller : NSObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
|
||||||
_dbReadWriteConnection = [self newDatabaseConnection];
|
_dbReadWriteConnection = [self newDatabaseConnection];
|
||||||
_uiDatabaseConnection = [self newDatabaseConnection];
|
_uiDatabaseConnection = [self newDatabaseConnection];
|
||||||
|
|
||||||
// Vacuum the database
|
|
||||||
[self.dbReadWriteConnection vacuum];
|
|
||||||
|
|
||||||
// Increase object cache limit. Default is 250.
|
// Increase object cache limit. Default is 250.
|
||||||
_uiDatabaseConnection.objectCacheLimit = 500;
|
_uiDatabaseConnection.objectCacheLimit = 500;
|
||||||
[_uiDatabaseConnection beginLongLivedReadTransaction];
|
[_uiDatabaseConnection beginLongLivedReadTransaction];
|
||||||
|
|
|
@ -54,11 +54,6 @@ public enum MessageReceiver {
|
||||||
// Parse the envelope
|
// Parse the envelope
|
||||||
let envelope = try SNProtoEnvelope.parseData(data)
|
let envelope = try SNProtoEnvelope.parseData(data)
|
||||||
let storage = SNMessagingKitConfiguration.shared.storage
|
let storage = SNMessagingKitConfiguration.shared.storage
|
||||||
// If the message failed to process the first time around we retry it later (if the error is retryable). In this case the timestamp
|
|
||||||
// will already be in the database but we don't want to treat the message as a duplicate. The isRetry flag is a simple workaround
|
|
||||||
// for this issue.
|
|
||||||
guard !Set(storage.getReceivedMessageTimestamps(using: transaction)).contains(envelope.timestamp) || isRetry else { throw Error.duplicateMessage }
|
|
||||||
storage.addReceivedMessageTimestamp(envelope.timestamp, using: transaction)
|
|
||||||
// Decrypt the contents
|
// Decrypt the contents
|
||||||
guard let ciphertext = envelope.content else { throw Error.noData }
|
guard let ciphertext = envelope.content else { throw Error.noData }
|
||||||
var plaintext: Data!
|
var plaintext: Data!
|
||||||
|
@ -159,6 +154,19 @@ public enum MessageReceiver {
|
||||||
guard isValid else {
|
guard isValid else {
|
||||||
throw Error.invalidMessage
|
throw Error.invalidMessage
|
||||||
}
|
}
|
||||||
|
// If the message failed to process the first time around we retry it later (if the error is retryable). In this case the timestamp
|
||||||
|
// will already be in the database but we don't want to treat the message as a duplicate. The isRetry flag is a simple workaround
|
||||||
|
// for this issue.
|
||||||
|
if let message = message as? ClosedGroupControlMessage, case .new = message.kind {
|
||||||
|
// Allow duplicates in this case to avoid the following situation:
|
||||||
|
// • The app performed a background poll or received a push notification
|
||||||
|
// • This method was invoked and the received message timestamps table was updated
|
||||||
|
// • Processing wasn't finished
|
||||||
|
// • The user doesn't see the new closed group
|
||||||
|
} else {
|
||||||
|
guard !Set(storage.getReceivedMessageTimestamps(using: transaction)).contains(envelope.timestamp) || isRetry else { throw Error.duplicateMessage }
|
||||||
|
storage.addReceivedMessageTimestamp(envelope.timestamp, using: transaction)
|
||||||
|
}
|
||||||
// Return
|
// Return
|
||||||
return (message, proto)
|
return (message, proto)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue