Skip to content

Commit 217c4f9

Browse files
committed
Removed December 2024 sale promo
1 parent 482112a commit 217c4f9

File tree

10 files changed

+0
-162
lines changed

10 files changed

+0
-162
lines changed

Cryptomator/MainCoordinator.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ class MainCoordinator: NSObject, Coordinator, UINavigationControllerDelegate {
7878
rootViewController.showDetailViewController(detailNavigationController, sender: nil)
7979
}
8080

81-
// Temporarily added for December 2024 Sale
82-
func showPurchase() {
83-
let modalNavigationController = BaseNavigationController()
84-
let child = PurchaseCoordinator(navigationController: modalNavigationController)
85-
childCoordinators.append(child)
86-
navigationController.topViewController?.present(modalNavigationController, animated: true)
87-
child.start()
88-
}
89-
9081
// MARK: - UINavigationControllerDelegate
9182

9283
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
@@ -124,8 +115,6 @@ extension MainCoordinator: StoreObserverDelegate {
124115
switch transaction {
125116
case .fullVersion, .yearlySubscription:
126117
showFullVersionAlert()
127-
// Temporarily added for December 2024 Sale
128-
NotificationCenter.default.post(name: .purchasedFullVersionNotification, object: nil)
129118
case let .freeTrial(expiresOn):
130119
showTrialAlert(expirationDate: expiresOn)
131120
case .unknown:

Cryptomator/Purchase/Cells/PurchaseCell.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import UIKit
1212

1313
struct PurchaseCellViewModel: Hashable {
1414
let productName: String
15-
let productDetail: String?
1615
let price: String
1716
let purchaseDetail: String?
1817
let purchaseButtonViewModel = PurchaseButtonViewModel()
@@ -37,7 +36,6 @@ class PurchaseCell: IAPCell {
3736

3837
func configure(with viewModel: PurchaseCellViewModel) {
3938
productTitleLabel.text = viewModel.productName
40-
productDetailLabel.text = viewModel.productDetail
4139
accessory.button.setTitle(viewModel.price, for: .normal)
4240
accessory.detailLabel.text = viewModel.purchaseDetail
4341
accessory.configure(with: viewModel.purchaseButtonViewModel)

Cryptomator/Purchase/PurchaseCoordinator.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ class PurchaseCoordinator: Coordinator {
5454
}
5555
self.unlockedPro()
5656
}
57-
// Temporarily added for December 2024 Sale
58-
NotificationCenter.default.post(name: .purchasedFullVersionNotification, object: nil)
5957
}
6058

6159
func handleRestoreResult(_ result: RestoreTransactionsResult) {

Cryptomator/Purchase/PurchaseViewModel.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,6 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching {
3333
return LocalizedString.getValue("purchase.title")
3434
}
3535

36-
// Temporarily added for December 2024 Sale
37-
override var infoText: NSAttributedString? {
38-
let currentYear = Calendar.current.component(.year, from: Date())
39-
let currentMonth = Calendar.current.component(.month, from: Date())
40-
if currentYear == 2024 && currentMonth == 12 {
41-
return NSAttributedString(
42-
string: "*Note: The discount amount may vary by region.",
43-
attributes: [
44-
.font: UIFont.preferredFont(forTextStyle: .footnote),
45-
.foregroundColor: UIColor.secondaryLabel
46-
]
47-
)
48-
} else {
49-
return nil
50-
}
51-
}
52-
5336
private let cryptomatorSettings: CryptomatorSettings
5437

5538
init(storeManager: IAPStore = StoreManager.shared, iapManager: IAPManager = StoreObserver.shared, cryptomatorSettings: CryptomatorSettings = CryptomatorUserDefaults.shared, minimumDisplayTime: TimeInterval = 1.0) {
@@ -73,7 +56,6 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching {
7356
cells.append(.trialCell(TrialCellViewModel(expirationDate: trialExpirationDate)))
7457
} else {
7558
cells.append(.purchaseCell(PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.trial"),
76-
productDetail: nil,
7759
price: LocalizedString.getValue("purchase.product.pricing.free"),
7860
purchaseDetail: LocalizedString.getValue("purchase.product.trial.duration"),
7961
productIdentifier: .thirtyDayTrial)))
@@ -83,7 +65,6 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching {
8365
private func addSubscriptionItem() {
8466
if let product = products[.yearlySubscription], let localizedPrice = product.localizedPrice {
8567
let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.yearlySubscription"),
86-
productDetail: nil,
8768
price: localizedPrice,
8869
purchaseDetail: LocalizedString.getValue("purchase.product.yearlySubscription.duration"),
8970
productIdentifier: .yearlySubscription)
@@ -93,12 +74,7 @@ class PurchaseViewModel: BaseIAPViewModel, ProductFetching {
9374

9475
private func addLifetimeLicenseItem() {
9576
if let product = products[.fullVersion], let localizedPrice = product.localizedPrice {
96-
// Temporarily added for December 2024 Sale
97-
let currentYear = Calendar.current.component(.year, from: Date())
98-
let currentMonth = Calendar.current.component(.month, from: Date())
99-
let productDetail = currentYear == 2024 && currentMonth == 12 ? "🎁 33%* off in December" : nil
10077
let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.lifetimeLicense"),
101-
productDetail: productDetail,
10278
price: localizedPrice,
10379
purchaseDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.duration"),
10480
productIdentifier: .fullVersion)

Cryptomator/Purchase/UpgradeViewModel.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class UpgradeViewModel: BaseIAPViewModel, ProductFetching {
3434
func addFreeUpgradeItem() {
3535
guard products[.freeUpgrade] != nil else { return }
3636
let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.freeUpgrade"),
37-
productDetail: nil,
3837
price: LocalizedString.getValue("purchase.product.pricing.free"),
3938
purchaseDetail: nil,
4039
productIdentifier: .freeUpgrade)
@@ -44,7 +43,6 @@ class UpgradeViewModel: BaseIAPViewModel, ProductFetching {
4443
func addPaidUpgradeItem() {
4544
if let product = products[.paidUpgrade], let localizedPrice = product.localizedPrice {
4645
let viewModel = PurchaseCellViewModel(productName: LocalizedString.getValue("purchase.product.donateAndUpgrade"),
47-
productDetail: nil,
4846
price: localizedPrice,
4947
purchaseDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.duration"),
5048
productIdentifier: .paidUpgrade)

Cryptomator/VaultList/VaultListViewController.swift

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ class VaultListViewController: ListViewController<VaultCellViewModel> {
1919
private let viewModel: VaultListViewModelProtocol
2020
private var willEnterForegroundObserver: NSObjectProtocol?
2121
@Dependency(\.fullVersionChecker) private var fullVersionChecker
22-
@Dependency(\.cryptomatorSettings) private var cryptomatorSettings
23-
24-
#if !ALWAYS_PREMIUM
25-
private var bannerView: UIView?
26-
private var fullVersionPurchasedObserver: NSObjectProtocol?
27-
#endif
2822

2923
init(with viewModel: VaultListViewModelProtocol) {
3024
self.viewModel = viewModel
@@ -55,13 +49,6 @@ class VaultListViewController: ListViewController<VaultCellViewModel> {
5549
DDLogError("Refresh vault lock states failed with error: \(error)")
5650
}
5751
}
58-
59-
#if !ALWAYS_PREMIUM
60-
fullVersionPurchasedObserver = NotificationCenter.default.addObserver(forName: .purchasedFullVersionNotification, object: nil, queue: .main) { [weak self] _ in
61-
self?.dismissBanner()
62-
}
63-
checkAndShowBanner()
64-
#endif
6552
}
6653

6754
override func viewWillAppear(_ animated: Bool) {
@@ -121,94 +108,4 @@ class VaultListViewController: ListViewController<VaultCellViewModel> {
121108
coordinator?.showVaultDetail(for: vaultCellViewModel.vault)
122109
}
123110
}
124-
125-
// MARK: - Discount Banner
126-
127-
#if !ALWAYS_PREMIUM
128-
private func checkAndShowBanner() {
129-
let currentYear = Calendar.current.component(.year, from: Date())
130-
let currentMonth = Calendar.current.component(.month, from: Date())
131-
if currentYear == 2024, currentMonth == 12, !(cryptomatorSettings.fullVersionUnlocked || cryptomatorSettings.hasRunningSubscription), !cryptomatorSettings.december2024BannerDismissed {
132-
showBanner()
133-
}
134-
}
135-
136-
private func showBanner() {
137-
let banner = UIView()
138-
banner.backgroundColor = UIColor.cryptomatorPrimary
139-
banner.translatesAutoresizingMaskIntoConstraints = false
140-
banner.layer.cornerRadius = 12
141-
banner.layer.masksToBounds = true
142-
143-
let emojiLabel = UILabel()
144-
emojiLabel.text = "🎁"
145-
emojiLabel.translatesAutoresizingMaskIntoConstraints = false
146-
emojiLabel.setContentHuggingPriority(.required, for: .horizontal)
147-
emojiLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
148-
149-
let textLabel = UILabel()
150-
textLabel.text = "Lifetime License is 33%* off in December!"
151-
textLabel.textColor = .white
152-
textLabel.font = UIFont.preferredFont(forTextStyle: .footnote)
153-
textLabel.adjustsFontSizeToFitWidth = true
154-
textLabel.minimumScaleFactor = 0.5
155-
textLabel.numberOfLines = 2
156-
textLabel.translatesAutoresizingMaskIntoConstraints = false
157-
158-
let dismissButton = UIButton(type: .close)
159-
dismissButton.addTarget(self, action: #selector(dismissBanner), for: .touchUpInside)
160-
dismissButton.translatesAutoresizingMaskIntoConstraints = false
161-
dismissButton.setContentHuggingPriority(.required, for: .horizontal)
162-
dismissButton.setContentCompressionResistancePriority(.required, for: .horizontal)
163-
164-
banner.addSubview(emojiLabel)
165-
banner.addSubview(textLabel)
166-
banner.addSubview(dismissButton)
167-
168-
NSLayoutConstraint.activate([
169-
emojiLabel.leadingAnchor.constraint(equalTo: banner.leadingAnchor, constant: 16),
170-
emojiLabel.centerYAnchor.constraint(equalTo: banner.centerYAnchor),
171-
172-
textLabel.leadingAnchor.constraint(equalTo: emojiLabel.trailingAnchor, constant: 8),
173-
textLabel.centerYAnchor.constraint(equalTo: banner.centerYAnchor),
174-
175-
dismissButton.leadingAnchor.constraint(equalTo: textLabel.trailingAnchor, constant: 8),
176-
dismissButton.trailingAnchor.constraint(equalTo: banner.trailingAnchor, constant: -16),
177-
dismissButton.centerYAnchor.constraint(equalTo: banner.centerYAnchor)
178-
])
179-
180-
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(bannerTapped))
181-
banner.addGestureRecognizer(tapGestureRecognizer)
182-
183-
view.addSubview(banner)
184-
185-
NSLayoutConstraint.activate([
186-
banner.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16),
187-
banner.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16),
188-
banner.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -16),
189-
banner.centerXAnchor.constraint(equalTo: view.centerXAnchor),
190-
banner.heightAnchor.constraint(equalToConstant: 50)
191-
])
192-
193-
bannerView = banner
194-
}
195-
196-
@objc private func dismissBanner() {
197-
UIView.animate(withDuration: 0.3, animations: {
198-
self.bannerView?.alpha = 0
199-
}, completion: { _ in
200-
self.bannerView?.removeFromSuperview()
201-
self.bannerView = nil
202-
})
203-
CryptomatorUserDefaults.shared.december2024BannerDismissed = true
204-
}
205-
206-
@objc private func bannerTapped() {
207-
coordinator?.showPurchase()
208-
}
209-
#endif
210-
}
211-
212-
extension Notification.Name {
213-
static let purchasedFullVersionNotification = Notification.Name("PurchasedFullVersionNotification")
214111
}

CryptomatorCommon/Sources/CryptomatorCommonCore/CryptomatorUserDefaults.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ public protocol CryptomatorSettings {
1515
var trialExpirationDate: Date? { get set }
1616
var fullVersionUnlocked: Bool { get set }
1717
var hasRunningSubscription: Bool { get set }
18-
#if !ALWAYS_PREMIUM
19-
var december2024BannerDismissed: Bool { get set }
20-
#endif
2118
}
2219

2320
private enum CryptomatorSettingsKey: DependencyKey {
@@ -111,11 +108,4 @@ extension CryptomatorUserDefaults: CryptomatorSettings {
111108
get { read() ?? false }
112109
set { write(value: newValue) }
113110
}
114-
115-
#if !ALWAYS_PREMIUM
116-
public var december2024BannerDismissed: Bool {
117-
get { read() ?? false }
118-
set { write(value: newValue) }
119-
}
120-
#endif
121111
}

CryptomatorCommon/Sources/CryptomatorCommonCore/Mocks/CryptomatorSettingsMock.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@ class CryptomatorSettingsMock: CryptomatorSettings {
1414
var debugModeEnabled: Bool = false
1515
var fullVersionUnlocked: Bool = false
1616
var hasRunningSubscription: Bool = false
17-
#if !ALWAYS_PREMIUM
18-
var december2024BannerDismissed: Bool = false
19-
#endif
2017
}
2118
#endif

CryptomatorTests/Purchase/PurchaseViewModelTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,23 +153,20 @@ class PurchaseViewModelTests: IAPViewModelTestCase {
153153

154154
private var purchaseTrialCell: Item {
155155
return .purchaseCell(.init(productName: LocalizedString.getValue("purchase.product.trial"),
156-
productDetail: nil,
157156
price: LocalizedString.getValue("purchase.product.pricing.free"),
158157
purchaseDetail: LocalizedString.getValue("purchase.product.trial.duration"),
159158
productIdentifier: .thirtyDayTrial))
160159
}
161160

162161
private var yearlySubscriptionCell: Item {
163162
return .purchaseCell(.init(productName: LocalizedString.getValue("purchase.product.yearlySubscription"),
164-
productDetail: nil,
165163
price: "$5.99",
166164
purchaseDetail: LocalizedString.getValue("purchase.product.yearlySubscription.duration"),
167165
productIdentifier: .yearlySubscription))
168166
}
169167

170168
private var lifetimeLicenseCell: Item {
171169
return .purchaseCell(.init(productName: LocalizedString.getValue("purchase.product.lifetimeLicense"),
172-
productDetail: nil,
173170
price: "$11.99",
174171
purchaseDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.duration"),
175172
productIdentifier: .fullVersion))

CryptomatorTests/Purchase/UpgradeViewModelTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,13 @@ class UpgradeViewModelTests: IAPViewModelTestCase {
7777

7878
private var freeUpgradeCell: Item {
7979
return .purchaseCell(.init(productName: LocalizedString.getValue("purchase.product.freeUpgrade"),
80-
productDetail: nil,
8180
price: LocalizedString.getValue("purchase.product.pricing.free"),
8281
purchaseDetail: nil,
8382
productIdentifier: .freeUpgrade))
8483
}
8584

8685
private var paidUpgradeCell: Item {
8786
return .purchaseCell(.init(productName: LocalizedString.getValue("purchase.product.donateAndUpgrade"),
88-
productDetail: nil,
8987
price: "$1.99",
9088
purchaseDetail: LocalizedString.getValue("purchase.product.lifetimeLicense.duration"),
9189
productIdentifier: .paidUpgrade))

0 commit comments

Comments
 (0)