From f51651ce8ea039a4cecf1fdf34d95b4c280aa382 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Tue, 5 Oct 2021 15:09:11 +1100 Subject: [PATCH 1/3] minor fix on conversation ordering --- SessionMessagingKit/Database/TSDatabaseView.m | 14 ++++++++++++-- SessionMessagingKit/Threads/TSThread.m | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/SessionMessagingKit/Database/TSDatabaseView.m b/SessionMessagingKit/Database/TSDatabaseView.m index 42be55700..4668aeb44 100644 --- a/SessionMessagingKit/Database/TSDatabaseView.m +++ b/SessionMessagingKit/Database/TSDatabaseView.m @@ -278,8 +278,18 @@ NSString *const TSLazyRestoreAttachmentsGroup = @"TSLazyRestoreAttachmentsGroup" TSThread *thread1 = (TSThread *)object1; TSThread *thread2 = (TSThread *)object2; if ([group isEqualToString:TSArchiveGroup] || [group isEqualToString:TSInboxGroup]) { - NSDate *date1 = thread1.lastInteractionDate ?: thread1.creationDate; - NSDate *date2 = thread2.lastInteractionDate ?: thread2.creationDate; + + TSInteraction *_Nullable lastInteractionForInbox1 = + [thread1 lastInteractionForInboxWithTransaction:transaction]; + NSDate *lastInteractionForInboxDate1 = lastInteractionForInbox1 ? lastInteractionForInbox1.receivedAtDate : thread1.creationDate; + + TSInteraction *_Nullable lastInteractionForInbox2 = + [thread2 lastInteractionForInboxWithTransaction:transaction]; + NSDate *lastInteractionForInboxDate2 = lastInteractionForInbox2 ? lastInteractionForInbox2.receivedAtDate : thread2.creationDate; + + + NSDate *date1 = thread1.lastInteractionDate ?: lastInteractionForInboxDate1 ?: thread1.creationDate; + NSDate *date2 = thread2.lastInteractionDate ?: lastInteractionForInboxDate2 ?: thread2.creationDate; return [date1 compare:date2]; } diff --git a/SessionMessagingKit/Threads/TSThread.m b/SessionMessagingKit/Threads/TSThread.m index 8d4b81770..943709c2a 100644 --- a/SessionMessagingKit/Threads/TSThread.m +++ b/SessionMessagingKit/Threads/TSThread.m @@ -357,7 +357,9 @@ BOOL IsNoteToSelfEnabled(void) return; } - _lastInteractionDate = lastMessage.receivedAtDate; + if ([_lastInteractionDate compare: lastMessage.receivedAtDate] == NSOrderedAscending) { + _lastInteractionDate = lastMessage.receivedAtDate; + } if (!self.shouldBeVisible) { self.shouldBeVisible = YES; From ccbc819cc407336b45b5ed590c7abbf4f704e121 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Tue, 5 Oct 2021 15:45:54 +1100 Subject: [PATCH 2/3] include more info in logs --- Session/Settings/ShareLogsModal.swift | 5 ++++- SessionUtilitiesKit/General/Logging.swift | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Session/Settings/ShareLogsModal.swift b/Session/Settings/ShareLogsModal.swift index 9e8408528..10f3f799e 100644 --- a/Session/Settings/ShareLogsModal.swift +++ b/Session/Settings/ShareLogsModal.swift @@ -57,8 +57,11 @@ final class ShareLogsModal : Modal { // MARK: Interaction @objc private func shareLogs() { + let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "" + OWSLogger.info("[Version] iOS \(UIDevice.current.systemVersion) \(version)") + DDLog.flushLog() let logFilePaths = AppEnvironment.shared.fileLogger.logFileManager.sortedLogFilePaths - if let latestLogFilePath = logFilePaths.last { + if let latestLogFilePath = logFilePaths.first { let latestLogFileURL = URL(fileURLWithPath: latestLogFilePath) self.dismiss(animated: true, completion: { AttachmentSharing.showShareUI(for: latestLogFileURL) diff --git a/SessionUtilitiesKit/General/Logging.swift b/SessionUtilitiesKit/General/Logging.swift index 7cccb8a25..e0c73a335 100644 --- a/SessionUtilitiesKit/General/Logging.swift +++ b/SessionUtilitiesKit/General/Logging.swift @@ -1,6 +1,8 @@ +import SignalCoreKit public func SNLog(_ message: String) { #if DEBUG print("[Session] \(message)") #endif + OWSLogger.info("[Session] \(message)") } From 36f3f83298fd98f9ba14df62963a1641b15e8215 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Tue, 5 Oct 2021 15:46:36 +1100 Subject: [PATCH 3/3] update build number --- Session.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 607e66d0b..43ac7ae36 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -5045,7 +5045,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 299; + CURRENT_PROJECT_VERSION = 300; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5118,7 +5118,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 299; + CURRENT_PROJECT_VERSION = 300; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -5184,7 +5184,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 299; + CURRENT_PROJECT_VERSION = 300; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5258,7 +5258,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 299; + CURRENT_PROJECT_VERSION = 300; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -6194,7 +6194,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 299; + CURRENT_PROJECT_VERSION = 300; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -6265,7 +6265,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 299; + CURRENT_PROJECT_VERSION = 300; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)",