Browse Source

Merge pull request #635 from oxen-io/dev

1.13.0
master 1.13.0
RyanZhao 2 months ago committed by GitHub
parent
commit
4bda6da2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      Session.xcodeproj/project.pbxproj
  2. 26
      Session/Utilities/BackgroundPoller.swift
  3. 27
      SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift

24
Session.xcodeproj/project.pbxproj

@ -5185,7 +5185,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 346;
CURRENT_PROJECT_VERSION = 348;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@ -5210,7 +5210,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.12.9;
MARKETING_VERSION = 1.13.0;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -5258,7 +5258,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 346;
CURRENT_PROJECT_VERSION = 348;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = SUQ8J2PCT7;
ENABLE_NS_ASSERTIONS = NO;
@ -5288,7 +5288,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.12.9;
MARKETING_VERSION = 1.13.0;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -5324,7 +5324,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 346;
CURRENT_PROJECT_VERSION = 348;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@ -5347,7 +5347,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.12.9;
MARKETING_VERSION = 1.13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
@ -5398,7 +5398,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 346;
CURRENT_PROJECT_VERSION = 348;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = SUQ8J2PCT7;
ENABLE_NS_ASSERTIONS = NO;
@ -5426,7 +5426,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.12.9;
MARKETING_VERSION = 1.13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
@ -6334,7 +6334,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 346;
CURRENT_PROJECT_VERSION = 348;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -6374,7 +6374,7 @@
"$(SRCROOT)",
);
LLVM_LTO = NO;
MARKETING_VERSION = 1.12.9;
MARKETING_VERSION = 1.13.0;
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
@ -6407,7 +6407,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 346;
CURRENT_PROJECT_VERSION = 348;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -6447,7 +6447,7 @@
"$(SRCROOT)",
);
LLVM_LTO = NO;
MARKETING_VERSION = 1.12.9;
MARKETING_VERSION = 1.13.0;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
PRODUCT_NAME = Session;

26
Session/Utilities/BackgroundPoller.swift

@ -66,19 +66,21 @@ public final class BackgroundPoller : NSObject {
return SnodeAPI.getSwarm(for: publicKey).then(on: DispatchQueue.main) { swarm -> Promise<Void> in
guard let snode = swarm.randomElement() else { throw SnodeAPI.Error.generic }
return attempt(maxRetryCount: 4, recoveringOn: DispatchQueue.main) {
var promises: [SnodeAPI.RawResponsePromise] = []
var namespaces: [Int] = []
// We have to poll for both namespace 0 and -10 when hardfork == 19 && softfork == 0
if SnodeAPI.hardfork <= 19, SnodeAPI.softfork == 0 {
let promise = SnodeAPI.getRawClosedGroupMessagesFromDefaultNamespace(from: snode, associatedWith: publicKey)
promises.append(promise)
namespaces.append(SnodeAPI.defaultNamespace)
}
if SnodeAPI.hardfork >= 19 && SnodeAPI.softfork >= 0 {
let promise = SnodeAPI.getRawMessages(from: snode, associatedWith: publicKey, authenticated: false)
promises.append(promise)
namespaces.append(SnodeAPI.closedGroupNamespace)
}
let promises: [SnodeAPI.RawResponsePromise] = {
if SnodeAPI.hardfork >= 19 && SnodeAPI.softfork >= 1 {
namespaces = [ SnodeAPI.closedGroupNamespace ]
return [ SnodeAPI.getRawMessages(from: snode, associatedWith: publicKey, authenticated: false) ]
}
if SnodeAPI.hardfork >= 19 {
namespaces = [ SnodeAPI.defaultNamespace, SnodeAPI.closedGroupNamespace ]
return [ SnodeAPI.getRawClosedGroupMessagesFromDefaultNamespace(from: snode, associatedWith: publicKey),
SnodeAPI.getRawMessages(from: snode, associatedWith: publicKey, authenticated: false)]
}
namespaces = [ SnodeAPI.defaultNamespace ]
return [ SnodeAPI.getRawClosedGroupMessagesFromDefaultNamespace(from: snode, associatedWith: publicKey) ]
}()
return when(resolved: promises).then(on: DispatchQueue.main) { results -> Promise<Void> in
var promises: [Promise<Void>] = []
var index = 0

27
SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift

@ -61,7 +61,16 @@ public final class ClosedGroupPoller : NSObject {
// MARK: Private API
private func setUpPolling(for groupPublicKey: String) {
Threading.pollerQueue.async {
self.poll(groupPublicKey).done(on: Threading.pollerQueue) { [weak self] _ in
let promises: [Promise<Void>] = {
if SnodeAPI.hardfork >= 19 && SnodeAPI.softfork >= 1 {
return [ self.poll(groupPublicKey) ]
}
if SnodeAPI.hardfork >= 19 {
return [ self.poll(groupPublicKey, defaultInbox: true), self.poll(groupPublicKey) ]
}
return [ self.poll(groupPublicKey, defaultInbox: true) ]
}()
when(resolved: promises).done(on: Threading.pollerQueue) { [weak self] _ in
self?.pollRecursively(groupPublicKey)
}.catch(on: Threading.pollerQueue) { [weak self] error in
// The error is logged in poll(_:)
@ -87,13 +96,15 @@ public final class ClosedGroupPoller : NSObject {
timers[groupPublicKey] = Timer.scheduledTimerOnMainThread(withTimeInterval: nextPollInterval, repeats: false) { [weak self] timer in
timer.invalidate()
Threading.pollerQueue.async {
var promises: [Promise<Void>] = []
if SnodeAPI.hardfork <= 19, SnodeAPI.softfork == 0, let promise = self?.poll(groupPublicKey, defaultInbox: true) {
promises.append(promise)
}
if SnodeAPI.hardfork >= 19, SnodeAPI.softfork >= 0,let promise = self?.poll(groupPublicKey) {
promises.append(promise)
}
let promises: [Promise<Void>] = {
if SnodeAPI.hardfork >= 19 && SnodeAPI.softfork >= 1 {
return [ self?.poll(groupPublicKey) ].compactMap{ $0 }
}
if SnodeAPI.hardfork >= 19 {
return [ self?.poll(groupPublicKey, defaultInbox: true), self?.poll(groupPublicKey) ].compactMap{ $0 }
}
return [ self?.poll(groupPublicKey, defaultInbox: true) ].compactMap{ $0 }
}()
when(resolved: promises).done(on: Threading.pollerQueue) { _ in
self?.pollRecursively(groupPublicKey)
}.catch(on: Threading.pollerQueue) { error in

Loading…
Cancel
Save