diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2023-04-27 17:57:18 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-04-28 13:52:56 +0200 |
| commit | f336f681548798ec08ea650b107b15fa1af27d10 (patch) | |
| tree | c3f7c2fae5d6430d680def292fda5dca8a644af7 | |
| parent | bc1f1642ec674e62a4cf702811babcd78c118ca8 (diff) | |
| download | mullvadvpn-f336f681548798ec08ea650b107b15fa1af27d10.tar.xz mullvadvpn-f336f681548798ec08ea650b107b15fa1af27d10.zip | |
Revert conformance to Equatable the way it was
| -rw-r--r-- | ios/MullvadVPN/Notifications/InAppNotificationDescriptor.swift | 20 | ||||
| -rw-r--r-- | ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/ios/MullvadVPN/Notifications/InAppNotificationDescriptor.swift b/ios/MullvadVPN/Notifications/InAppNotificationDescriptor.swift index 63bc9810e3..f2af95365b 100644 --- a/ios/MullvadVPN/Notifications/InAppNotificationDescriptor.swift +++ b/ios/MullvadVPN/Notifications/InAppNotificationDescriptor.swift @@ -10,7 +10,7 @@ import Foundation import UIKit.UIImage /// Struct describing in-app notification. -struct InAppNotificationDescriptor { +struct InAppNotificationDescriptor: Equatable { /// Notification identifier. var identifier: String @@ -23,19 +23,21 @@ struct InAppNotificationDescriptor { /// Notification body. var body: NSAttributedString - /// Notification action + /// Notification action. var action: InAppNotificationAction? } -extension InAppNotificationDescriptor: Equatable { - static func == (lhs: InAppNotificationDescriptor, rhs: InAppNotificationDescriptor) -> Bool { - lhs.identifier == rhs.identifier - } -} - -struct InAppNotificationAction { +/// Type describing a specific in-app notification action. +struct InAppNotificationAction: Equatable { + /// Image assigned to action button. var image: UIImage? + + /// Action handler for button. var handler: (() -> Void)? + + static func == (lhs: InAppNotificationAction, rhs: InAppNotificationAction) -> Bool { + return lhs.image == rhs.image + } } enum NotificationBannerStyle { diff --git a/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift b/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift index 53020f48c6..82fa7a7001 100644 --- a/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift +++ b/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift @@ -89,7 +89,7 @@ final class NotificationBannerView: UIView { var actionHandler: InAppNotificationAction? { didSet { - actionButton.setImage(actionHandler?.image, for: .normal) + actionButton.setImage(actionHandler?.type.image, for: .normal) actionButton.addTarget(self, action: #selector(didPress), for: .touchUpInside) } } |
