From 7d712f1e6f7837cb9a2040d2265fca73578e9a33 Mon Sep 17 00:00:00 2001
From: Oleg <oleg@unstoppabledomains.com>
Date: Fri, 28 Jun 2024 13:42:46 +0300
Subject: [PATCH 1/3] Fixed preview target

---
 .../AppContext/PreviewCoinRecordsService.swift              | 6 +++---
 .../AppContext/PreviewUDWalletsService.swift                | 2 +-
 .../Entities/PreviewMPCConnector.swift                      | 2 +-
 .../Entities/PreviewUDWallet.swift                          | 4 +++-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewCoinRecordsService.swift b/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewCoinRecordsService.swift
index 0deb331f1..c9286890b 100644
--- a/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewCoinRecordsService.swift
+++ b/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewCoinRecordsService.swift
@@ -13,17 +13,17 @@ final class CoinRecordsService: CoinRecordsServiceProtocol {
         [.init(ticker: "ETH",
                version: nil,
                expandedTicker: "crypto.ETH", 
-               regexPattern: CoinRegexPattern.eth.regex,
+               regexPattern: CoinRegexPattern.ETH.regex,
                isDeprecated: false),
          .init(ticker: "MATIC",
                version: nil,
                expandedTicker: "crypto.MATIC",
-               regexPattern: CoinRegexPattern.eth.regex,
+               regexPattern: CoinRegexPattern.ETH.regex,
                isDeprecated: false),
          .init(ticker: "BTC",
                version: nil,
                expandedTicker: "crypto.BTC.address",
-               regexPattern: CoinRegexPattern.btc.regex,
+               regexPattern: CoinRegexPattern.BTC.regex,
                isDeprecated: false)]
     }
     
diff --git a/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewUDWalletsService.swift b/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewUDWalletsService.swift
index 77c5b5252..39c924cd5 100644
--- a/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewUDWalletsService.swift
+++ b/unstoppable-ios-app/domains-manager-ios-preview/AppContext/PreviewUDWalletsService.swift
@@ -54,7 +54,7 @@ final class UDWalletsService: UDWalletsServiceProtocol {
     
     func createMPCWallet(ethAddress: HexAddress,
                          mpcMetadata: MPCWalletMetadata) throws -> UDWallet {
-        UDWallet.createMPC(address: ethAddress, mpcMetadata: mpcMetadata)
+        UDWallet.createMPC(address: ethAddress, aliasName: "Lite Wallet", mpcMetadata: mpcMetadata)
     }
     
     
diff --git a/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewMPCConnector.swift b/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewMPCConnector.swift
index f60194825..97ab5a51c 100644
--- a/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewMPCConnector.swift
+++ b/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewMPCConnector.swift
@@ -66,7 +66,7 @@ extension FB_UD_MPC {
             return .init(accessToken: "", deviceId: "")
         }
         
-        func startMessageSigning(accessToken: String, accountId: String, assetId: String, message: String, encoding: FB_UD_MPC.SignMessageEncoding) async throws -> FB_UD_MPC.OperationDetails {
+        func startMessageSigning(accessToken: String, accountId: String, assetId: String, message: String, signingType: FB_UD_MPC.MessageSigningType) async throws -> FB_UD_MPC.OperationDetails {
             await Task.sleep(seconds: 0.5)
             return .init(id: "", status: "", type: "")
         }
diff --git a/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewUDWallet.swift b/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewUDWallet.swift
index 6a3916c92..abaf0c231 100644
--- a/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewUDWallet.swift
+++ b/unstoppable-ios-app/domains-manager-ios-preview/Entities/PreviewUDWallet.swift
@@ -49,8 +49,10 @@ struct UDWallet: Codable, Hashable {
     }
     
     static func createMPC(address: String,
+                          aliasName: String,
                           mpcMetadata: MPCWalletMetadata) -> UDWallet {
-        .init(address: address,
+        .init(aliasName: aliasName,
+              address: address,
               type: .mpc,
               mpcMetadata: mpcMetadata)
     }

From da74a0f916d6f912a2d3fa78923df292db470b10 Mon Sep 17 00:00:00 2001
From: Oleg <oleg@unstoppabledomains.com>
Date: Fri, 28 Jun 2024 14:44:52 +0300
Subject: [PATCH 2/3] Fixed Profile details UI

---
 .../BaseSignTransactionView.swift             |  4 +-
 ...ConnectServerRequestConfirmationView.swift | 64 ++-----------------
 .../SignMessageRequestConfirmationView.swift  |  1 -
 ...ntTransactionRequestConfirmationView.swift |  2 +-
 .../UI/Buttons/SelectorButton.swift           |  1 +
 5 files changed, 8 insertions(+), 64 deletions(-)

diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/BaseSignTransactionView/BaseSignTransactionView.swift b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/BaseSignTransactionView/BaseSignTransactionView.swift
index fd82b8b55..c591b4ea0 100644
--- a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/BaseSignTransactionView/BaseSignTransactionView.swift
+++ b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/BaseSignTransactionView/BaseSignTransactionView.swift
@@ -67,7 +67,7 @@ class BaseSignTransactionView: UIView, SelfNameable, NibInstantiateable {
         
         let walletInfoStack = UIStackView(arrangedSubviews: [walletImageView, walletNameButton])
         walletInfoStack.axis = .horizontal
-        walletInfoStack.spacing = -2
+        walletInfoStack.spacing = 8
         walletInfoStack.alignment = .center
 
         let walletLabel = UILabel()
@@ -149,7 +149,7 @@ extension BaseSignTransactionView {
                 walletImageView.isHidden = wallet.rrDomain == nil
             }
         }
-        walletNameButton?.setTitle(wallet.domainOrDisplayName, image: isSelectable ? .chevronDown : nil)
+        walletNameButton?.setTitle(wallet.domainOrDisplayName, image: nil)
         walletNameButton?.setSelectorEnabled(isSelectable)
     }
     
diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/ConnectWalletRequestConfirmationView/ConnectServerRequestConfirmationView.swift b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/ConnectWalletRequestConfirmationView/ConnectServerRequestConfirmationView.swift
index 6a74c3f02..3f14a1dd9 100644
--- a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/ConnectWalletRequestConfirmationView/ConnectServerRequestConfirmationView.swift
+++ b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/ConnectWalletRequestConfirmationView/ConnectServerRequestConfirmationView.swift
@@ -12,9 +12,6 @@ final class ConnectServerRequestConfirmationView: BaseSignTransactionView {
     
     private var networkSelectorButton: SelectorButton?
     private var networkIndicator: UIImageView?
-    private var walletInfoStackView: UIStackView?
-    private var networkFullStackView: UIStackView?
-    private var bottomStackView: UIStackView?
     private var supportedChains: [BlockchainType] = []
     private var cancellables: Set<AnyCancellable> = []
 
@@ -40,9 +37,6 @@ extension ConnectServerRequestConfirmationView {
         setNetworkFrom(appInfo: connectionConfig.appInfo)
         setWith(appInfo: connectionConfig.appInfo)
         setWithWallet(connectionConfig.wallet)
-        networkFullStackView?.isHidden = true
-        bottomStackView?.axis = .vertical
-        walletInfoStackView?.axis = .horizontal
 
         let blockchainType = getChainFromAppInfo(connectionConfig.appInfo)
         set(selectedChain: blockchainType)
@@ -57,55 +51,15 @@ private extension ConnectServerRequestConfirmationView {
     
     func addWalletInfo() {
         let walletStack = buildWalletInfoView()
-        walletStack.axis = .vertical
-        walletStack.alignment = .leading
-        walletStack.spacing = 6
-        self.walletInfoStackView = walletStack
-        
-        let networkTitleLabel = UILabel()
-        networkTitleLabel.translatesAutoresizingMaskIntoConstraints = false
-        networkTitleLabel.setAttributedTextWith(text: String.Constants.network.localized(),
-                                           font: .currentFont(withSize: 14, weight: .medium),
-                                           textColor: .foregroundSecondary,
-                                           alignment: .right,
-                                           lineHeight: 20)
-        
-        let networkSelectorButton = createNetworkSelectorButton()
-        self.networkSelectorButton = networkSelectorButton
-        
-        let networkIndicator = createNetworkIndicator()
-        self.networkIndicator = networkIndicator
-        
-        let networkIndicatorStack = UIStackView(arrangedSubviews: [networkIndicator, networkSelectorButton])
-        networkIndicatorStack.axis = .horizontal
-        networkIndicatorStack.alignment = .center
-        networkIndicatorStack.spacing = 8
-        
-        let networkFullStack = UIStackView(arrangedSubviews: [networkTitleLabel, networkIndicatorStack])
-        networkFullStack.axis = .vertical
-        networkFullStack.alignment = .trailing
-        networkFullStack.spacing = 6
-        self.networkFullStackView = networkFullStack
-        
-        let bottomStack = UIStackView(arrangedSubviews: [walletStack, networkFullStack])
-        bottomStack.spacing = 16
-        bottomStack.axis = .horizontal
+        walletStack.axis = .horizontal
+
+        let bottomStack = UIStackView(arrangedSubviews: [walletStack])
+        bottomStack.axis = .vertical
         bottomStack.alignment = .center
-        bottomStack.distribution = .fillEqually
-        self.bottomStackView = bottomStack
         
         contentStackView.addArrangedSubview(bottomStack)
     }
     
-    func createNetworkSelectorButton() -> SelectorButton {
-        let networkSelectorButton = SelectorButton()
-        networkSelectorButton.customTitleEdgePadding = 0
-        networkSelectorButton.translatesAutoresizingMaskIntoConstraints = false
-        networkSelectorButton.heightAnchor.constraint(equalToConstant: 22).isActive = true
-        
-        return networkSelectorButton
-    }
-    
     func set(selectedChain: BlockchainType) {
         guard let networkSelectorButton = self.networkSelectorButton else { return }
 
@@ -137,16 +91,6 @@ private extension ConnectServerRequestConfirmationView {
         networkIndicator?.image = UIImage.getNetworkLargeIcon(by: selectedChain)
     }
     
-    func createNetworkIndicator() -> UIImageView {
-        let indicator = UIImageView()
-        indicator.translatesAutoresizingMaskIntoConstraints = false
-        indicator.tintColor = .foregroundWarning
-        indicator.heightAnchor.constraint(equalToConstant: 20).isActive = true
-        indicator.widthAnchor.constraint(equalTo: indicator.heightAnchor, multiplier: 1).isActive = true
-        
-        return indicator
-    }
-    
     func didSelectBlockchainType(_ blockchainType: BlockchainType) {
         logAnalytic(event: .didSelectChainNetwork,
                     parameters: [.chainNetwork: blockchainType.rawValue])
diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift
index c49f96e85..38f5414fc 100644
--- a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift
+++ b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift
@@ -44,7 +44,6 @@ private extension SignMessageRequestConfirmationView {
     func addWalletInfo() {
         let walletStackView = buildWalletInfoView()
         walletStackView.axis = .horizontal
-        walletStackView.spacing = 16
 
         let wrapStack = UIStackView(arrangedSubviews: [walletStackView])
         wrapStack.axis = .vertical
diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/TransactionRequestConfirmationView/PaymentTransactionRequestConfirmationView.swift b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/TransactionRequestConfirmationView/PaymentTransactionRequestConfirmationView.swift
index 1756c4303..2458b6c85 100644
--- a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/TransactionRequestConfirmationView/PaymentTransactionRequestConfirmationView.swift
+++ b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/TransactionRequestConfirmationView/PaymentTransactionRequestConfirmationView.swift
@@ -150,7 +150,7 @@ private extension PaymentTransactionRequestConfirmationView {
         let walletStack = buildWalletInfoView()
         walletStack.axis = .vertical
         walletStack.alignment = .leading
-        walletStack.spacing = 6
+        walletStack.spacing = 16
 
         let balanceLabel = UILabel()
         balanceLabel.translatesAutoresizingMaskIntoConstraints = false
diff --git a/unstoppable-ios-app/domains-manager-ios/UI/Buttons/SelectorButton.swift b/unstoppable-ios-app/domains-manager-ios/UI/Buttons/SelectorButton.swift
index ab09b9dfb..aee06433a 100644
--- a/unstoppable-ios-app/domains-manager-ios/UI/Buttons/SelectorButton.swift
+++ b/unstoppable-ios-app/domains-manager-ios/UI/Buttons/SelectorButton.swift
@@ -34,6 +34,7 @@ final class SelectorButton: BaseButton {
     override func additionalSetup() {
         titleLeftPadding = 0
         titleRightPadding = 0
+        customImageEdgePadding = 0
     }
     
 }

From af3426c386da64d559ba6b9af069a1bbc949a5b6 Mon Sep 17 00:00:00 2001
From: Oleg <oleg@unstoppabledomains.com>
Date: Fri, 28 Jun 2024 15:10:47 +0300
Subject: [PATCH 3/3] Improved UI for sign typed data request

---
 .../PreviewWCRequests/PreviewWCRequests.swift | 33 +++++++++++++++++--
 .../SignMessageRequestConfirmationView.swift  |  6 ++--
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/unstoppable-ios-app/domains-manager-ios-preview/Modules/PreviewWCRequests/PreviewWCRequests.swift b/unstoppable-ios-app/domains-manager-ios-preview/Modules/PreviewWCRequests/PreviewWCRequests.swift
index ead8a1935..32f0c1f59 100644
--- a/unstoppable-ios-app/domains-manager-ios-preview/Modules/PreviewWCRequests/PreviewWCRequests.swift
+++ b/unstoppable-ios-app/domains-manager-ios-preview/Modules/PreviewWCRequests/PreviewWCRequests.swift
@@ -15,9 +15,10 @@ import SwiftUI
     DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
         Task {
             let connectConfiguration = createConnectConfiguration()
-            let signConfiguration = createSignConfiguration()
+            let personalSignConfiguration = createSignConfiguration()
+            let signTypedDataConfiguration = createSignTypedDataConfiguration()
             let paymentConfiguration = createPaymentConfiguration()
-            _ = try? await appContext.pullUpViewService.showWCRequestConfirmationPullUp(for: connectConfiguration,
+            _ = try? await appContext.pullUpViewService.showWCRequestConfirmationPullUp(for: signTypedDataConfiguration,
                                                                                             in: vc)
         }
     }
@@ -44,6 +45,34 @@ private func createSignMessageTransactionUIConfiguration() -> SignMessageTransac
     .init(connectionConfig: createWalletConnectConfig(), signingMessage: "lakjsdasdjalsdjaslkdjalsdkj ald")
 }
 
+private func createSignTypedDataConfiguration() -> WCRequestUIConfiguration {
+    .signMessage(createSignTypedDataTxUIConfiguration())
+}
+
+private func createSignTypedDataTxUIConfiguration() -> SignMessageTransactionUIConfiguration {
+    let mes = """
+{
+  "domain": {
+    "name": "Seaport",
+    "version": "1.6",
+    "chainId": "80002",
+    "verifyingContract": "0x0000000000000068f116a894984e2db1123eb395"
+  },
+  "primaryType": "OrderComponents",
+  "message": {
+    "orderType": "2",
+    "startTime": "1719566337",
+    "endTime": "1751102337",
+    "zoneHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
+    "salt": "17103359048027891009",
+    "conduitKey": "0x0000000000000000000000000000000000000000000000000000000000000000",
+    "counter": "0"
+  }
+}
+"""
+    return .init(connectionConfig: createWalletConnectConfig(), signingMessage: mes)
+}
+
 private func createPaymentConfiguration() -> WCRequestUIConfiguration {
     .payment(createSignPaymentTransactionUIConfiguration())
 }
diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift
index 38f5414fc..60efc2c2f 100644
--- a/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift
+++ b/unstoppable-ios-app/domains-manager-ios/Modules/SignTransactions/SignMessageRequestConfirmationView/SignMessageRequestConfirmationView.swift
@@ -56,7 +56,9 @@ private extension SignMessageRequestConfirmationView {
 enum DisplayedMessageType {
     static let lineHeight: CGFloat = 24
     static let padding: CGFloat = 16
-    static let maxTextViewHeight: CGFloat = 176
+    static let maxTextViewHeight: CGFloat = {
+        deviceSize.isIPSE ? 220 : 320
+    }()
     static let font: UIFont = .currentFont(withSize: 16, weight: .regular)
 
     case simpleMessage(String)
@@ -95,7 +97,7 @@ enum DisplayedMessageType {
     }
     
     private func getTypedDataViewHeight() -> CGFloat {
-        return 300
+        return Self.maxTextViewHeight
     }
     
     private func prepareSimpleMessageView(signingMessage: String) -> UIView {