From 5e700f7daa5bc5040ae0465e0629f54661b5b0bb Mon Sep 17 00:00:00 2001 From: Rasmus Tauts Date: Fri, 15 Sep 2023 09:54:48 +0300 Subject: [PATCH] fixup! Convert ConfirmationView form UIKit to SwiftUI This PR is experimental, yet important first step towards transitioning to SwiftUI. ConfirmationView has been rewritten entirely in SwiftUI. The primary motivator for this PR was the frustrating nature of UIKit constraints. Key factors to keep in mind while reviewing: 1. Checkmark image has been made smaller, which was the request from the design team 2. UIFont does not translate 1:1 to SwiftUI Font, meaning the same font looks just a little big different now. But dynamic scaling works, and all our default fonts translate to expected outcome (font size, weight etc.) 3. Some approaches used in view layouts is due to the restrictions of SwiftUI 1.0 capabilities. Those can and will be upgraded in the future 4. The naming of Views, and Objects, as well as file locations in the directory are up for discussion. Everyone's input is much appreciated. 5. Prefix SwiftUI is used in lots of places due to a conflict with existing custom objects Button and Image 6. New HeaderSwiftUI view does not include all the possible configuration possibilities, as confirmations view's needs are not very demanding. So, that view can be upgraded in future. This PR also covers the ticket MOB-2488 which focuses on ADA-compliance in ConfigurationsView --- .../SecureConversations.ConfirmationViewModel.swift | 2 +- .../SwiftUI/Components/Buttons/ActionButtonSwiftUI.swift | 2 +- .../SwiftUI/Components/Buttons/HeaderButtonSwiftUI.swift | 2 +- GliaWidgets/SwiftUI/Components/Header/HeaderSwiftUI.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GliaWidgets/SecureConversations/Confirmation/SecureConversations.ConfirmationViewModel.swift b/GliaWidgets/SecureConversations/Confirmation/SecureConversations.ConfirmationViewModel.swift index 07249e736..63d2e6e39 100644 --- a/GliaWidgets/SecureConversations/Confirmation/SecureConversations.ConfirmationViewModel.swift +++ b/GliaWidgets/SecureConversations/Confirmation/SecureConversations.ConfirmationViewModel.swift @@ -1,7 +1,7 @@ import Foundation extension SecureConversations.ConfirmationViewSwiftUI { - class Model: ObservableObject { + final class Model: ObservableObject { let orientation: OrientationManager let style: SecureConversations.ConfirmationStyle var delegate: ((DelegateEvent) -> Void)? diff --git a/GliaWidgets/SwiftUI/Components/Buttons/ActionButtonSwiftUI.swift b/GliaWidgets/SwiftUI/Components/Buttons/ActionButtonSwiftUI.swift index 96c92b465..dde080750 100644 --- a/GliaWidgets/SwiftUI/Components/Buttons/ActionButtonSwiftUI.swift +++ b/GliaWidgets/SwiftUI/Components/Buttons/ActionButtonSwiftUI.swift @@ -33,7 +33,7 @@ struct ActionButtonSwiftUI: View { } extension ActionButtonSwiftUI { - class Model: ObservableObject { + final class Model: ObservableObject { let style: ActionButtonStyle let height: CGFloat let tap: Cmd diff --git a/GliaWidgets/SwiftUI/Components/Buttons/HeaderButtonSwiftUI.swift b/GliaWidgets/SwiftUI/Components/Buttons/HeaderButtonSwiftUI.swift index 6a488132f..48b86e49d 100644 --- a/GliaWidgets/SwiftUI/Components/Buttons/HeaderButtonSwiftUI.swift +++ b/GliaWidgets/SwiftUI/Components/Buttons/HeaderButtonSwiftUI.swift @@ -29,7 +29,7 @@ struct HeaderButtonSwiftUI: View { } extension HeaderButtonSwiftUI { - class Model: ObservableObject { + final class Model: ObservableObject { var tap: Cmd var style: HeaderButtonStyle var size: CGSize diff --git a/GliaWidgets/SwiftUI/Components/Header/HeaderSwiftUI.swift b/GliaWidgets/SwiftUI/Components/Header/HeaderSwiftUI.swift index ca0adf74b..f81557dac 100644 --- a/GliaWidgets/SwiftUI/Components/Header/HeaderSwiftUI.swift +++ b/GliaWidgets/SwiftUI/Components/Header/HeaderSwiftUI.swift @@ -47,7 +47,7 @@ struct HeaderSwiftUI: View { } extension HeaderSwiftUI { - class Model: ObservableObject { + final class Model: ObservableObject { let title: String let effect: Effect let endButton: ActionButtonSwiftUI.Model