From 066e6cc29096168f81a29cc3408063b2d3ed69e4 Mon Sep 17 00:00:00 2001 From: Eugene Bistolas Date: Fri, 3 Dec 2021 12:47:52 -1000 Subject: [PATCH 01/30] [Badging] Show expiry sheet on homescreen for expired boost --- .../SubscriptionViewController.swift | 2 +- .../HomeView/HomeViewController.swift | 82 +++++++++++++------ 2 files changed, 57 insertions(+), 27 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift b/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift index e42b65318a..a90b27a683 100644 --- a/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift +++ b/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift @@ -274,7 +274,7 @@ class SubscriptionViewController: OWSTableViewController2 { } let expiredBadgeID = SubscriptionManager.mostRecentlyExpiredBadgeIDWithSneakyTransaction() - guard let expiredBadgeID = expiredBadgeID else { + guard let expiredBadgeID = expiredBadgeID, expiredBadgeID != "BOOST" else { return } diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.swift b/Signal/src/ViewControllers/HomeView/HomeViewController.swift index 1177e0317c..6e0e6018fb 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.swift +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.swift @@ -59,7 +59,7 @@ public extension HomeViewController { } let expiredBadgeID = SubscriptionManager.mostRecentlyExpiredBadgeIDWithSneakyTransaction() - guard let expiredBadgeID = expiredBadgeID, expiredBadgeID != "BOOST" else { // TODO Add boost support + guard let expiredBadgeID = expiredBadgeID else { return } @@ -71,35 +71,61 @@ public extension HomeViewController { return } - // Fetch current subscriptions, required to populate badge assets - firstly { - SubscriptionManager.getSubscriptions() - }.done(on: .global()) { (subscriptions: [SubscriptionLevel]) in - for level in subscriptions { - if level.badge.id == expiredBadgeID { - // Fetch assets - firstly { - self.profileManager.badgeStore.populateAssetsOnBadge(level.badge) - }.done(on: .main) { + if expiredBadgeID == "BOOST" { + firstly { + SubscriptionManager.getBoostBadge() + }.done(on: .global()) { boostBadge in + firstly { + self.profileManager.badgeStore.populateAssetsOnBadge(boostBadge) + }.done(on: .main) { - SDSDatabaseStorage.shared.write { transaction in - SubscriptionManager.setShowExpirySheetOnHomeScreenKey(show: false, transaction: transaction) - } - - let badgeSheet = BadgeExpirationSheet(badge: level.badge) - badgeSheet.delegate = self - self.present(badgeSheet, animated: true) - - }.catch { error in - owsFailDebug("Failed to fetch badge assets for expiry \(error)") + SDSDatabaseStorage.shared.write { transaction in + SubscriptionManager.setShowExpirySheetOnHomeScreenKey(show: false, transaction: transaction) } - break + let badgeSheet = BadgeExpirationSheet(badge: boostBadge) + badgeSheet.delegate = self + self.present(badgeSheet, animated: true) + + }.catch { error in + owsFailDebug("Failed to fetch boost badge assets for expiry \(error)") } + }.catch { error in + owsFailDebug("Failed to fetch boost badge for expiry \(error)") + } + + } else { + // Fetch current subscriptions, required to populate badge assets + firstly { + SubscriptionManager.getSubscriptions() + }.done(on: .global()) { (subscriptions: [SubscriptionLevel]) in + let subscriptionLevel = subscriptions.first { $0.badge.id == expiredBadgeID } + guard let subscriptionLevel = subscriptionLevel else { + owsFailDebug("Unable to find matching subscription level for expired badge") + return + } + + firstly { + self.profileManager.badgeStore.populateAssetsOnBadge(subscriptionLevel.badge) + }.done(on: .main) { + + SDSDatabaseStorage.shared.write { transaction in + SubscriptionManager.setShowExpirySheetOnHomeScreenKey(show: false, transaction: transaction) + } + + let badgeSheet = BadgeExpirationSheet(badge: subscriptionLevel.badge) + badgeSheet.delegate = self + self.present(badgeSheet, animated: true) + + }.catch { error in + owsFailDebug("Failed to fetch subscription badge assets for expiry \(error)") + } + + }.catch { error in + owsFailDebug("Failed to fetch subscriptions for expiry \(error)") } - }.catch { error in - owsFailDebug("Failed to fetch subscriptions for expiry \(error)") } + } // MARK: - @@ -369,8 +395,12 @@ public extension HomeViewController { extension HomeViewController: BadgeExpirationSheetDelegate { func badgeExpirationSheetActionButtonTapped(_ badgeExpirationSheet: BadgeExpirationSheet) { SubscriptionManager.clearMostRecentlyExpiredBadgeIDWithSneakyTransaction() - let mode: ShowAppSettingsMode = badgeExpirationSheet.badgeID == "BOOST" ? .boost : .subscriptions - showAppSettings(mode: mode) + switch (badgeID: badgeExpirationSheet.badgeID, isSustainer: SubscriptionManager.hasCurrentSubscriptionCached()) { + case (badgeID: "BOOST", isSustainer: true): + showAppSettings(mode: .boost) + default: + showAppSettings(mode: .subscriptions) + } } func badgeExpirationSheetNotNowButtonTapped(_ badgeExpirationSheet: BadgeExpirationSheet) { } From 5cef495eeaf371bfa63f1ef769e1af5a90f29d7d Mon Sep 17 00:00:00 2001 From: Eugene Bistolas Date: Fri, 3 Dec 2021 14:49:03 -1000 Subject: [PATCH 02/30] [Badging] Show blue disclosure next to subscription settings if expiry occured --- .../AppSettingsViewController.swift | 48 +++++++++++++++---- .../SubscriptionViewController.swift | 1 + 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.swift b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.swift index 93ac218dba..388bd71cfc 100644 --- a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.swift +++ b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.swift @@ -40,6 +40,13 @@ class AppSettingsViewController: OWSTableViewController2 { name: .localNumberDidChange, object: nil ) + + NotificationCenter.default.addObserver( + self, + selector: #selector(subscriptionStateDidChange), + name: SubscriptionManager.SubscriptionJobQueueDidFinishJobNotification, + object: nil + ) } @objc @@ -61,6 +68,13 @@ class AppSettingsViewController: OWSTableViewController2 { updateTableContents() } + @objc + func subscriptionStateDidChange() { + AssertIsOnMainThread() + + updateTableContents() + } + override func themeDidChange() { super.themeDidChange() updateTableContents() @@ -70,6 +84,10 @@ class AppSettingsViewController: OWSTableViewController2 { return SubscriptionManager.hasCurrentSubscriptionCached() }() + private lazy var hasExpiredSubscription: Bool = { + return SubscriptionManager.mostRecentlyExpiredBadgeIDWithSneakyTransaction() != nil + }() + func updateTableContents() { let contents = OWSTableContents() @@ -253,15 +271,29 @@ class AppSettingsViewController: OWSTableViewController2 { )) if RemoteConfig.donorBadgeAcquisition { if DonationUtilities.isApplePayAvailable { - section4.add(.disclosureItem( - icon: .settingsDonate, - name: self.hasCurrentSubscription ? NSLocalizedString("SETTINGS_CURRENT_SUBSCRIPTION", comment: "Title for the 'Subscription' link in settings.") : NSLocalizedString("SETTINGS_SUBSCRIPTION", comment: "Title for the 'become a sustainer' link in settings."), - accessibilityIdentifier: UIView.accessibilityIdentifier(in: self, name: "sustainer"), - actionBlock: { [weak self] in - let vc = SubscriptionViewController() - self?.navigationController?.pushViewController(vc, animated: true) + section4.add(.init(customCellBlock: { [weak self] in + guard let self = self else { return UITableViewCell() } + let cell = OWSTableItem.buildCellWithAccessoryLabel( + icon: .settingsDonate, + itemName: self.hasCurrentSubscription ? NSLocalizedString("SETTINGS_CURRENT_SUBSCRIPTION", comment: "Title for the 'Subscription' link in settings.") : NSLocalizedString("SETTINGS_SUBSCRIPTION", comment: "Title for the 'become a sustainer' link in settings."), + accessoryType: .disclosureIndicator, + accessibilityIdentifier: UIView.accessibilityIdentifier(in: self, name: "sustainer")) + + if self.hasExpiredSubscription { + let imageView = UIImageView(image: UIImage(named: "info-solid-24")?.withRenderingMode(.alwaysTemplate)) + imageView.tintColor = Theme.accentBlueColor + cell.contentView.addSubview(imageView) + + imageView.autoSetDimensions(to: CGSize(square: 24)) + imageView.autoVCenterInSuperview() + imageView.autoPinEdge(.trailing, to: .trailing, of: cell.contentView, withOffset: -8) } - )) + + return cell + }, actionBlock: { [weak self] in + let vc = SubscriptionViewController() + self?.navigationController?.pushViewController(vc, animated: true) + })) section4.add(.disclosureItem( icon: .settingsBoost, diff --git a/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift b/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift index a90b27a683..f911ec3857 100644 --- a/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift +++ b/Signal/src/ViewControllers/AppSettings/SubscriptionViewController.swift @@ -1526,6 +1526,7 @@ private class SubscriptionReadMoreSheet: InteractiveSheetViewController { extension SubscriptionViewController: BadgeExpirationSheetDelegate { func badgeExpirationSheetActionButtonTapped(_ badgeExpirationSheet: BadgeExpirationSheet) { + SubscriptionManager.clearMostRecentlyExpiredBadgeIDWithSneakyTransaction() requestApplePayDonation() } From 445d30524fa4f789ca9a0e56dc73938aae45529c Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 11:55:06 -0800 Subject: [PATCH 03/30] Fixes a typo in PendingProfileUpdate decoding --- SignalMessaging/profiles/OWSProfileManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalMessaging/profiles/OWSProfileManager.swift b/SignalMessaging/profiles/OWSProfileManager.swift index 31b058e31c..dc775a69be 100644 --- a/SignalMessaging/profiles/OWSProfileManager.swift +++ b/SignalMessaging/profiles/OWSProfileManager.swift @@ -632,7 +632,7 @@ class PendingProfileUpdate: NSObject, NSCoding { self.profileBio = aDecoder.decodeObject(forKey: "profileBio") as? String self.profileBioEmoji = aDecoder.decodeObject(forKey: "profileBioEmoji") as? String self.profileAvatarData = aDecoder.decodeObject(forKey: "profileAvatarData") as? Data - self.visibleBadgeIds = aDecoder.decodeObject(forKey: "visiboleBadgeIds") as? [String] + self.visibleBadgeIds = aDecoder.decodeObject(forKey: "visibleBadgeIds") as? [String] self.unsavedRotatedProfileKey = aDecoder.decodeObject(forKey: "unsavedRotatedProfileKey") as? OWSAES256Key if aDecoder.containsValue(forKey: "userProfileWriter"), let userProfileWriter = UserProfileWriter(rawValue: UInt(aDecoder.decodeInt32(forKey: "userProfileWriter"))) { From 3d695404ab434c40963b241d676e0d11671599f6 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 11:56:46 -0800 Subject: [PATCH 04/30] VisibleBadgeIds is now nonnull on PendingProfileUpdate A nil array would clear badges anyway. This makes things a bit more explicit. Also improves some logging. --- .../DebugUI/DebugUIScreenshots.swift | 2 +- ...OnboardingProfileCreationViewController.swift | 2 +- SignalMessaging/profiles/OWSProfileManager.swift | 16 ++++++++-------- .../profiles/VersionedProfilesImpl.swift | 2 +- .../src/Network/API/Requests/OWSRequestFactory.h | 2 +- .../src/Network/API/Requests/OWSRequestFactory.m | 6 ++---- .../src/Util/Profiles/VersionedProfiles.swift | 4 ++-- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIScreenshots.swift b/Signal/src/ViewControllers/DebugUI/DebugUIScreenshots.swift index 38dabc0568..e595e49124 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIScreenshots.swift +++ b/Signal/src/ViewControllers/DebugUI/DebugUIScreenshots.swift @@ -1013,7 +1013,7 @@ public extension DebugUIScreenshots { profileBio: nil, profileBioEmoji: nil, profileAvatarData: avatarData, - visibleBadgeIds: nil, + visibleBadgeIds: [], userProfileWriter: .debugging ).asVoid() }.catch(on: .global()) { error in diff --git a/Signal/src/ViewControllers/Registration/OnboardingProfileCreationViewController.swift b/Signal/src/ViewControllers/Registration/OnboardingProfileCreationViewController.swift index 945a37c91d..03f88ae8aa 100644 --- a/Signal/src/ViewControllers/Registration/OnboardingProfileCreationViewController.swift +++ b/Signal/src/ViewControllers/Registration/OnboardingProfileCreationViewController.swift @@ -343,7 +343,7 @@ public class OnboardingProfileCreationViewController: OnboardingBaseViewControll profileBio: nil, profileBioEmoji: nil, profileAvatarData: avatarData, - visibleBadgeIds: nil, + visibleBadgeIds: [], userProfileWriter: .registration) }.recover { error in owsFailDebug("Error: \(error)") diff --git a/SignalMessaging/profiles/OWSProfileManager.swift b/SignalMessaging/profiles/OWSProfileManager.swift index dc775a69be..775f20a013 100644 --- a/SignalMessaging/profiles/OWSProfileManager.swift +++ b/SignalMessaging/profiles/OWSProfileManager.swift @@ -20,7 +20,7 @@ public extension OWSProfileManager { profileBio: String?, profileBioEmoji: String?, profileAvatarData: Data?, - visibleBadgeIds: [String]?, + visibleBadgeIds: [String], unsavedRotatedProfileKey: OWSAES256Key? = nil, userProfileWriter: UserProfileWriter) -> Promise { assert(CurrentAppContext().isMainApp) @@ -60,7 +60,7 @@ public extension OWSProfileManager { let profileBio: String? let profileBioEmoji: String? let profileAvatarData: Data? - let visibleBadgeIds: [String]? + let visibleBadgeIds: [String] let userProfileWriter: UserProfileWriter if let pendingUpdate = (Self.databaseStorage.read { transaction in return Self.currentPendingProfileUpdate(transaction: transaction) @@ -227,7 +227,7 @@ public extension OWSProfileManager { profileBio: String?, profileBioEmoji: String?, profileAvatarData: Data?, - visibleBadgeIds: [String]?, + visibleBadgeIds: [String], userProfileWriter: UserProfileWriter) -> AnyPromise { return AnyPromise(updateLocalProfilePromise( profileGivenName: profileGivenName, @@ -453,7 +453,7 @@ extension OWSProfileManager { "profileFamilyName?: \(attempt.update.profileFamilyName != nil), " + "profileBio?: \(attempt.update.profileBio != nil), " + "profileBioEmoji?: \(attempt.update.profileBioEmoji != nil) " + - "visibleBadges?: \(attempt.update.visibleBadgeIds != nil).") + "visibleBadges?: \(attempt.update.visibleBadgeIds.count).") return firstly(on: .global()) { Self.versionedProfilesImpl.updateProfilePromise(profileGivenName: attempt.update.profileGivenName, profileFamilyName: attempt.update.profileFamilyName, @@ -490,7 +490,7 @@ extension OWSProfileManager { profileBio: String?, profileBioEmoji: String?, profileAvatarData: Data?, - visibleBadgeIds: [String]?, + visibleBadgeIds: [String], unsavedRotatedProfileKey: OWSAES256Key?, userProfileWriter: UserProfileWriter) -> PendingProfileUpdate { Logger.verbose("") @@ -560,7 +560,7 @@ class PendingProfileUpdate: NSObject, NSCoding { // If nil, we are clearing the profile avatar. let profileAvatarData: Data? - let visibleBadgeIds: [String]? + let visibleBadgeIds: [String] let unsavedRotatedProfileKey: OWSAES256Key? @@ -585,7 +585,7 @@ class PendingProfileUpdate: NSObject, NSCoding { profileBio: String?, profileBioEmoji: String?, profileAvatarData: Data?, - visibleBadgeIds: [String]?, + visibleBadgeIds: [String], unsavedRotatedProfileKey: OWSAES256Key?, userProfileWriter: UserProfileWriter) { @@ -632,7 +632,7 @@ class PendingProfileUpdate: NSObject, NSCoding { self.profileBio = aDecoder.decodeObject(forKey: "profileBio") as? String self.profileBioEmoji = aDecoder.decodeObject(forKey: "profileBioEmoji") as? String self.profileAvatarData = aDecoder.decodeObject(forKey: "profileAvatarData") as? Data - self.visibleBadgeIds = aDecoder.decodeObject(forKey: "visibleBadgeIds") as? [String] + self.visibleBadgeIds = (aDecoder.decodeObject(forKey: "visibleBadgeIds") as? [String]) ?? [] self.unsavedRotatedProfileKey = aDecoder.decodeObject(forKey: "unsavedRotatedProfileKey") as? OWSAES256Key if aDecoder.containsValue(forKey: "userProfileWriter"), let userProfileWriter = UserProfileWriter(rawValue: UInt(aDecoder.decodeInt32(forKey: "userProfileWriter"))) { diff --git a/SignalMessaging/profiles/VersionedProfilesImpl.swift b/SignalMessaging/profiles/VersionedProfilesImpl.swift index 4d38a2d2df..70b56ac789 100644 --- a/SignalMessaging/profiles/VersionedProfilesImpl.swift +++ b/SignalMessaging/profiles/VersionedProfilesImpl.swift @@ -41,7 +41,7 @@ public class VersionedProfilesImpl: NSObject, VersionedProfilesSwift { profileBio: String?, profileBioEmoji: String?, profileAvatarData: Data?, - visibleBadgeIds: [String]?, + visibleBadgeIds: [String], unsavedRotatedProfileKey: OWSAES256Key?) -> Promise { firstly(on: .global()) { diff --git a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h index 0cce848d46..00481654d6 100644 --- a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h +++ b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h @@ -182,7 +182,7 @@ typedef NS_ENUM(NSUInteger, TSVerificationTransport) { TSVerificationTransportVo bioEmoji:(nullable ProfileValue *)bioEmoji hasAvatar:(BOOL)hasAvatar paymentAddress:(nullable ProfileValue *)paymentAddress - visibleBadgeIds:(nullable NSArray *)visibleBadgeIds + visibleBadgeIds:(NSArray *)visibleBadgeIds version:(NSString *)version commitment:(NSData *)commitment; diff --git a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m index ec5f3fbe36..f3f101278c 100644 --- a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m +++ b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m @@ -811,7 +811,7 @@ NSString *const OWSRequestKey_AuthKey = @"AuthKey"; bioEmoji:(nullable ProfileValue *)bioEmoji hasAvatar:(BOOL)hasAvatar paymentAddress:(nullable ProfileValue *)paymentAddress - visibleBadgeIds:(nullable NSArray *)visibleBadgeIds + visibleBadgeIds:(NSArray *)visibleBadgeIds version:(NSString *)version commitment:(NSData *)commitment { @@ -842,9 +842,7 @@ NSString *const OWSRequestKey_AuthKey = @"AuthKey"; OWSAssertDebug(paymentAddress.hasValidBase64Length); parameters[@"paymentAddress"] = paymentAddress.encryptedBase64; } - if (visibleBadgeIds != nil) { - parameters[@"badgeIds"] = visibleBadgeIds; - } + parameters[@"badgeIds"] = [visibleBadgeIds copy]; NSURL *url = [NSURL URLWithString:textSecureVersionedProfileAPI]; return [TSRequest requestWithUrl:url diff --git a/SignalServiceKit/src/Util/Profiles/VersionedProfiles.swift b/SignalServiceKit/src/Util/Profiles/VersionedProfiles.swift index dde9eb4261..ebc38a7d8d 100644 --- a/SignalServiceKit/src/Util/Profiles/VersionedProfiles.swift +++ b/SignalServiceKit/src/Util/Profiles/VersionedProfiles.swift @@ -49,7 +49,7 @@ public protocol VersionedProfilesSwift: VersionedProfiles { profileBio: String?, profileBioEmoji: String?, profileAvatarData: Data?, - visibleBadgeIds: [String]?, + visibleBadgeIds: [String], unsavedRotatedProfileKey: OWSAES256Key?) -> Promise } @@ -75,7 +75,7 @@ public class MockVersionedProfiles: NSObject, VersionedProfilesSwift { profileBio: String?, profileBioEmoji: String?, profileAvatarData: Data?, - visibleBadgeIds: [String]?, + visibleBadgeIds: [String], unsavedRotatedProfileKey: OWSAES256Key?) -> Promise { owsFail("Not implemented.") } From 5943d82d762b15eb6799067c675034d11ba6cffa Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 13:01:19 -0800 Subject: [PATCH 05/30] "Feature flags for .production." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index 6d2079d6ce..bb04d223a5 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .qa +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .production // MARK: - From 8f28feaa4ef0334dbb75fd28257f0a0ae2f33db3 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 13:01:29 -0800 Subject: [PATCH 06/30] "Bump build to 5.26.4.0." --- Signal/Signal-Info.plist | 6 +++--- SignalNSE/Info.plist | 6 +++--- SignalShareExtension/Info.plist | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 09af59a189..0c52fe988a 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -26,7 +26,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 5.26.3 + 5.26.4 CFBundleSignature ???? CFBundleURLTypes @@ -43,7 +43,7 @@ CFBundleVersion - 7 + 0 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.3.7 + 5.26.4.0 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index 7882590519..abf63ecbca 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 5.26.3 + 5.26.4 CFBundleVersion - 7 + 0 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.3.7 + 5.26.4.0 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 335d9b013d..849e275d92 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 5.26.3 + 5.26.4 CFBundleVersion - 7 + 0 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.3.7 + 5.26.4.0 UIAppFonts fontawesome-webfont.ttf From cef5b9e83eeb43b7bd63651d33b602148d653118 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 13:01:46 -0800 Subject: [PATCH 07/30] "Feature flags for .beta." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index bb04d223a5..1a2bfce6cd 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .production +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .beta // MARK: - From f2d2ccf3519ca68fdbaf1efca4e73017a8fdc74d Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 13:01:54 -0800 Subject: [PATCH 08/30] "Bump build to 5.26.4.1." (Beta) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 0c52fe988a..efe8f98524 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 0 + 1 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.4.0 + 5.26.4.1 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index abf63ecbca..9c661da5d4 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 0 + 1 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.4.0 + 5.26.4.1 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 849e275d92..ae0a2bad00 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 0 + 1 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.4.0 + 5.26.4.1 UIAppFonts fontawesome-webfont.ttf From 5245b9a0da52021474e3f5d909c4bbe968b7cc52 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 13:02:00 -0800 Subject: [PATCH 09/30] "Feature flags for .qa." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index 1a2bfce6cd..6d2079d6ce 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .beta +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .qa // MARK: - From c76f660d834457c52c95dba88ace593a11d22f8e Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 13:02:03 -0800 Subject: [PATCH 10/30] "Bump build to 5.26.4.2." (Internal) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index efe8f98524..db5c334ae5 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 1 + 2 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.4.1 + 5.26.4.2 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index 9c661da5d4..13e910bebd 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 1 + 2 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.4.1 + 5.26.4.2 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index ae0a2bad00..3af72606eb 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 1 + 2 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.4.1 + 5.26.4.2 UIAppFonts fontawesome-webfont.ttf From aa891fd0e0ca7b6251bb85a1959b34cdf4cb8e72 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 13:12:38 -0800 Subject: [PATCH 11/30] "Bump build to 5.27.0.35." (Internal) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index a1683626a3..fddd9919c4 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 34 + 35 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.27.0.34 + 5.27.0.35 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index fb32550175..020841cc54 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.27.0 CFBundleVersion - 34 + 35 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.27.0.34 + 5.27.0.35 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 225d381b83..937a3631a9 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.27.0 CFBundleVersion - 34 + 35 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.27.0.34 + 5.27.0.35 UIAppFonts fontawesome-webfont.ttf From 58acd876de19a83818e8027adc702c816775a364 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 15:13:06 -0800 Subject: [PATCH 12/30] Increment subscription megaphone flag --- SignalServiceKit/src/Util/RemoteConfigManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SignalServiceKit/src/Util/RemoteConfigManager.swift b/SignalServiceKit/src/Util/RemoteConfigManager.swift index bfcf5a1bc9..cf21b07b8b 100644 --- a/SignalServiceKit/src/Util/RemoteConfigManager.swift +++ b/SignalServiceKit/src/Util/RemoteConfigManager.swift @@ -22,7 +22,7 @@ public class RemoteConfig: BaseFlags { self.isEnabledFlags = isEnabledFlags self.valueFlags = valueFlags self.researchMegaphone = Self.isCountryCodeBucketEnabled(.researchMegaphone, valueFlags: valueFlags) - self.subscriptionMegaphone = Self.isCountryCodeBucketEnabled(.subscriptionMegaphone, valueFlags: valueFlags) + self.subscriptionMegaphone = Self.isCountryCodeBucketEnabled(.subscriptionMegaphone2, valueFlags: valueFlags) self.standardMediaQualityLevel = Self.determineStandardMediaQualityLevel(valueFlags: valueFlags) self.paymentsDisabledRegions = Self.parsePaymentsDisabledRegions(valueFlags: valueFlags) } @@ -450,7 +450,7 @@ private struct Flags { case replaceableInteractionExpiration case messageSendLogEntryLifetime case paymentsDisabledRegions - case subscriptionMegaphone + case subscriptionMegaphone2 case subscriptionMegaphoneSnoozeInterval } } From bb6c232a5d3998662a310de6186c992aca208886 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 15:15:38 -0800 Subject: [PATCH 13/30] "Feature flags for .production." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index 6d2079d6ce..bb04d223a5 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .qa +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .production // MARK: - From e3ae5b38da2b0d2d24612d6959e7502cb69d62fa Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 15:15:41 -0800 Subject: [PATCH 14/30] "Bump build to 5.26.4.3." --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index db5c334ae5..850ef5e31a 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 2 + 3 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.4.2 + 5.26.4.3 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index 13e910bebd..d1329b826a 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 2 + 3 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.4.2 + 5.26.4.3 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 3af72606eb..1305201880 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 2 + 3 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.4.2 + 5.26.4.3 UIAppFonts fontawesome-webfont.ttf From 12ebc15a3c1f33e95122caa2f40f866bab734669 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 15:15:45 -0800 Subject: [PATCH 15/30] "Feature flags for .beta." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index bb04d223a5..1a2bfce6cd 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .production +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .beta // MARK: - From b9ba857be0241d221a8baeacb8322bf68d490c19 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 15:15:50 -0800 Subject: [PATCH 16/30] "Bump build to 5.26.4.4." (Beta) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 850ef5e31a..95b9428780 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 3 + 4 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.4.3 + 5.26.4.4 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index d1329b826a..ae8d0125e7 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 3 + 4 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.4.3 + 5.26.4.4 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 1305201880..65fd0c057f 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 3 + 4 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.4.3 + 5.26.4.4 UIAppFonts fontawesome-webfont.ttf From 07f2a70a3d800de6bcb550706ae61acf81272664 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 15:15:54 -0800 Subject: [PATCH 17/30] "Feature flags for .qa." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index 1a2bfce6cd..6d2079d6ce 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .beta +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .qa // MARK: - From 1f3ef43427381f7e967d7638591f4b466d4cf19f Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Mon, 6 Dec 2021 15:15:57 -0800 Subject: [PATCH 18/30] "Bump build to 5.26.4.5." (Internal) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 95b9428780..567f8a84f3 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 4 + 5 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.4.4 + 5.26.4.5 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index ae8d0125e7..da289d8539 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 4 + 5 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.4.4 + 5.26.4.5 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 65fd0c057f..cd6f708d58 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.4 CFBundleVersion - 4 + 5 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.4.4 + 5.26.4.5 UIAppFonts fontawesome-webfont.ttf From 199e74f74218bf4c465f84f15de7a3d1ea5db1fd Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 04:01:08 -0800 Subject: [PATCH 19/30] "Bump build to 5.27.0.36." (nightly-12-07-2021) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index fddd9919c4..9959a27bca 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 35 + 36 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.27.0.35 + 5.27.0.36 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index 020841cc54..d769b290e9 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.27.0 CFBundleVersion - 35 + 36 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.27.0.35 + 5.27.0.36 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 937a3631a9..6bac77e553 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.27.0 CFBundleVersion - 35 + 36 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.27.0.35 + 5.27.0.36 UIAppFonts fontawesome-webfont.ttf From a4a27a57c1f53421ba52606c767815a65f468394 Mon Sep 17 00:00:00 2001 From: Ehren Kret Date: Tue, 7 Dec 2021 09:58:47 -0600 Subject: [PATCH 20/30] Remove old chat server hostnames --- SignalServiceKit/src/TSConstants.swift | 36 ++++---------------- SignalServiceKit/src/Util/FeatureFlags.swift | 3 -- 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/SignalServiceKit/src/TSConstants.swift b/SignalServiceKit/src/TSConstants.swift index b63ea7e237..c226b1e7dd 100644 --- a/SignalServiceKit/src/TSConstants.swift +++ b/SignalServiceKit/src/TSConstants.swift @@ -165,21 +165,9 @@ public class TSConstants: NSObject { private class TSConstantsProduction: TSConstantsProtocol { - public var mainServiceWebSocketAPI_identified: String { - FeatureFlags.newHostNames - ? "wss://chat.signal.org/v1/websocket/" - : "wss://textsecure-service.whispersystems.org/v1/websocket/" - } - public var mainServiceWebSocketAPI_unidentified: String { - FeatureFlags.newHostNames - ? "wss://ud-chat.signal.org/v1/websocket/" - : "wss://textsecure-service.whispersystems.org/v1/websocket/" - } - public var mainServiceURL: String { - FeatureFlags.newHostNames - ? "https://chat.signal.org/" - : "https://textsecure-service.whispersystems.org/" - } + public let mainServiceWebSocketAPI_identified = "wss://chat.signal.org/v1/websocket/" + public let mainServiceWebSocketAPI_unidentified = "wss://ud-chat.signal.org/v1/websocket/" + public let mainServiceURL = "https://chat.signal.org/" public let textSecureCDN0ServerURL = "https://cdn.signal.org" public let textSecureCDN2ServerURL = "https://cdn2.signal.org" public let contactDiscoveryURL = "https://api.directory.signal.org" @@ -227,21 +215,9 @@ private class TSConstantsProduction: TSConstantsProtocol { private class TSConstantsStaging: TSConstantsProtocol { - public var mainServiceWebSocketAPI_identified: String { - FeatureFlags.newHostNames - ? "wss://chat.staging.signal.org/v1/websocket/" - : "wss://textsecure-service-staging.whispersystems.org/v1/websocket/" - } - public var mainServiceWebSocketAPI_unidentified: String { - FeatureFlags.newHostNames - ? "wss://ud-chat.staging.signal.org/v1/websocket/" - : "wss://textsecure-service-staging.whispersystems.org/v1/websocket/" - } - public var mainServiceURL: String { - FeatureFlags.newHostNames - ? "https://chat.staging.signal.org/" - : "https://textsecure-service-staging.whispersystems.org/" - } + public let mainServiceWebSocketAPI_identified = "wss://chat.staging.signal.org/v1/websocket/" + public let mainServiceWebSocketAPI_unidentified = "wss://ud-chat.staging.signal.org/v1/websocket/" + public let mainServiceURL = "https://chat.staging.signal.org/" public let textSecureCDN0ServerURL = "https://cdn-staging.signal.org" public let textSecureCDN2ServerURL = "https://cdn2-staging.signal.org" public let contactDiscoveryURL = "https://api-staging.directory.signal.org" diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index e45a7dcdf6..5ac41b59a0 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -224,9 +224,6 @@ public class FeatureFlags: BaseFlags { @objc public static let deprecateREST = false - @objc - public static let newHostNames = true - @objc public static let groupRings = false From 5917973c7939c3b3031977a5af381c6213557980 Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 16:12:52 -0800 Subject: [PATCH 21/30] Fix regression resulting in rendering system contact avatars for the local user --- .../contacts/ContactsManagerCache.swift | 23 ++++++++++--------- .../contacts/OWSContactsManager.swift | 5 ++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/SignalMessaging/contacts/ContactsManagerCache.swift b/SignalMessaging/contacts/ContactsManagerCache.swift index cab2112a87..325f260720 100644 --- a/SignalMessaging/contacts/ContactsManagerCache.swift +++ b/SignalMessaging/contacts/ContactsManagerCache.swift @@ -87,23 +87,24 @@ public class ContactsMaps: NSObject { } fileprivate static func phoneNumbers(forContact contact: Contact, localNumber: String?) -> [String] { - return contact.parsedPhoneNumbers.compactMap { phoneNumber in + let phoneNumbers: [String] = contact.parsedPhoneNumbers.compactMap { phoneNumber in guard let phoneNumberE164 = phoneNumber.toE164().nilIfEmpty else { return nil } - // Ignore any system contact records for the local contact. - // For the local user we never want to show the avatar / - // name that you have entered for yourself in your system - // contacts. Instead, we always want to display your profile - // name and avatar. - let isLocalContact = phoneNumberE164 == localNumber - guard !isLocalContact else { - return nil - } - return phoneNumberE164 } + + if let localNumber = localNumber, phoneNumbers.contains(localNumber) { + // Ignore any system contact records for the local contact. + // For the local user we never want to show the avatar / + // name that you have entered for yourself in your system + // contacts. Instead, we always want to display your profile + // name and avatar. + return [] + } + + return phoneNumbers } @objc diff --git a/SignalMessaging/contacts/OWSContactsManager.swift b/SignalMessaging/contacts/OWSContactsManager.swift index 947a0d3abb..da3c59dc84 100644 --- a/SignalMessaging/contacts/OWSContactsManager.swift +++ b/SignalMessaging/contacts/OWSContactsManager.swift @@ -566,6 +566,11 @@ extension OWSContactsManager { return nil } + guard !address.isLocalAddress else { + // Never use system contact or synced image data for the local user + return nil + } + if let phoneNumber = self.phoneNumber(for: address, transaction: transaction), let contact = contactsManagerCache.contact(forPhoneNumber: phoneNumber, transaction: transaction), let cnContactId = contact.cnContactId, From 0973a25b0290c3e62a9a9e6e9a99ac0c19f201a8 Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 16:13:54 -0800 Subject: [PATCH 22/30] "Feature flags for .production." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index 6d2079d6ce..bb04d223a5 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .qa +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .production // MARK: - From 4c96107d911dfe006b7b2c8d6f0b79fdbdc92af5 Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 16:14:33 -0800 Subject: [PATCH 23/30] "Bump build to 5.26.5.0." --- Signal/Signal-Info.plist | 6 +++--- SignalNSE/Info.plist | 6 +++--- SignalShareExtension/Info.plist | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 567f8a84f3..c825201b29 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -26,7 +26,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 5.26.4 + 5.26.5 CFBundleSignature ???? CFBundleURLTypes @@ -43,7 +43,7 @@ CFBundleVersion - 5 + 0 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.4.5 + 5.26.5.0 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index da289d8539..19c46b6c1e 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 5.26.4 + 5.26.5 CFBundleVersion - 5 + 0 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.4.5 + 5.26.5.0 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index cd6f708d58..2e8095c6e3 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 5.26.4 + 5.26.5 CFBundleVersion - 5 + 0 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.4.5 + 5.26.5.0 UIAppFonts fontawesome-webfont.ttf From e3b197becbf411d0ddcca9428bed32342fd8dd79 Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 16:15:49 -0800 Subject: [PATCH 24/30] "Feature flags for .beta." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index bb04d223a5..1a2bfce6cd 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .production +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .beta // MARK: - From 71bc9a553e7d8ea746137a8d555b922d84bb38fa Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 16:15:50 -0800 Subject: [PATCH 25/30] "Bump build to 5.26.5.1." (Beta) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index c825201b29..5660f5452e 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 0 + 1 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.26.5.0 + 5.26.5.1 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index 19c46b6c1e..f68db9ab73 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.5 CFBundleVersion - 0 + 1 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.26.5.0 + 5.26.5.1 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 2e8095c6e3..f68adb54a3 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.26.5 CFBundleVersion - 0 + 1 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.26.5.0 + 5.26.5.1 UIAppFonts fontawesome-webfont.ttf From 13a1286b6128bc56169d6a6a389341583f0f0ee7 Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 16:17:53 -0800 Subject: [PATCH 26/30] "Feature flags for .qa." --- SignalServiceKit/src/Util/FeatureFlags.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index c6a7a309df..5ac41b59a0 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -19,7 +19,7 @@ extension FeatureBuild { } } -private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .beta +private let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .qa // MARK: - From affbdc8e559cd79e708701d3da39e6698a7993ee Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Tue, 7 Dec 2021 16:17:55 -0800 Subject: [PATCH 27/30] "Bump build to 5.27.0.37." (Internal) --- Signal/Signal-Info.plist | 4 ++-- SignalNSE/Info.plist | 4 ++-- SignalShareExtension/Info.plist | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 9959a27bca..91c5020739 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -43,7 +43,7 @@ CFBundleVersion - 36 + 37 ITSAppUsesNonExemptEncryption LOGS_EMAIL @@ -141,7 +141,7 @@ INStartCallIntent OWSBundleVersion4 - 5.27.0.36 + 5.27.0.37 PHPhotoLibraryPreventAutomaticLimitedAccessAlert UIAppFonts diff --git a/SignalNSE/Info.plist b/SignalNSE/Info.plist index d769b290e9..5d6649b011 100644 --- a/SignalNSE/Info.plist +++ b/SignalNSE/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.27.0 CFBundleVersion - 36 + 37 NSAppTransportSecurity NSExceptionDomains @@ -55,7 +55,7 @@ $(PRODUCT_MODULE_NAME).NotificationService OWSBundleVersion4 - 5.27.0.36 + 5.27.0.37 UIAppFonts Inter-Medium.otf diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 6bac77e553..66fe64b149 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 5.27.0 CFBundleVersion - 36 + 37 ITSAppUsesNonExemptEncryption NSAppTransportSecurity @@ -77,7 +77,7 @@ com.apple.share-services OWSBundleVersion4 - 5.27.0.36 + 5.27.0.37 UIAppFonts fontawesome-webfont.ttf From 55fe01353a46d5ed6fdbbe52df952eda744bc35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=B6ttcher?= Date: Fri, 3 Dec 2021 14:16:12 +0100 Subject: [PATCH 28/30] marking a thread as read/unread via swipe gesture (and selecting the corresponding action) the badge indicating the read/unread status will be updated immediately. --- .../HomeView/HVTableDataSource.swift | 2 ++ .../HomeView/HomeViewCell.swift | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift b/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift index e3c225c703..ff077fd669 100644 --- a/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift +++ b/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift @@ -799,6 +799,7 @@ extension HVTableDataSource: UITableViewDataSource { readStateAction = UIContextualAction(style: .destructive, title: nil) { [weak viewController] (_, _, completion) in completion(false) + NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: ["markAsRead": true]) // We delay here so the animation can play out before we // reload the cell DispatchQueue.main.asyncAfter(deadline: .now() + 0.65) { [weak viewController] in @@ -813,6 +814,7 @@ extension HVTableDataSource: UITableViewDataSource { readStateAction = UIContextualAction(style: .normal, title: nil) { [weak viewController] (_, _, completion) in completion(false) + NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: ["markAsRead": false]) // We delay here so the animation can play out before we // reload the cell DispatchQueue.main.asyncAfter(deadline: .now() + 0.65) { [weak viewController] in diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.swift b/Signal/src/ViewControllers/HomeView/HomeViewCell.swift index 3e440677c2..d762dfcf83 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.swift +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.swift @@ -9,6 +9,8 @@ import SignalUI @objc public class HomeViewCell: UITableViewCell { + static let TEMPORARY_CHANGE_UNREAD_BADGE = NSNotification.Name(rawValue: "TEMPORARY_CHANGE_UNREAD_BADGE") + @objc public static let reuseIdentifier = "HomeViewCell" @@ -208,6 +210,7 @@ public class HomeViewCell: UITableViewCell { hasOverrideSnippet: configuration.hasOverrideSnippet, messageStatusToken: messageStatusToken, unreadIndicatorLabelConfig: unreadIndicatorLabelConfig, + hideUnreadIndicator: configuration.hasOverrideSnippet || !configuration.thread.hasUnreadMessages, topRowStackConfig: Self.topRowStackConfig, bottomRowStackConfig: Self.bottomRowStackConfig, @@ -361,6 +364,10 @@ public class HomeViewCell: UITableViewCell { selector: #selector(typingIndicatorStateDidChange), name: TypingIndicatorsImpl.typingIndicatorStateDidChange, object: nil) + NotificationCenter.default.addObserver(self, + selector: #selector(temporarySetUnreadIndicator(notification:)), + name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, + object: thread) // The top row contains: // @@ -433,6 +440,7 @@ public class HomeViewCell: UITableViewCell { let unreadBadgeMeasurements = measurements.unreadBadgeMeasurements { let unreadBadge = configureUnreadBadge(unreadIndicatorLabelConfig: unreadIndicatorLabelConfig, unreadBadgeMeasurements: unreadBadgeMeasurements) + unreadBadge.alpha = configs.hideUnreadIndicator ? 0 : 1 bottomRowStackSubviews.append(unreadBadge) } @@ -617,14 +625,7 @@ public class HomeViewCell: UITableViewCell { private static func buildUnreadIndicatorLabelConfig(configuration: Configuration) -> CVLabelConfig? { let text: String switch configuration.unreadMode { - case .none: - // If we're using the conversation list cell to render search results, - // don't show "unread badge" or "message status" indicator. - // - // Or there might simply be no unread messages / the thread is not - // marked as unread. - return nil - case .unreadWithoutCount: + case .none, .unreadWithoutCount: text = "" case .unreadWithCount(let unreadCount): text = unreadCount > 0 ? OWSFormat.formatUInt(unreadCount) : "" @@ -898,6 +899,13 @@ public class HomeViewCell: UITableViewCell { updateTypingIndicatorState() } + @objc + private func temporarySetUnreadIndicator(notification: Notification) { + AssertIsOnMainThread() + let markAsRead = notification.userInfo?["markAsRead"] as? Bool ?? false + unreadBadge.alpha = markAsRead ? 0 : 1 + } + // MARK: - Typing Indicators private var shouldShowTypingIndicators: Bool { @@ -956,6 +964,7 @@ private struct HVCellConfigs { let hasOverrideSnippet: Bool let messageStatusToken: HVMessageStatusToken? let unreadIndicatorLabelConfig: CVLabelConfig? + let hideUnreadIndicator: Bool // Configs let topRowStackConfig: ManualStackView.Config From 5cd0ec58bf240b6f3ef03710f277a98a4641ac72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=B6ttcher?= Date: Sat, 4 Dec 2021 15:29:16 +0100 Subject: [PATCH 29/30] added optional animation duration setting/removing unread badge via swipe gesture action --- .../ViewControllers/HomeView/HVTableDataSource.swift | 10 ++++++---- Signal/src/ViewControllers/HomeView/HomeViewCell.swift | 7 ++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift b/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift index ff077fd669..4d977f927d 100644 --- a/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift +++ b/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift @@ -794,15 +794,17 @@ extension HVTableDataSource: UITableViewDataSource { title: CommonStrings.pinAction) } + let kPullbackAnimationDuration = 0.65 + let userInfo = ["markAsRead": threadViewModel.hasUnreadMessages, "duration": kPullbackAnimationDuration + 0.2] as [String: Any] let readStateAction: UIContextualAction if threadViewModel.hasUnreadMessages { readStateAction = UIContextualAction(style: .destructive, title: nil) { [weak viewController] (_, _, completion) in completion(false) - NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: ["markAsRead": true]) + NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: userInfo) // We delay here so the animation can play out before we // reload the cell - DispatchQueue.main.asyncAfter(deadline: .now() + 0.65) { [weak viewController] in + DispatchQueue.main.asyncAfter(deadline: .now() + kPullbackAnimationDuration) { [weak viewController] in viewController?.markThreadAsRead(threadViewModel: threadViewModel) } } @@ -814,10 +816,10 @@ extension HVTableDataSource: UITableViewDataSource { readStateAction = UIContextualAction(style: .normal, title: nil) { [weak viewController] (_, _, completion) in completion(false) - NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: ["markAsRead": false]) + NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: userInfo) // We delay here so the animation can play out before we // reload the cell - DispatchQueue.main.asyncAfter(deadline: .now() + 0.65) { [weak viewController] in + DispatchQueue.main.asyncAfter(deadline: .now() + kPullbackAnimationDuration) { [weak viewController] in viewController?.markThreadAsUnread(threadViewModel: threadViewModel) } } diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.swift b/Signal/src/ViewControllers/HomeView/HomeViewCell.swift index d762dfcf83..ba8591163c 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.swift +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.swift @@ -903,7 +903,12 @@ public class HomeViewCell: UITableViewCell { private func temporarySetUnreadIndicator(notification: Notification) { AssertIsOnMainThread() let markAsRead = notification.userInfo?["markAsRead"] as? Bool ?? false - unreadBadge.alpha = markAsRead ? 0 : 1 + let uiChangesBlock = { [weak self] in self?.unreadBadge.alpha = markAsRead ? 0 : 1 } + if let duration = notification.userInfo?["duration"] as? Double, duration > 0 { + UIView.animate(withDuration: duration) { uiChangesBlock() } + } else { + uiChangesBlock() + } } // MARK: - Typing Indicators From 25053d32d77f6b2d1673e449ae2a310c5afb4d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=B6ttcher?= Date: Tue, 7 Dec 2021 10:52:00 +0100 Subject: [PATCH 30/30] reloading modified thread cells does not interfere with SwipeAction animations anymore --- .../HomeView/HVTableDataSource.swift | 31 +++++++++-------- .../HomeView/HomeViewCell.swift | 34 ++++++------------- .../HomeView/HomeViewController+Loading.swift | 5 ++- 3 files changed, 31 insertions(+), 39 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift b/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift index 4d977f927d..9667d0b1a0 100644 --- a/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift +++ b/Signal/src/ViewControllers/HomeView/HVTableDataSource.swift @@ -794,19 +794,12 @@ extension HVTableDataSource: UITableViewDataSource { title: CommonStrings.pinAction) } - let kPullbackAnimationDuration = 0.65 - let userInfo = ["markAsRead": threadViewModel.hasUnreadMessages, "duration": kPullbackAnimationDuration + 0.2] as [String: Any] let readStateAction: UIContextualAction if threadViewModel.hasUnreadMessages { readStateAction = UIContextualAction(style: .destructive, title: nil) { [weak viewController] (_, _, completion) in completion(false) - NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: userInfo) - // We delay here so the animation can play out before we - // reload the cell - DispatchQueue.main.asyncAfter(deadline: .now() + kPullbackAnimationDuration) { [weak viewController] in - viewController?.markThreadAsRead(threadViewModel: threadViewModel) - } + viewController?.markThreadAsRead(threadViewModel: threadViewModel) } readStateAction.backgroundColor = .ows_accentBlue readStateAction.accessibilityLabel = CommonStrings.readAction @@ -816,12 +809,7 @@ extension HVTableDataSource: UITableViewDataSource { readStateAction = UIContextualAction(style: .normal, title: nil) { [weak viewController] (_, _, completion) in completion(false) - NotificationCenter.default.post(name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, object: thread, userInfo: userInfo) - // We delay here so the animation can play out before we - // reload the cell - DispatchQueue.main.asyncAfter(deadline: .now() + kPullbackAnimationDuration) { [weak viewController] in - viewController?.markThreadAsUnread(threadViewModel: threadViewModel) - } + viewController?.markThreadAsUnread(threadViewModel: threadViewModel) } readStateAction.backgroundColor = .ows_accentBlue readStateAction.accessibilityLabel = CommonStrings.unreadAction @@ -839,6 +827,21 @@ extension HVTableDataSource: UITableViewDataSource { extension HVTableDataSource { + public func updateVisibleCellContent(at indexPath: IndexPath, for tableView: UITableView) -> Bool { + AssertIsOnMainThread() + + if let primKey = threadViewModel(forIndexPath: indexPath)?.threadRecord.uniqueId, (tableView.indexPathsForVisibleRows ?? []).contains(indexPath) { + for cell in tableView.visibleCells { + if let homeCell = cell as? HomeViewCell, let myKey = homeCell.thread?.uniqueId, myKey == primKey, let token = buildCellConfigurationAndContentTokenSync(forIndexPath: indexPath)?.contentToken { + homeCell.reset() + homeCell.configure(cellContentToken: token) + return true + } + } + } + return false + } + fileprivate struct HVCellConfigurationAndContentToken { let configuration: HomeViewCell.Configuration let contentToken: HVCellContentToken diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.swift b/Signal/src/ViewControllers/HomeView/HomeViewCell.swift index ba8591163c..03da146d49 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.swift +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.swift @@ -9,8 +9,6 @@ import SignalUI @objc public class HomeViewCell: UITableViewCell { - static let TEMPORARY_CHANGE_UNREAD_BADGE = NSNotification.Name(rawValue: "TEMPORARY_CHANGE_UNREAD_BADGE") - @objc public static let reuseIdentifier = "HomeViewCell" @@ -123,7 +121,7 @@ public class HomeViewCell: UITableViewCell { } } private var cellContentToken: HVCellContentToken? - private var thread: TSThread? { + var thread: TSThread? { cellContentToken?.thread } @@ -210,7 +208,6 @@ public class HomeViewCell: UITableViewCell { hasOverrideSnippet: configuration.hasOverrideSnippet, messageStatusToken: messageStatusToken, unreadIndicatorLabelConfig: unreadIndicatorLabelConfig, - hideUnreadIndicator: configuration.hasOverrideSnippet || !configuration.thread.hasUnreadMessages, topRowStackConfig: Self.topRowStackConfig, bottomRowStackConfig: Self.bottomRowStackConfig, @@ -364,10 +361,6 @@ public class HomeViewCell: UITableViewCell { selector: #selector(typingIndicatorStateDidChange), name: TypingIndicatorsImpl.typingIndicatorStateDidChange, object: nil) - NotificationCenter.default.addObserver(self, - selector: #selector(temporarySetUnreadIndicator(notification:)), - name: HomeViewCell.TEMPORARY_CHANGE_UNREAD_BADGE, - object: thread) // The top row contains: // @@ -440,7 +433,6 @@ public class HomeViewCell: UITableViewCell { let unreadBadgeMeasurements = measurements.unreadBadgeMeasurements { let unreadBadge = configureUnreadBadge(unreadIndicatorLabelConfig: unreadIndicatorLabelConfig, unreadBadgeMeasurements: unreadBadgeMeasurements) - unreadBadge.alpha = configs.hideUnreadIndicator ? 0 : 1 bottomRowStackSubviews.append(unreadBadge) } @@ -625,7 +617,14 @@ public class HomeViewCell: UITableViewCell { private static func buildUnreadIndicatorLabelConfig(configuration: Configuration) -> CVLabelConfig? { let text: String switch configuration.unreadMode { - case .none, .unreadWithoutCount: + case .none: + // If we're using the conversation list cell to render search results, + // don't show "unread badge" or "message status" indicator. + // + // Or there might simply be no unread messages / the thread is not + // marked as unread. + return nil + case .unreadWithoutCount: text = "" case .unreadWithCount(let unreadCount): text = unreadCount > 0 ? OWSFormat.formatUInt(unreadCount) : "" @@ -851,7 +850,7 @@ public class HomeViewCell: UITableViewCell { reset() } - private func reset() { + func reset() { isCellVisible = false for cvview in cvviews { @@ -899,18 +898,6 @@ public class HomeViewCell: UITableViewCell { updateTypingIndicatorState() } - @objc - private func temporarySetUnreadIndicator(notification: Notification) { - AssertIsOnMainThread() - let markAsRead = notification.userInfo?["markAsRead"] as? Bool ?? false - let uiChangesBlock = { [weak self] in self?.unreadBadge.alpha = markAsRead ? 0 : 1 } - if let duration = notification.userInfo?["duration"] as? Double, duration > 0 { - UIView.animate(withDuration: duration) { uiChangesBlock() } - } else { - uiChangesBlock() - } - } - // MARK: - Typing Indicators private var shouldShowTypingIndicators: Bool { @@ -969,7 +956,6 @@ private struct HVCellConfigs { let hasOverrideSnippet: Bool let messageStatusToken: HVMessageStatusToken? let unreadIndicatorLabelConfig: CVLabelConfig? - let hideUnreadIndicator: Bool // Configs let topRowStackConfig: ManualStackView.Config diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController+Loading.swift b/Signal/src/ViewControllers/HomeView/HomeViewController+Loading.swift index 1f65b7efdc..019f14c322 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController+Loading.swift +++ b/Signal/src/ViewControllers/HomeView/HomeViewController+Loading.swift @@ -157,7 +157,10 @@ extension HomeViewController { tableView.insertRows(at: [newIndexPath], with: rowAnimation) } case .update(let oldIndexPath): - tableView.reloadRows(at: [oldIndexPath], with: .none) + let tds = tableView.dataSource as? HVTableDataSource + if tds == nil || !tds!.updateVisibleCellContent(at: oldIndexPath, for: tableView) { + tableView.reloadRows(at: [oldIndexPath], with: .none) + } } }