Skip to content

Commit

Permalink
Applied SwiftFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Nov 29, 2024
1 parent 90d2f2e commit c39a1a4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
13 changes: 7 additions & 6 deletions Cryptomator/Purchase/PurchaseViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ 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())
let currentMonth = Calendar.current.component(.month, from: Date())
// 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
}
Expand Down Expand Up @@ -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)))
Expand All @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Cryptomator/Purchase/UpgradeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions Cryptomator/VaultList/VaultListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class VaultListViewController: ListViewController<VaultCellViewModel> {
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()
}
}
Expand All @@ -143,7 +143,6 @@ class VaultListViewController: ListViewController<VaultCellViewModel> {
emojiLabel.setContentHuggingPriority(.required, for: .horizontal)
emojiLabel.setContentCompressionResistancePriority(.required, for: .horizontal)


let textLabel = UILabel()
textLabel.text = LocalizedString.getValue("purchase.discount")
textLabel.textColor = .white
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ extension CryptomatorUserDefaults: CryptomatorSettings {
get { read() ?? false }
set { write(value: newValue) }
}

#if !ALWAYS_PREMIUM
public var december2024BannerDismissed: Bool {
get { read() ?? false }
Expand Down

0 comments on commit c39a1a4

Please sign in to comment.