Remove dead code, and organize some live code

This commit is contained in:
Sasha Weiss 2022-10-31 16:01:35 -07:00 committed by GitHub
parent 00378ea208
commit e4f5e48ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 27 deletions

View File

@ -93,15 +93,6 @@ class ExperienceUpgradeManager: NSObject {
}
}
/// Snoozes the given upgrade, and dismisses it if currently presented.
static func snoozeExperienceUpgrade(_ manifest: ExperienceUpgradeManifest, transaction: GRDBWriteTransaction) {
ExperienceUpgradeFinder.markAsSnoozed(experienceUpgradeManifest: manifest, transaction: transaction)
transaction.addAsyncCompletion(queue: .main) {
dismissLastPresented(ifMatching: manifest)
}
}
private static func dismissLastPresented(ifMatching manifest: ExperienceUpgradeManifest? = nil) {
guard let lastPresented = lastPresented else {
return

View File

@ -31,16 +31,6 @@ public class ExperienceUpgradeFinder: NSObject {
experienceUpgrade.markAsViewed(transaction: transaction.asAnyWrite)
}
public class func markAsSnoozed(
experienceUpgradeManifest: ExperienceUpgradeManifest,
transaction: GRDBWriteTransaction
) {
markAsSnoozed(
experienceUpgrade: ExperienceUpgrade.makeNew(withManifest: experienceUpgradeManifest),
transaction: transaction
)
}
public class func markAsSnoozed(experienceUpgrade: ExperienceUpgrade, transaction: GRDBWriteTransaction) {
Logger.info("marking experience upgrade as snoozed \(experienceUpgrade.uniqueId)")

View File

@ -406,6 +406,8 @@ extension ExperienceUpgradeManifest {
}
}
// MARK: Local megaphone preconditions
private static func checkPreconditionsForIntroducingPins(transaction: SDSAnyReadTransaction) -> Bool {
// The PIN setup flow requires an internet connection and you to not already have a PIN
if
@ -444,6 +446,16 @@ extension ExperienceUpgradeManifest {
}
}
private static func checkPreconditionsForPinReminder(transaction: SDSAnyReadTransaction) -> Bool {
return OWS2FAManager.shared.isDueForV2Reminder(transaction: transaction)
}
private static func checkPreconditionsForContactsPermissionReminder() -> Bool {
return CNContactStore.authorizationStatus(for: CNEntityType.contacts) != .authorized
}
// MARK: Remote megaphone preconditions
private static func checkPreconditionsForRemoteMegaphone(_ megaphone: RemoteMegaphoneModel) -> Bool {
guard
AppVersion.compare(
@ -503,12 +515,4 @@ extension ExperienceUpgradeManifest {
return true
}
private static func checkPreconditionsForPinReminder(transaction: SDSAnyReadTransaction) -> Bool {
return OWS2FAManager.shared.isDueForV2Reminder(transaction: transaction)
}
private static func checkPreconditionsForContactsPermissionReminder() -> Bool {
return CNContactStore.authorizationStatus(for: CNEntityType.contacts) != .authorized
}
}