From 6430c3630723c27ef0b5554f387251aa45a2423e Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Thu, 24 Sep 2020 11:36:57 +1000 Subject: [PATCH] Clean --- Signal/src/Loki/View Controllers/HomeVC.swift | 26 ------------------- .../OpenGroupSuggestionSheet.swift | 5 ---- .../src/Loki/View Controllers/PNModeVC.swift | 2 -- .../src/Loki/Utilities/LKUserDefaults.swift | 5 +--- 4 files changed, 1 insertion(+), 37 deletions(-) diff --git a/Signal/src/Loki/View Controllers/HomeVC.swift b/Signal/src/Loki/View Controllers/HomeVC.swift index c12cf8891..3a742ab48 100644 --- a/Signal/src/Loki/View Controllers/HomeVC.swift +++ b/Signal/src/Loki/View Controllers/HomeVC.swift @@ -158,39 +158,13 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol DispatchQueue.global(qos: .utility).async { let _ = IP2Country.shared.populateCacheIfNeeded() } - // Preload device links to make message sending quicker - var publicKeys: Set = [] - let storage = OWSPrimaryStorage.shared() - storage.dbReadConnection.read { transaction in - TSContactThread.enumerateCollectionObjects(with: transaction) { object, _ in - guard let thread = object as? TSContactThread, thread.shouldThreadBeVisible else { return } - let publicKey = thread.contactIdentifier() - guard UserDisplayNameUtilities.getPrivateChatDisplayName(for: publicKey) != nil, - storage.getMasterHexEncodedPublicKey(for: publicKey, in: transaction) == nil else { return } - publicKeys.insert(publicKey) - } - } - let _ = FileServerAPI.getDeviceLinks(associatedWith: publicKeys) // Do initial update reload() - // Clear all data if this is a secondary device - if UserDefaults.standard[.masterHexEncodedPublicKey] != nil { - UserDefaults.standard[.wasUnlinked] = true - NotificationCenter.default.post(name: .dataNukeRequested, object: nil, userInfo: nil) - } } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) isViewVisible = true - let hasSeenLightModeSheet = UserDefaults.standard[.hasSeenLightModeSheet] - if !hasSeenLightModeSheet { - let lightModeSheet = LightModeSheet() - lightModeSheet.modalPresentationStyle = .overFullScreen - lightModeSheet.modalTransitionStyle = .crossDissolve - present(lightModeSheet, animated: true, completion: nil) - UserDefaults.standard[.hasSeenLightModeSheet] = true - } UserDefaults.standard[.hasLaunchedOnce] = true } diff --git a/Signal/src/Loki/View Controllers/OpenGroupSuggestionSheet.swift b/Signal/src/Loki/View Controllers/OpenGroupSuggestionSheet.swift index 23f7cc5c4..bdb4d1448 100644 --- a/Signal/src/Loki/View Controllers/OpenGroupSuggestionSheet.swift +++ b/Signal/src/Loki/View Controllers/OpenGroupSuggestionSheet.swift @@ -69,9 +69,4 @@ final class OpenGroupSuggestionSheet : Sheet { } close() } - - override func close() { - UserDefaults.standard[.hasSeenOpenGroupSuggestionSheet] = true - super.close() - } } diff --git a/Signal/src/Loki/View Controllers/PNModeVC.swift b/Signal/src/Loki/View Controllers/PNModeVC.swift index 23c8b9f2f..1a84e3b09 100644 --- a/Signal/src/Loki/View Controllers/PNModeVC.swift +++ b/Signal/src/Loki/View Controllers/PNModeVC.swift @@ -89,8 +89,6 @@ final class PNModeVC : BaseVC, OptionViewDelegate { return present(alert, animated: true, completion: nil) } UserDefaults.standard[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView) - UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true - UserDefaults.standard[.hasSeenLightModeSheet] = true TSAccountManager.sharedInstance().didRegister() let homeVC = HomeVC() navigationController!.setViewControllers([ homeVC ], animated: true) diff --git a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift index 530a04a4e..0ce6bea81 100644 --- a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift +++ b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift @@ -5,13 +5,10 @@ public enum LKUserDefaults { public enum Bool : Swift.String { case hasLaunchedOnce case hasSeenGIFMetadataWarning - case hasSeenLightModeSheet - case hasSeenMultiDeviceRemovalSheet - case hasSeenOpenGroupSuggestionSheet case hasViewedSeed + case isUsingFullAPNs /// Whether the device was unlinked as a slave device (used to notify the user on the landing screen). case wasUnlinked - case isUsingFullAPNs } public enum Date : Swift.String {