From 1356735046b5ed4ff560a9da7065875616cdf9f5 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Mon, 15 Jan 2024 16:10:33 -0500 Subject: [PATCH] readded the didStartEditing Signed-off-by: kcw-grunt --- litewallet/AddressFieldView.swift | 4 +++- litewallet/SendAddressCellView.swift | 12 ++++++++++-- litewallet/SendAddressCellViewModel.swift | 3 --- litewallet/SendAddressHostingController.swift | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/litewallet/AddressFieldView.swift b/litewallet/AddressFieldView.swift index e1378c2a2..76c956edf 100644 --- a/litewallet/AddressFieldView.swift +++ b/litewallet/AddressFieldView.swift @@ -37,7 +37,9 @@ struct AddressFieldView: UIViewRepresentable { } func updateUIView(_ uiView: UITextField, context _: Context) { - uiView.text = text + DispatchQueue.main.async { + uiView.text = text + } } func makeCoordinator() -> Coordinator { diff --git a/litewallet/SendAddressCellView.swift b/litewallet/SendAddressCellView.swift index 892825ca2..acd0c550f 100644 --- a/litewallet/SendAddressCellView.swift +++ b/litewallet/SendAddressCellView.swift @@ -6,6 +6,9 @@ struct SendAddressCellView: View { @ObservedObject var viewModel = SendAddressCellViewModel() + @State + private var didStartEditing: Bool = false + let actionButtonWidth: CGFloat = 45.0 let textFieldHeight: CGFloat = 45.0 @@ -20,6 +23,9 @@ struct SendAddressCellView: View { VStack { AddressFieldView(placeholder: S.Send.enterLTCAddressLabel.localize(), text: $viewModel.addressString) + .onTapGesture { + didStartEditing = true + } .frame(height: textFieldHeight, alignment: .leading) } .padding(.leading, swiftUICellPadding) @@ -33,9 +39,11 @@ struct SendAddressCellView: View { HStack { ZStack { RoundedRectangle(cornerRadius: 4) - .frame(width: actionButtonWidth, height: 30, alignment: .center) + .frame(width: actionButtonWidth, height: 30, + alignment: .center) .foregroundColor(Color(UIColor.secondaryButton)) - .shadow(color: Color(UIColor.grayTextTint), radius: 3, x: 0, y: 4).padding(.trailing, 3.0) + .shadow(color: Color(UIColor.grayTextTint), radius: 3, x: 0, y: 4) + .padding(.trailing, 3.0) Text(S.Send.pasteLabel.localize()) .frame(width: actionButtonWidth, height: 30, alignment: .center) diff --git a/litewallet/SendAddressCellViewModel.swift b/litewallet/SendAddressCellViewModel.swift index 8f4fad9ea..81df08bf0 100644 --- a/litewallet/SendAddressCellViewModel.swift +++ b/litewallet/SendAddressCellViewModel.swift @@ -6,9 +6,6 @@ class SendAddressCellViewModel: ObservableObject { @Published var addressString: String = "" - @Published - var didUpdatePaste: Bool = false - // MARK: - Public Variables var shouldPasteAddress: (() -> Void)? diff --git a/litewallet/SendAddressHostingController.swift b/litewallet/SendAddressHostingController.swift index 15e69fdf3..4939d3334 100644 --- a/litewallet/SendAddressHostingController.swift +++ b/litewallet/SendAddressHostingController.swift @@ -8,6 +8,7 @@ class SendAddressHostingController: UIHostingController { init() { addressString = contentView.viewModel.addressString + super.init(rootView: contentView) }