Skip to content

Commit

Permalink
Merge pull request #353 from session-foundation/dev
Browse files Browse the repository at this point in the history
Release 2.8.5
  • Loading branch information
mpretty-cyro authored Jan 6, 2025
2 parents 94fce5e + 3a91bc5 commit fe9979d
Show file tree
Hide file tree
Showing 96 changed files with 1,759 additions and 1,516 deletions.
26 changes: 16 additions & 10 deletions Session.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@
7BC01A3E241F40AB00BC7C55 /* NotificationServiceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BC01A3D241F40AB00BC7C55 /* NotificationServiceExtension.swift */; };
7BC01A42241F40AB00BC7C55 /* SessionNotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 7BC01A3B241F40AB00BC7C55 /* SessionNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
7BC707F227290ACB002817AD /* SessionCallManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BC707F127290ACB002817AD /* SessionCallManager.swift */; };
7BD477A827EC39F5004E2822 /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD477A727EC39F5004E2822 /* Atomic.swift */; };
7BD687D12A5D0D1200D8E455 /* MessageInfoScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD687D02A5D0D1200D8E455 /* MessageInfoScreen.swift */; };
7BD976972A776C76001B466F /* SessionCarouselView+SwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BE2701D2A64C11500CEB71A /* SessionCarouselView+SwiftUI.swift */; };
7BDCFC08242186E700641C39 /* NotificationServiceExtensionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BDCFC07242186E700641C39 /* NotificationServiceExtensionContext.swift */; };
Expand Down Expand Up @@ -817,6 +816,9 @@
FD96F3A729DBD43D00401309 /* MockJobRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD96F3A629DBD43D00401309 /* MockJobRunner.swift */; };
FD97B2402A3FEB050027DD57 /* ARC4RandomNumberGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD97B23F2A3FEB050027DD57 /* ARC4RandomNumberGenerator.swift */; };
FD97B2422A3FEBF30027DD57 /* UnreadMarkerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD97B2412A3FEBF30027DD57 /* UnreadMarkerCell.swift */; };
FD99D0872D0FA731005D2E15 /* ThreadSafe.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD99D0862D0FA72E005D2E15 /* ThreadSafe.swift */; };
FD99D0902D10E71B005D2E15 /* NSCache+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD99D08F2D10E718005D2E15 /* NSCache+Utilities.swift */; };
FD99D0922D10F5EE005D2E15 /* ThreadSafeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD99D0912D10F5EB005D2E15 /* ThreadSafeSpec.swift */; };
FD9AECA52AAA9609009B3406 /* NotificationError.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9AECA42AAA9609009B3406 /* NotificationError.swift */; };
FD9B30F3293EA0BF008DEE3E /* BatchResponseSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9B30F2293EA0BF008DEE3E /* BatchResponseSpec.swift */; };
FD9BDE002A5D22B7005F1EBC /* libSessionUtil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD9BDDF82A5D2294005F1EBC /* libSessionUtil.a */; };
Expand Down Expand Up @@ -1358,7 +1360,6 @@
7BC01A3F241F40AB00BC7C55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7BC707F127290ACB002817AD /* SessionCallManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionCallManager.swift; sourceTree = "<group>"; };
7BCD116B27016062006330F1 /* WebRTCSession+DataChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WebRTCSession+DataChannel.swift"; sourceTree = "<group>"; };
7BD477A727EC39F5004E2822 /* Atomic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = "<group>"; };
7BD687D02A5D0D1200D8E455 /* MessageInfoScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageInfoScreen.swift; sourceTree = "<group>"; };
7BD687D22A5D283200D8E455 /* build_libSession_util.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = build_libSession_util.sh; sourceTree = "<group>"; };
7BDCFC0424206E7300641C39 /* SessionNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SessionNotificationServiceExtension.entitlements; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1945,6 +1946,9 @@
FD96F3A629DBD43D00401309 /* MockJobRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockJobRunner.swift; sourceTree = "<group>"; };
FD97B23F2A3FEB050027DD57 /* ARC4RandomNumberGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARC4RandomNumberGenerator.swift; sourceTree = "<group>"; };
FD97B2412A3FEBF30027DD57 /* UnreadMarkerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnreadMarkerCell.swift; sourceTree = "<group>"; };
FD99D0862D0FA72E005D2E15 /* ThreadSafe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadSafe.swift; sourceTree = "<group>"; };
FD99D08F2D10E718005D2E15 /* NSCache+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSCache+Utilities.swift"; sourceTree = "<group>"; };
FD99D0912D10F5EB005D2E15 /* ThreadSafeSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadSafeSpec.swift; sourceTree = "<group>"; };
FD9AECA42AAA9609009B3406 /* NotificationError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationError.swift; sourceTree = "<group>"; };
FD9B30F2293EA0BF008DEE3E /* BatchResponseSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatchResponseSpec.swift; sourceTree = "<group>"; };
FD9BDDF82A5D2294005F1EBC /* libSessionUtil.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSessionUtil.a; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -1994,7 +1998,6 @@
FDC4381F27B36ADC00C60D73 /* SOGSEndpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SOGSEndpoint.swift; sourceTree = "<group>"; };
FDC4382E27B383AF00C60D73 /* LegacyPushServerResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyPushServerResponse.swift; sourceTree = "<group>"; };
FDC4383727B3863200C60D73 /* AppVersionResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppVersionResponse.swift; sourceTree = "<group>"; };
FDC4383D27B4708600C60D73 /* Atomic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = "<group>"; };
FDC4385C27B4C18900C60D73 /* Room.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Room.swift; sourceTree = "<group>"; };
FDC4385E27B4C4A200C60D73 /* PinnedMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedMessage.swift; sourceTree = "<group>"; };
FDC4386227B4D94E00C60D73 /* SOGSMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SOGSMessage.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2704,11 +2707,9 @@
children = (
947AD68F2C8968FF000B2730 /* Constants.swift */,
FD428B182B4B576F006D0888 /* AppContext.swift */,
7BD477A727EC39F5004E2822 /* Atomic.swift */,
FDC438CC27BC641200C60D73 /* Set+Utilities.swift */,
7BAF54D527ACD0E2003D12F8 /* ReusableView.swift */,
C3C2A5D12553860800C340D1 /* Array+Utilities.swift */,
FDC4383D27B4708600C60D73 /* Atomic.swift */,
C33FDAA8255A57FF00E217F9 /* BuildConfiguration.swift */,
B8F5F58225EC94A6003BF8D4 /* Collection+Utilities.swift */,
FD23CE2F2A67B8820000B97C /* Caches.swift */,
Expand All @@ -2720,6 +2721,7 @@
B8BC00BF257D90E30032E807 /* General.swift */,
C3C2A5CE2553860700C340D1 /* Logging.swift */,
C33FDAFD255A580600E217F9 /* LRUCache.swift */,
FD99D08F2D10E718005D2E15 /* NSCache+Utilities.swift */,
C33FDA7A255A57FB00E217F9 /* NSRegularExpression+SSK.swift */,
C352A3762557859C00338F3E /* NSTimer+Proxying.h */,
C352A36C2557858D00338F3E /* NSTimer+Proxying.m */,
Expand Down Expand Up @@ -3648,6 +3650,7 @@
FDF222082818D2B0000A4995 /* NSAttributedString+Utilities.swift */,
FDC0F0032BFECE12002CBFB9 /* TimeUnit.swift */,
FD8ECF912938552800C0D1BB /* Threading.swift */,
FD99D0862D0FA72E005D2E15 /* ThreadSafe.swift */,
FD8ECF93293856AF00C0D1BB /* Randomness.swift */,
FD1936402ACA7BD8004BCF0F /* Result+Utilities.swift */,
FD29598C2A43BC0B00888A17 /* Version.swift */,
Expand Down Expand Up @@ -4566,6 +4569,7 @@
FDFBB7532A2023EB00CA7350 /* BencodeDecoderSpec.swift */,
FD6A391C2C2A99DF00762359 /* BencodeEncoderSpec.swift */,
FD6A391E2C2A99EF00762359 /* BencodeResponseSpec.swift */,
FD99D0912D10F5EB005D2E15 /* ThreadSafeSpec.swift */,
FD29598F2A43BE5F00888A17 /* VersionSpec.swift */,
);
path = Utilities;
Expand Down Expand Up @@ -5811,6 +5815,7 @@
FD6A38F72C2A6C0100762359 /* CryptoError.swift in Sources */,
FDE658A329418E2F00A33BC1 /* KeyPair.swift in Sources */,
FD5931AB2A8DCB0A0040147D /* ScopeAdapter+Utilities.swift in Sources */,
FD99D0872D0FA731005D2E15 /* ThreadSafe.swift in Sources */,
FD37E9FF28A5F2CD003AE748 /* Configuration.swift in Sources */,
FDB7400B28EB99A70094D718 /* TimeInterval+Utilities.swift in Sources */,
FD09797D27FBDB2000936362 /* Notification+Utilities.swift in Sources */,
Expand Down Expand Up @@ -5839,7 +5844,6 @@
C32C5DDB256DD9FF003C73A2 /* ContentProxy.swift in Sources */,
C3A71F892558BA9F0043A11F /* Mnemonic.swift in Sources */,
B8F5F58325EC94A6003BF8D4 /* Collection+Utilities.swift in Sources */,
7BD477A827EC39F5004E2822 /* Atomic.swift in Sources */,
FD7F748A2BB298A8006DDFD8 /* JSONDecoder+Utilities.swift in Sources */,
B8BC00C0257D90E30032E807 /* General.swift in Sources */,
FD7F74782BB27742006DDFD8 /* BatchRequest.swift in Sources */,
Expand Down Expand Up @@ -5874,6 +5878,7 @@
FD7115FC28C8155800B47552 /* Publisher+Utilities.swift in Sources */,
FD6A39042C2A8C0300762359 /* CGFloat+Utilities.swift in Sources */,
C32C5A48256DB8F0003C73A2 /* BuildConfiguration.swift in Sources */,
FD99D0902D10E71B005D2E15 /* NSCache+Utilities.swift in Sources */,
FDF84881294059F5007DCAE5 /* ResponseInfo.swift in Sources */,
FD17D7BF27F51F8200122BE0 /* ColumnExpressible.swift in Sources */,
FD6A39282C2AB2AA00762359 /* CGSize+Utilities.swift in Sources */,
Expand Down Expand Up @@ -6386,6 +6391,7 @@
buildActionMask = 2147483647;
files = (
FD2AAAF228ED57B500A49611 /* SynchronousStorage.swift in Sources */,
FD99D0922D10F5EE005D2E15 /* ThreadSafeSpec.swift in Sources */,
FD078E4927E02576000769AF /* CommonMockedExtensions.swift in Sources */,
FD83B9BF27CF2294005E1583 /* TestConstants.swift in Sources */,
FDFBB7542A2023EB00CA7350 /* BencodeDecoderSpec.swift in Sources */,
Expand Down Expand Up @@ -7677,7 +7683,7 @@
CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 517;
CURRENT_PROJECT_VERSION = 519;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -7714,7 +7720,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.8.4;
MARKETING_VERSION = 2.8.5;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-fobjc-arc-exceptions",
Expand Down Expand Up @@ -7756,7 +7762,7 @@
CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 517;
CURRENT_PROJECT_VERSION = 519;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -7788,7 +7794,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.8.4;
MARKETING_VERSION = 2.8.5;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = (
"-DNS_BLOCK_ASSERTIONS=1",
Expand Down
8 changes: 8 additions & 0 deletions Session/Calls/Call Management/SessionCallManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public final class SessionCallManager: NSObject, CallManagerProtocol {
}

public func reportIncomingCall(_ call: CurrentCallProtocol, callerName: String, completion: @escaping (Error?) -> Void) {
// If CallKit isn't supported then we don't have anything to report the call to
guard Preferences.isCallKitSupported else {
UserDefaults.sharedLokiProject?[.isCallOngoing] = true
UserDefaults.sharedLokiProject?[.lastCallPreOffer] = Date()
completion(nil)
return
}

// Construct a CXCallUpdate describing the incoming call, including the caller.
let update = CXCallUpdate()
update.localizedCallerName = callerName
Expand Down
11 changes: 6 additions & 5 deletions Session/Calls/Views & Modals/IncomingCallBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {

private func setUpViewHierarchy() {
self.clipsToBounds = true
self.layer.cornerRadius = Values.largeSpacing
self.set(.height, to: 100)
self.layer.cornerRadius = 16
self.set(.height, to: 80)

addSubview(backgroundView)
backgroundView.pin(to: self)
Expand All @@ -125,8 +125,8 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {
stackView.spacing = Values.largeSpacing
self.addSubview(stackView)

stackView.center(.vertical, in: self)
stackView.set(.width, to: .width, of: self, withOffset: Values.mediumSpacing)
stackView.center(in: self)
stackView.set(.width, to: .width, of: self, withOffset: -Values.mediumSpacing)
}

private func setUpGestureRecognizers() {
Expand Down Expand Up @@ -222,8 +222,9 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {
window.addSubview(self)

let topMargin = window.safeAreaInsets.top - Values.smallSpacing
self.set(.width, to: .width, of: window, withOffset: Values.smallSpacing)
self.set(.width, to: .width, of: window, withOffset: -Values.smallSpacing)
self.pin(.top, to: .top, of: window, withInset: topMargin)
self.center(.horizontal, in: window)

UIView.animate(withDuration: 0.5, delay: 0, options: [], animations: {
self.alpha = 1.0
Expand Down
13 changes: 6 additions & 7 deletions Session/Calls/WebRTC/WebRTCSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,9 @@ public final class WebRTCSession : NSObject, RTCPeerConnectionDelegate {
SNLog("[Calls] Sending offer message.")
let uuid: String = self.uuid
let mediaConstraints: RTCMediaConstraints = mediaConstraints(isRestartingICEConnection)
let dependencies: Dependencies = self.dependencies

return Deferred {
Future<Void, Error> { [weak self] resolver in
Future<Void, Error> { [weak self, dependencies = self.dependencies] resolver in
self?.peerConnection?.offer(for: mediaConstraints) { sdp, error in
guard error == nil else { return }

Expand Down Expand Up @@ -221,7 +220,6 @@ public final class WebRTCSession : NSObject, RTCPeerConnectionDelegate {
SNLog("[Calls] Sending answer message.")
let uuid: String = self.uuid
let mediaConstraints: RTCMediaConstraints = mediaConstraints(false)
let dependencies: Dependencies = self.dependencies

return dependencies.storage
.readPublisher { db -> SessionThread in
Expand All @@ -231,7 +229,7 @@ public final class WebRTCSession : NSObject, RTCPeerConnectionDelegate {

return thread
}
.flatMap { [weak self] thread in
.flatMap { [weak self, dependencies = self.dependencies] thread in
Future<Void, Error> { resolver in
self?.peerConnection?.answer(for: mediaConstraints) { [weak self] sdp, error in
if let error = error {
Expand Down Expand Up @@ -303,13 +301,12 @@ public final class WebRTCSession : NSObject, RTCPeerConnectionDelegate {
let candidates: [RTCIceCandidate] = self.queuedICECandidates
let uuid: String = self.uuid
let contactSessionId: String = self.contactSessionId
let dependencies: Dependencies = self.dependencies

// Empty the queue
self.queuedICECandidates.removeAll()

dependencies.storage
.writePublisher { db in
.writePublisher { [dependencies = self.dependencies] db in
guard let thread: SessionThread = try SessionThread.fetchOne(db, id: contactSessionId) else {
throw WebRTCSessionError.noThread
}
Expand Down Expand Up @@ -341,7 +338,9 @@ public final class WebRTCSession : NSObject, RTCPeerConnectionDelegate {
)
}
.subscribe(on: DispatchQueue.global(qos: .userInitiated))
.flatMap { MessageSender.sendImmediate(data: $0, using: dependencies) }
.flatMap { [dependencies = self.dependencies] sendData in
MessageSender.sendImmediate(data: sendData, using: dependencies)
}
.sinkUntilComplete()
}

Expand Down
22 changes: 12 additions & 10 deletions Session/Conversations/ConversationSearch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ protocol SearchResultsBarDelegate: AnyObject {
}

public final class SearchResultsBar: UIView {
private var readConnection: Atomic<Database?> = Atomic(nil)
private var results: Atomic<[Interaction.TimestampInfo]?> = Atomic(nil)
@ThreadSafe private var hasResults: Bool = false
@ThreadSafeObject private var results: [Interaction.TimestampInfo] = []
@ThreadSafeObject private var readConnection: Database? = nil

var currentIndex: Int?
weak var resultsBarDelegate: SearchResultsBarDelegate?
Expand Down Expand Up @@ -250,7 +251,7 @@ public final class SearchResultsBar: UIView {
// MARK: - Actions

@objc public func handleUpButtonTapped() {
guard let results: [Interaction.TimestampInfo] = results.wrappedValue else { return }
guard hasResults else { return }
guard let currentIndex: Int = currentIndex else { return }
guard currentIndex + 1 < results.count else { return }

Expand All @@ -261,7 +262,7 @@ public final class SearchResultsBar: UIView {
}

@objc public func handleDownButtonTapped() {
guard let results: [Interaction.TimestampInfo] = results.wrappedValue else { return }
guard hasResults else { return }
guard let currentIndex: Int = currentIndex, currentIndex > 0 else { return }

let newIndex = currentIndex - 1
Expand All @@ -274,7 +275,7 @@ public final class SearchResultsBar: UIView {

/// This method will be called within a DB read block
func willStartSearching(readConnection: Database) {
let hasNoExistingResults: Bool = (self.results.wrappedValue?.isEmpty != false)
let hasNoExistingResults: Bool = hasResults

DispatchQueue.main.async { [weak self] in
if hasNoExistingResults {
Expand All @@ -284,8 +285,8 @@ public final class SearchResultsBar: UIView {
self?.startLoading()
}

self.readConnection.wrappedValue?.interrupt()
self.readConnection.mutate { $0 = readConnection }
self.readConnection?.interrupt()
self._readConnection.set(to: readConnection)
}

func updateResults(results: [Interaction.TimestampInfo]?, visibleItemIds: [Int64]?) {
Expand All @@ -308,8 +309,9 @@ public final class SearchResultsBar: UIView {
return 0
}()

self.readConnection.mutate { $0 = nil }
self.results.mutate { $0 = results }
self._readConnection.set(to: nil)
self._results.performUpdate { _ in (results ?? []) }
self.hasResults = (results != nil)

updateBarItems()

Expand All @@ -319,7 +321,7 @@ public final class SearchResultsBar: UIView {
}

func updateBarItems() {
guard let results: [Interaction.TimestampInfo] = results.wrappedValue else {
guard hasResults else {
label.text = ""
downButton.isEnabled = false
upButton.isEnabled = false
Expand Down
Loading

0 comments on commit fe9979d

Please sign in to comment.