From c39a1a44ec96e5e7a7b4363c39f222de282977eb Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Fri, 29 Nov 2024 18:08:42 +0100 Subject: [PATCH] Applied SwiftFormat --- Cryptomator/Purchase/PurchaseViewModel.swift | 13 +++++++------ Cryptomator/Purchase/UpgradeViewModel.swift | 4 ++-- Cryptomator/VaultList/VaultListViewController.swift | 3 +-- .../CryptomatorUserDefaults.swift | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cryptomator/Purchase/PurchaseViewModel.swift b/Cryptomator/Purchase/PurchaseViewModel.swift index b3f3618e9..1659d77bd 100644 --- a/Cryptomator/Purchase/PurchaseViewModel.swift +++ b/Cryptomator/Purchase/PurchaseViewModel.swift @@ -32,6 +32,7 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching { override var title: String? { return LocalizedString.getValue("purchase.title") } + // Temporarily added for December 2024 Sale override var infoText: NSAttributedString? { let currentYear = Calendar.current.component(.year, from: Date()) @@ -39,9 +40,9 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching { // TODO: Change `currentMonth == 11` to `12` if currentYear == 2024 && currentMonth == 11 { return .textWithLeadingSystemImage("info.circle.fill", - text: LocalizedString.getValue("purchase.discount"), - font: .preferredFont(forTextStyle: .body), - color: .secondaryLabel) + text: LocalizedString.getValue("purchase.discount"), + font: .preferredFont(forTextStyle: .body), + color: .secondaryLabel) } else { return nil } @@ -70,7 +71,7 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching { cells.append(.trialCell(TrialCellViewModel(expirationDate: trialExpirationDate))) } else { cells.append(.purchaseCell(PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.trial"), - productDetail: nil, + productDetail: nil, price: LocalizedString.getValue("purchase.product.pricing.free"), purchaseDetail: LocalizedString.getValue("purchase.product.trial.duration"), productIdentifier: .thirtyDayTrial))) @@ -80,7 +81,7 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching { private func addSubscriptionItem() { if let product = products[.yearlySubscription], let localizedPrice = product.localizedPrice { let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.yearlySubscription"), - productDetail: nil, + productDetail: nil, price: localizedPrice, purchaseDetail: LocalizedString.getValue("purchase.product.yearlySubscription.duration"), productIdentifier: .yearlySubscription) @@ -91,7 +92,7 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching { private func addLifetimeLicenseItem() { if let product = products[.fullVersion], let localizedPrice = product.localizedPrice { let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.lifetimeLicense"), - productDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.detail"), + productDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.detail"), price: localizedPrice, purchaseDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.duration"), productIdentifier: .fullVersion) diff --git a/Cryptomator/Purchase/UpgradeViewModel.swift b/Cryptomator/Purchase/UpgradeViewModel.swift index a4287de3d..9bb43dc16 100644 --- a/Cryptomator/Purchase/UpgradeViewModel.swift +++ b/Cryptomator/Purchase/UpgradeViewModel.swift @@ -34,7 +34,7 @@ class UpgradeViewModel: BaseIAPViewModel, ProductFetching { func addFreeUpgradeItem() { guard products[.freeUpgrade] != nil else { return } let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.freeUpgrade"), - productDetail: nil, + productDetail: nil, price: LocalizedString.getValue("purchase.product.pricing.free"), purchaseDetail: nil, productIdentifier: .freeUpgrade) @@ -44,7 +44,7 @@ class UpgradeViewModel: BaseIAPViewModel, ProductFetching { func addPaidUpgradeItem() { if let product = products[.paidUpgrade], let localizedPrice = product.localizedPrice { let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.donateAndUpgrade"), - productDetail: nil, + productDetail: nil, price: localizedPrice, purchaseDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.duration"), productIdentifier: .paidUpgrade) diff --git a/Cryptomator/VaultList/VaultListViewController.swift b/Cryptomator/VaultList/VaultListViewController.swift index cb2a801ce..5f9a5e3ed 100644 --- a/Cryptomator/VaultList/VaultListViewController.swift +++ b/Cryptomator/VaultList/VaultListViewController.swift @@ -125,7 +125,7 @@ class VaultListViewController: ListViewController { let currentYear = Calendar.current.component(.year, from: Date()) let currentMonth = Calendar.current.component(.month, from: Date()) // TODO: Change `currentMonth == 11` to `12` - if currentYear == 2024 && currentMonth == 11 && !(cryptomatorSettings.fullVersionUnlocked || cryptomatorSettings.hasRunningSubscription) && !cryptomatorSettings.december2024BannerDismissed { + if currentYear == 2024, currentMonth == 11, !(cryptomatorSettings.fullVersionUnlocked || cryptomatorSettings.hasRunningSubscription), !cryptomatorSettings.december2024BannerDismissed { showBanner() } } @@ -143,7 +143,6 @@ class VaultListViewController: ListViewController { emojiLabel.setContentHuggingPriority(.required, for: .horizontal) emojiLabel.setContentCompressionResistancePriority(.required, for: .horizontal) - let textLabel = UILabel() textLabel.text = LocalizedString.getValue("purchase.discount") textLabel.textColor = .white diff --git a/CryptomatorCommon/Sources/CryptomatorCommonCore/CryptomatorUserDefaults.swift b/CryptomatorCommon/Sources/CryptomatorCommonCore/CryptomatorUserDefaults.swift index c2c79c120..27729b740 100644 --- a/CryptomatorCommon/Sources/CryptomatorCommonCore/CryptomatorUserDefaults.swift +++ b/CryptomatorCommon/Sources/CryptomatorCommonCore/CryptomatorUserDefaults.swift @@ -111,7 +111,7 @@ extension CryptomatorUserDefaults: CryptomatorSettings { get { read() ?? false } set { write(value: newValue) } } - + #if !ALWAYS_PREMIUM public var december2024BannerDismissed: Bool { get { read() ?? false }