Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor UI/UX improvements #669

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct UDWalletEthereumWithPrivateSeed {
}
}

class UDWalletEthereum: AddressContainer, Codable {
class UDWalletEthereum: Codable {
enum SecurityType: Int, Codable {
case normal
case hd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,3 @@ enum WalletType: String, Codable {
}
}
}


enum ExternalWalletConnectionState: String, Codable {
case noConnection
case activeWCConnection
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SwiftUI

struct ReconnectMPCWalletPromptView: View, ViewAnalyticsLogger {

@Environment(\.walletsDataService) var walletsDataService
@EnvironmentObject var viewModel: ReconnectMPCWalletViewModel

let walletAddress: String
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,3 @@ final class UDWalletsListenerHolder: Equatable {
}

}

enum WalletImportingError: String, RawValueLocalizable, Error {
case noWalletsToImport = "NO_WALLETS_TO_IMPORT"
}