diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 787c07f3f..65b1a294c 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -111,7 +111,6 @@ 7B1D74B027C365960030B423 /* Timer+MainThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D74AF27C365960030B423 /* Timer+MainThread.swift */; }; 7B2561C22978B307005C086C /* MediaInfoVC+MediaInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2561C12978B307005C086C /* MediaInfoVC+MediaInfoView.swift */; }; 7B2561C429874851005C086C /* SessionCarouselView+Info.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2561C329874851005C086C /* SessionCarouselView+Info.swift */; }; - 7B2E985829AC227C001792D7 /* UIContextualAction+Theming.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2E985729AC227C001792D7 /* UIContextualAction+Theming.swift */; }; 7B3A392E2977791E002FE4AC /* MediaInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3A392D2977791E002FE4AC /* MediaInfoVC.swift */; }; 7B3A3930297A3919002FE4AC /* MediaInfoVC+MediaPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3A392F297A3919002FE4AC /* MediaInfoVC+MediaPreviewView.swift */; }; 7B3A39322980D02B002FE4AC /* SessionCarouselView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3A39312980D02B002FE4AC /* SessionCarouselView.swift */; }; @@ -816,15 +815,15 @@ FDD250702837199200198BDA /* GarbageCollectionJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD2506F2837199200198BDA /* GarbageCollectionJob.swift */; }; FDD250722837234B00198BDA /* MediaGalleryNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD250712837234B00198BDA /* MediaGalleryNavigationController.swift */; }; FDDC08F229A300E800BF9681 /* LibSessionTypeConversionUtilitiesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDDC08F129A300E800BF9681 /* LibSessionTypeConversionUtilitiesSpec.swift */; }; - FDDF074429C3E3D000E5E8B5 /* FetchRequest+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDDF074329C3E3D000E5E8B5 /* FetchRequest+Utilities.swift */; }; - FDE658A129418C7900A33BC1 /* CryptoKit+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDE658A029418C7900A33BC1 /* CryptoKit+Utilities.swift */; }; - FDE658A329418E2F00A33BC1 /* KeyPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDE658A229418E2F00A33BC1 /* KeyPair.swift */; }; FDDCBDA829E776BF00303C38 /* seed2-2023-2y.crt in Resources */ = {isa = PBXBuildFile; fileRef = FDDCBDA229E776BF00303C38 /* seed2-2023-2y.crt */; }; FDDCBDA929E776BF00303C38 /* seed1-2023-2y.crt in Resources */ = {isa = PBXBuildFile; fileRef = FDDCBDA329E776BF00303C38 /* seed1-2023-2y.crt */; }; FDDCBDAA29E776BF00303C38 /* seed1-2023-2y.der in Resources */ = {isa = PBXBuildFile; fileRef = FDDCBDA429E776BF00303C38 /* seed1-2023-2y.der */; }; FDDCBDAB29E776BF00303C38 /* seed2-2023-2y.der in Resources */ = {isa = PBXBuildFile; fileRef = FDDCBDA529E776BF00303C38 /* seed2-2023-2y.der */; }; FDDCBDAC29E776BF00303C38 /* seed3-2023-2y.crt in Resources */ = {isa = PBXBuildFile; fileRef = FDDCBDA629E776BF00303C38 /* seed3-2023-2y.crt */; }; FDDCBDAD29E776BF00303C38 /* seed3-2023-2y.der in Resources */ = {isa = PBXBuildFile; fileRef = FDDCBDA729E776BF00303C38 /* seed3-2023-2y.der */; }; + FDDF074429C3E3D000E5E8B5 /* FetchRequest+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDDF074329C3E3D000E5E8B5 /* FetchRequest+Utilities.swift */; }; + FDE658A129418C7900A33BC1 /* CryptoKit+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDE658A029418C7900A33BC1 /* CryptoKit+Utilities.swift */; }; + FDE658A329418E2F00A33BC1 /* KeyPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDE658A229418E2F00A33BC1 /* KeyPair.swift */; }; FDE77F6B280FEB28002CFC5D /* ControlMessageProcessRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDE77F6A280FEB28002CFC5D /* ControlMessageProcessRecord.swift */; }; FDED2E3C282E1B5D00B2CD2A /* UICollectionView+ReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDED2E3B282E1B5D00B2CD2A /* UICollectionView+ReusableView.swift */; }; FDF0B73C27FFD3D6004C14C5 /* LinkPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDF0B73B27FFD3D6004C14C5 /* LinkPreview.swift */; }; @@ -1955,15 +1954,15 @@ FDD2506F2837199200198BDA /* GarbageCollectionJob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GarbageCollectionJob.swift; sourceTree = ""; }; FDD250712837234B00198BDA /* MediaGalleryNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaGalleryNavigationController.swift; sourceTree = ""; }; FDDC08F129A300E800BF9681 /* LibSessionTypeConversionUtilitiesSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibSessionTypeConversionUtilitiesSpec.swift; sourceTree = ""; }; - FDDF074329C3E3D000E5E8B5 /* FetchRequest+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FetchRequest+Utilities.swift"; sourceTree = ""; }; - FDE658A029418C7900A33BC1 /* CryptoKit+Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CryptoKit+Utilities.swift"; sourceTree = ""; }; - FDE658A229418E2F00A33BC1 /* KeyPair.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyPair.swift; sourceTree = ""; }; FDDCBDA229E776BF00303C38 /* seed2-2023-2y.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "seed2-2023-2y.crt"; sourceTree = ""; }; FDDCBDA329E776BF00303C38 /* seed1-2023-2y.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "seed1-2023-2y.crt"; sourceTree = ""; }; FDDCBDA429E776BF00303C38 /* seed1-2023-2y.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "seed1-2023-2y.der"; sourceTree = ""; }; FDDCBDA529E776BF00303C38 /* seed2-2023-2y.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "seed2-2023-2y.der"; sourceTree = ""; }; FDDCBDA629E776BF00303C38 /* seed3-2023-2y.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "seed3-2023-2y.crt"; sourceTree = ""; }; FDDCBDA729E776BF00303C38 /* seed3-2023-2y.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "seed3-2023-2y.der"; sourceTree = ""; }; + FDDF074329C3E3D000E5E8B5 /* FetchRequest+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FetchRequest+Utilities.swift"; sourceTree = ""; }; + FDE658A029418C7900A33BC1 /* CryptoKit+Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CryptoKit+Utilities.swift"; sourceTree = ""; }; + FDE658A229418E2F00A33BC1 /* KeyPair.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyPair.swift; sourceTree = ""; }; FDE7214F287E50D50093DF33 /* ProtoWrappers.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = ProtoWrappers.py; sourceTree = ""; }; FDE72150287E50D50093DF33 /* LintLocalizableStrings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LintLocalizableStrings.swift; sourceTree = ""; }; FDE77F68280F9EDA002CFC5D /* JobRunnerError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JobRunnerError.swift; sourceTree = ""; }; @@ -5946,7 +5945,6 @@ C3548F0624456447009433A8 /* PNModeVC.swift in Sources */, FD71164828E2CE8700B47552 /* SessionCell+AccessoryView.swift in Sources */, B80A579F23DFF1F300876683 /* NewClosedGroupVC.swift in Sources */, - FD71163A28E2C53700B47552 /* SessionAvatarCell.swift in Sources */, 7B3A392E2977791E002FE4AC /* MediaInfoVC.swift in Sources */, 7BA68909272A27BE00EFC32F /* SessionCall.swift in Sources */, B835247925C38D880089A44F /* MessageCell.swift in Sources */, diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index 69c695b0b..d4a0c78f0 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -142,7 +142,7 @@ final class ConversationTitleView: UIView { guard Date().timeIntervalSince1970 > (mutedUntilTimestamp ?? 0) else { subtitleLabel?.attributedText = NSAttributedString( - string: "\u{e067} ", + string: FullConversationCell.mutePrefix, attributes: [ .font: UIFont.ows_elegantIconsFont(10), .foregroundColor: textPrimary diff --git a/Session/Home/HomeViewModel.swift b/Session/Home/HomeViewModel.swift index 8abcec895..eb641d25c 100644 --- a/Session/Home/HomeViewModel.swift +++ b/Session/Home/HomeViewModel.swift @@ -265,7 +265,7 @@ public class HomeViewModel { /// **MUST** have the same logic as in the 'PagedDataObserver.onChangeUnsorted' above let currentData: [SectionModel] = (self.unobservedThreadDataChanges?.0 ?? self.threadData) let updatedThreadData: [SectionModel] = self.process( - data: currentData.flatMap { $0.elements }, + data: (currentData.first(where: { $0.model == .threads })?.elements ?? []), for: currentPageInfo ) @@ -335,7 +335,10 @@ public class HomeViewModel { SectionModel( section: .threads, elements: data - .filter { $0.id != SessionThreadViewModel.invalidId } + .filter { threadViewModel in + threadViewModel.id != SessionThreadViewModel.invalidId && + threadViewModel.id != SessionThreadViewModel.messageRequestsSectionId + } .sorted { lhs, rhs -> Bool in guard lhs.threadPinnedPriority == rhs.threadPinnedPriority else { return lhs.threadPinnedPriority > rhs.threadPinnedPriority diff --git a/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift b/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift index 6ee71df52..9727b5b96 100644 --- a/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift +++ b/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift @@ -35,9 +35,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect var activityIndicator: UIActivityIndicatorView? var hasSelectedCell: Bool = false var imageInfos = [GiphyImageInfo]() - - var reachability: Reachability? - + private let kCellReuseIdentifier = "kCellReuseIdentifier" var progressiveSearchTimer: Timer? @@ -115,7 +113,6 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect createViews() - reachability = Environment.shared?.reachabilityManager.reachability NotificationCenter.default.addObserver( self, selector: #selector(reachabilityChanged), diff --git a/Session/Shared/FullConversationCell.swift b/Session/Shared/FullConversationCell.swift index ecdf6b34e..1a0bf371f 100644 --- a/Session/Shared/FullConversationCell.swift +++ b/Session/Shared/FullConversationCell.swift @@ -6,6 +6,7 @@ import SignalUtilitiesKit import SessionMessagingKit public final class FullConversationCell: UITableViewCell, SwipeActionOptimisticCell { + public static let mutePrefix: String = "\u{e067} " public static let unreadCountViewSize: CGFloat = 20 private static let statusIndicatorSize: CGFloat = 14 @@ -486,12 +487,26 @@ public final class FullConversationCell: UITableViewCell, SwipeActionOptimisticC isPinned: Bool?, hasUnread: Bool? ) { - // TODO: Decide on this + // Note: This will result in the snippet being out of sync while the swipe action animation completes, + // this means if the day/night mode changes while the animation is happening then the below optimistic + // update might get reset (this should be rare and is a relatively minor bug so can be left in) if let isMuted: Bool = isMuted { - if isMuted { - - } else { - + let attrString: NSAttributedString = (self.snippetLabel.attributedText ?? NSAttributedString()) + let hasMutePrefix: Bool = attrString.string.starts(with: FullConversationCell.mutePrefix) + + switch (isMuted, hasMutePrefix) { + case (true, false): + self.snippetLabel.attributedText = NSAttributedString( + string: FullConversationCell.mutePrefix, + attributes: [ .font: UIFont.ows_elegantIconsFont(10) ] + ) + .appending(attrString) + + case (false, true): + self.snippetLabel.attributedText = attrString + .attributedSubstring(from: NSRange(location: FullConversationCell.mutePrefix.count, length: (attrString.length - FullConversationCell.mutePrefix.count))) + + default: break } } @@ -536,7 +551,7 @@ public final class FullConversationCell: UITableViewCell, SwipeActionOptimisticC if Date().timeIntervalSince1970 < (cellViewModel.threadMutedUntilTimestamp ?? 0) { result.append(NSAttributedString( - string: "\u{e067} ", + string: FullConversationCell.mutePrefix, attributes: [ .font: UIFont.ows_elegantIconsFont(10), .foregroundColor: textColor diff --git a/SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+ClosedGroups.swift b/SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+ClosedGroups.swift index d363078b0..a6722a847 100644 --- a/SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+ClosedGroups.swift +++ b/SessionMessagingKit/Sending & Receiving/Message Handling/MessageSender+ClosedGroups.swift @@ -223,23 +223,23 @@ extension MessageSender { /// Store it **after** having sent out the message to the group Storage.shared.write { db in try newKeyPair.insert(db) + + // Update libSession + try? SessionUtil.update( + db, + groupPublicKey: closedGroup.threadId, + latestKeyPair: newKeyPair, + members: allGroupMembers + .filter { $0.role == .standard || $0.role == .zombie } + .map { $0.profileId } + .asSet(), + admins: allGroupMembers + .filter { $0.role == .admin } + .map { $0.profileId } + .asSet() + ) } - // Update libSession - try? SessionUtil.update( - db, - groupPublicKey: closedGroup.threadId, - latestKeyPair: newKeyPair, - members: allGroupMembers - .filter { $0.role == .standard || $0.role == .zombie } - .map { $0.profileId } - .asSet(), - admins: allGroupMembers - .filter { $0.role == .admin } - .map { $0.profileId } - .asSet() - ) - distributingKeyPairs.mutate { if let index = ($0[closedGroup.id] ?? []).firstIndex(of: newKeyPair) { $0[closedGroup.id] = ($0[closedGroup.id] ?? []) diff --git a/SignalUtilitiesKit/Utilities/ReachabilityManager.swift b/SignalUtilitiesKit/Utilities/ReachabilityManager.swift index cafa683ec..c9b884db8 100644 --- a/SignalUtilitiesKit/Utilities/ReachabilityManager.swift +++ b/SignalUtilitiesKit/Utilities/ReachabilityManager.swift @@ -4,6 +4,8 @@ import Foundation import Reachability import SignalCoreKit +/// **Warning:** The simulator doesn't detect reachability correctly so if you are seeing odd/incorrect reachability states double +/// check on an actual device before trying to replace this implementation @objc public class SSKReachabilityManagerImpl: NSObject, SSKReachabilityManager {