diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/DomainsGlobalSearchService.swift b/unstoppable-ios-app/domains-manager-ios/Entities/DomainsGlobalSearchService.swift index 7db638284..de66c0af6 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/DomainsGlobalSearchService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/DomainsGlobalSearchService.swift @@ -10,20 +10,27 @@ import Foundation final class DomainsGlobalSearchService { var shouldResolveFullWalletAddress = true + var shouldReturnUserDomains = false typealias SearchProfilesTask = Task<[SearchDomainProfile], Error> private var currentTask: SearchProfilesTask? - init(shouldResolveFullWalletAddress: Bool = true) { + init(shouldResolveFullWalletAddress: Bool = true, + shouldReturnUserDomains: Bool = false) { self.shouldResolveFullWalletAddress = shouldResolveFullWalletAddress + self.shouldReturnUserDomains = shouldReturnUserDomains } func searchForGlobalProfilesExcludingUsers(with searchKey: String, walletsDataService: WalletsDataServiceProtocol) async throws -> [SearchDomainProfile] { let profiles = try await searchForGlobalProfiles(with: searchKey) - let userDomains = walletsDataService.wallets.combinedDomains() - let userDomainsNames = Set(userDomains.map({ $0.name })) - return profiles.filter({ !userDomainsNames.contains($0.name) && $0.ownerAddress != nil }) + if shouldReturnUserDomains { + return profiles.filter({ $0.ownerAddress != nil }) + } else { + let userDomains = walletsDataService.wallets.combinedDomains() + let userDomainsNames = Set(userDomains.map({ $0.name })) + return profiles.filter({ !userDomainsNames.contains($0.name) && $0.ownerAddress != nil }) + } } func searchForGlobalProfiles(with searchKey: String) async throws -> [SearchDomainProfile] { diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWallet.swift b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWallet.swift index 1b23a4584..2bb90b924 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWallet.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWallet.swift @@ -11,16 +11,6 @@ import CryptoSwift import Boilertalk_Web3 import UIKit -struct WalletIconSpec { - let imageName: String - var hue: Float? = nil - var saturation: Float? = nil -} - -protocol AddressContainer { - var address: String { get } -} - struct UDWallet: Codable, @unchecked Sendable { enum Error: String, Swift.Error, RawValueLocalizable { case failedToSignMessage = "Failed to Sign Message" diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWalletEthereum.swift b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWalletEthereum.swift index 61f41c317..9e924a519 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWalletEthereum.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/UDWalletEthereum.swift @@ -24,7 +24,7 @@ struct UDWalletEthereumWithPrivateSeed { } } -class UDWalletEthereum: AddressContainer, Codable { +class UDWalletEthereum: Codable { enum SecurityType: Int, Codable { case normal case hd diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/WalletType.swift b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/WalletType.swift index 1623dd67e..32e5d2b68 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/WalletType.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/WalletType.swift @@ -37,9 +37,3 @@ enum WalletType: String, Codable { } } } - - -enum ExternalWalletConnectionState: String, Codable { - case noConnection - case activeWCConnection -} diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/Home/SendCryptoAsset/SelectReceiver/SendCryptoAssetSelectReceiverView.swift b/unstoppable-ios-app/domains-manager-ios/Modules/Home/SendCryptoAsset/SelectReceiver/SendCryptoAssetSelectReceiverView.swift index d1d79e3e6..86a1e14cb 100644 --- a/unstoppable-ios-app/domains-manager-ios/Modules/Home/SendCryptoAsset/SelectReceiver/SendCryptoAssetSelectReceiverView.swift +++ b/unstoppable-ios-app/domains-manager-ios/Modules/Home/SendCryptoAsset/SelectReceiver/SendCryptoAssetSelectReceiverView.swift @@ -27,7 +27,8 @@ struct SendCryptoAssetSelectReceiverView: View, ViewAnalyticsLogger { @State private var isLoadingGlobalProfiles = false @State private var socialRelationshipDetailsPublisher: AnyCancellable? - private let searchService = DomainsGlobalSearchService(shouldResolveFullWalletAddress: false) + private let searchService = DomainsGlobalSearchService(shouldResolveFullWalletAddress: false, + shouldReturnUserDomains: true) var body: some View { List { diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/Activate/ReconnectMPCWalletFlow/ReconnectMPCWalletPromptView.swift b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/Activate/ReconnectMPCWalletFlow/ReconnectMPCWalletPromptView.swift index d850a6524..6f1363b35 100644 --- a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/Activate/ReconnectMPCWalletFlow/ReconnectMPCWalletPromptView.swift +++ b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/Activate/ReconnectMPCWalletFlow/ReconnectMPCWalletPromptView.swift @@ -9,6 +9,7 @@ import SwiftUI struct ReconnectMPCWalletPromptView: View, ViewAnalyticsLogger { + @Environment(\.walletsDataService) var walletsDataService @EnvironmentObject var viewModel: ReconnectMPCWalletViewModel let walletAddress: String @@ -55,15 +56,22 @@ private extension ReconnectMPCWalletPromptView { } var walletAddressInBrackets: String { - "(\(walletAddress.walletAddressTruncated))" + if let rrDomain = walletsDataService.wallets.findWithAddress(walletAddress)?.rrDomain { + return "(\(rrDomain.name) \(walletAddress.walletAddressTruncated))" + } else { + return "(\(walletAddress.walletAddressTruncated))" + } } @ViewBuilder func titleText() -> some View { - AttributedText(attributesList: .init(text: String.Constants.reImportMPCWalletPromptTitle.localized(walletAddressInBrackets), font: .currentFont(withSize: 32, weight: .bold), textColor: .foregroundDefault, alignment: .center), + AttributedText(attributesList: .init(text: String.Constants.reImportMPCWalletPromptTitle.localized(walletAddressInBrackets), + font: .currentFont(withSize: 32, weight: .bold), + textColor: .foregroundDefault, + alignment: .center), updatedAttributesList: [.init(text: walletAddressInBrackets, textColor: .foregroundSecondary)], - flexibleHeight: false) - + flexibleHeight: false, + width: screenSize.width - 32) } @ViewBuilder diff --git a/unstoppable-ios-app/domains-manager-ios/Services/UDWalletsService/UDWalletsServiceProtocol.swift b/unstoppable-ios-app/domains-manager-ios/Services/UDWalletsService/UDWalletsServiceProtocol.swift index 236fa99be..0645c7355 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/UDWalletsService/UDWalletsServiceProtocol.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/UDWalletsService/UDWalletsServiceProtocol.swift @@ -79,7 +79,3 @@ final class UDWalletsListenerHolder: Equatable { } } - -enum WalletImportingError: String, RawValueLocalizable, Error { - case noWalletsToImport = "NO_WALLETS_TO_IMPORT" -}