summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authormojganii <mojgan.jelodar@codic.se>2025-01-22 14:58:37 +0100
committermojganii <mojgan.jelodar@codic.se>2025-01-22 15:52:58 +0100
commit47d25e64aeddda7a4a281d6cc343c98ef11e2f6d (patch)
tree673e1757ac05b3b897c0806a51a0c5fedd7b4551 /ios
parent01441187fc255e7134938f9e242d4b8ee3c7105c (diff)
downloadmullvadvpn-47d25e64aeddda7a4a281d6cc343c98ef11e2f6d.tar.xz
mullvadvpn-47d25e64aeddda7a4a281d6cc343c98ef11e2f6d.zip
Fix crash on showing alert for in-app purchase
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadVPN/Coordinators/LocationCoordinator.swift2
-rw-r--r--ios/MullvadVPN/Extensions/UIAlertController+InAppPurchase.swift16
-rw-r--r--ios/MullvadVPN/UI appearance/UIColor+Palette.swift4
3 files changed, 16 insertions, 6 deletions
diff --git a/ios/MullvadVPN/Coordinators/LocationCoordinator.swift b/ios/MullvadVPN/Coordinators/LocationCoordinator.swift
index e62defb9b4..ac8d3ef8f9 100644
--- a/ios/MullvadVPN/Coordinators/LocationCoordinator.swift
+++ b/ios/MullvadVPN/Coordinators/LocationCoordinator.swift
@@ -273,7 +273,7 @@ extension LocationCoordinator: @preconcurrency LocationViewControllerWrapperDele
preferredStyle: UIDevice.current.userInterfaceIdiom == .pad ? .alert : .actionSheet
)
actionSheet.overrideUserInterfaceStyle = .dark
- actionSheet.view.tintColor = UIColor(red: 0.0, green: 0.59, blue: 1.0, alpha: 1)
+ actionSheet.view.tintColor = .AlertController.tintColor
let addCustomListAction = UIAlertAction(
title: NSLocalizedString(
diff --git a/ios/MullvadVPN/Extensions/UIAlertController+InAppPurchase.swift b/ios/MullvadVPN/Extensions/UIAlertController+InAppPurchase.swift
index b94b457b5a..c7096d91f0 100644
--- a/ios/MullvadVPN/Extensions/UIAlertController+InAppPurchase.swift
+++ b/ios/MullvadVPN/Extensions/UIAlertController+InAppPurchase.swift
@@ -20,20 +20,26 @@ extension UIAlertController {
value: "Add Time",
comment: ""
)
- let alert = UIAlertController(title: localizedString, message: nil, preferredStyle: .actionSheet)
+ let actionSheet = UIAlertController(
+ title: localizedString,
+ message: nil,
+ preferredStyle: UIDevice.current.userInterfaceIdiom == .pad ? .alert : .actionSheet
+ )
+ actionSheet.overrideUserInterfaceStyle = .dark
+ actionSheet.view.tintColor = .AlertController.tintColor
products.sortedByPrice().forEach { product in
guard let localizedTitle = product.customLocalizedTitle else {
return
}
let action = UIAlertAction(title: localizedTitle, style: .default, handler: { _ in
- alert.dismiss(animated: true, completion: {
+ actionSheet.dismiss(animated: true, completion: {
didRequestPurchase(product)
})
})
action
.accessibilityIdentifier =
"\(AccessibilityIdentifier.purchaseButton.asString)_\(product.productIdentifier)"
- alert.addAction(action)
+ actionSheet.addAction(action)
}
let cancelAction = UIAlertAction(title: NSLocalizedString(
"PRODUCT_LIST_CANCEL_BUTTON",
@@ -42,7 +48,7 @@ extension UIAlertController {
comment: ""
), style: .cancel)
cancelAction.accessibilityIdentifier = AccessibilityIdentifier.cancelPurchaseListButton.asString
- alert.addAction(cancelAction)
- return alert
+ actionSheet.addAction(cancelAction)
+ return actionSheet
}
}
diff --git a/ios/MullvadVPN/UI appearance/UIColor+Palette.swift b/ios/MullvadVPN/UI appearance/UIColor+Palette.swift
index df7c675a41..6ee04da045 100644
--- a/ios/MullvadVPN/UI appearance/UIColor+Palette.swift
+++ b/ios/MullvadVPN/UI appearance/UIColor+Palette.swift
@@ -144,6 +144,10 @@ extension UIColor {
static let selectedColor = successColor
}
+ enum AlertController {
+ static let tintColor = UIColor(red: 0.0, green: 0.59, blue: 1.0, alpha: 1)
+ }
+
// Common colors
static let primaryColor = UIColor(red: 0.16, green: 0.30, blue: 0.45, alpha: 1.0)
static let secondaryColor = UIColor(red: 0.10, green: 0.18, blue: 0.27, alpha: 1.0)