commit
77f373b441
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@ |
||||
//Copyright © 2018 Stormbird PTE. LTD. |
||||
|
||||
import UIKit |
||||
import AlphaWalletFoundation |
||||
|
||||
protocol CanOpenURL { |
||||
func didPressViewContractWebPage(forContract contract: AlphaWallet.Address, server: RPCServer, in viewController: UIViewController) |
@ -0,0 +1,38 @@ |
||||
// |
||||
// DappRequesterViewModel.swift |
||||
// AlphaWallet |
||||
// |
||||
// Created by Vladyslav Shepitko on 31.08.2022. |
||||
// |
||||
|
||||
import Foundation |
||||
import AlphaWalletFoundation |
||||
|
||||
struct DappRequesterViewModel: RequesterViewModel { |
||||
let requester: Requester |
||||
|
||||
var viewModels: [Any] { |
||||
var viewModels: [SignatureConfirmationViewModel.ViewType] = [] |
||||
|
||||
var dappNameHeader: String { R.string.localizable.walletConnectDappName() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(requester.shortName), headerName: dappNameHeader, configuration: .init(section: 0))) |
||||
] |
||||
|
||||
if let dappUrl = requester.url { |
||||
var dappWebsiteHeader: String { R.string.localizable.walletConnectDappWebsite() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(dappUrl.absoluteString), headerName: dappWebsiteHeader, configuration: .init(section: 0))), |
||||
] |
||||
} |
||||
|
||||
if let server = requester.server { |
||||
var dappServerHeader: String { R.string.localizable.settingsNetworkButtonTitle() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(server.name), headerName: dappServerHeader, configuration: .init(section: 0))) |
||||
] |
||||
} |
||||
|
||||
return viewModels |
||||
} |
||||
} |
@ -0,0 +1,38 @@ |
||||
// |
||||
// DeepLinkRequesterViewModel.swift |
||||
// AlphaWallet |
||||
// |
||||
// Created by Vladyslav Shepitko on 31.08.2022. |
||||
// |
||||
|
||||
import Foundation |
||||
import AlphaWalletFoundation |
||||
|
||||
struct DeepLinkRequesterViewModel: RequesterViewModel { |
||||
let requester: Requester |
||||
|
||||
var viewModels: [Any] { |
||||
var viewModels: [SignatureConfirmationViewModel.ViewType] = [] |
||||
|
||||
var dappNameHeader: String { R.string.localizable.walletConnectDappName() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(requester.shortName), headerName: dappNameHeader, configuration: .init(section: 0))) |
||||
] |
||||
|
||||
if let dappUrl = requester.url { |
||||
var dappWebsiteHeader: String { R.string.localizable.requesterFieldUrl() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(dappUrl.absoluteString), headerName: dappWebsiteHeader, configuration: .init(section: 0))), |
||||
] |
||||
} |
||||
|
||||
if let server = requester.server { |
||||
var dappServerHeader: String { R.string.localizable.settingsNetworkButtonTitle() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(server.name), headerName: dappServerHeader, configuration: .init(section: 0))) |
||||
] |
||||
} |
||||
|
||||
return viewModels |
||||
} |
||||
} |
@ -1,76 +0,0 @@ |
||||
// |
||||
// RequesterViewModel.swift |
||||
// AlphaWallet |
||||
// |
||||
// Created by Vladyslav Shepitko on 16.06.2022. |
||||
// |
||||
|
||||
import Foundation |
||||
|
||||
protocol RequesterViewModel { |
||||
var requester: Requester { get } |
||||
|
||||
var viewModels: [SignatureConfirmationViewModel.ViewType] { get } |
||||
} |
||||
|
||||
extension RequesterViewModel { |
||||
var iconUrl: URL? { return requester.iconUrl } |
||||
} |
||||
|
||||
struct DeepLinkRequesterViewModel: RequesterViewModel { |
||||
let requester: Requester |
||||
|
||||
var viewModels: [SignatureConfirmationViewModel.ViewType] { |
||||
var viewModels: [SignatureConfirmationViewModel.ViewType] = [] |
||||
|
||||
var dappNameHeader: String { R.string.localizable.walletConnectDappName() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(requester.shortName), headerName: dappNameHeader, configuration: .init(section: 0))) |
||||
] |
||||
|
||||
if let dappUrl = requester.url { |
||||
var dappWebsiteHeader: String { R.string.localizable.requesterFieldUrl() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(dappUrl.absoluteString), headerName: dappWebsiteHeader, configuration: .init(section: 0))), |
||||
] |
||||
} |
||||
|
||||
if let server = requester.server { |
||||
var dappServerHeader: String { R.string.localizable.settingsNetworkButtonTitle() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(server.name), headerName: dappServerHeader, configuration: .init(section: 0))) |
||||
] |
||||
} |
||||
|
||||
return viewModels |
||||
} |
||||
} |
||||
|
||||
struct DappRequesterViewModel: RequesterViewModel { |
||||
let requester: Requester |
||||
|
||||
var viewModels: [SignatureConfirmationViewModel.ViewType] { |
||||
var viewModels: [SignatureConfirmationViewModel.ViewType] = [] |
||||
|
||||
var dappNameHeader: String { R.string.localizable.walletConnectDappName() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(requester.shortName), headerName: dappNameHeader, configuration: .init(section: 0))) |
||||
] |
||||
|
||||
if let dappUrl = requester.url { |
||||
var dappWebsiteHeader: String { R.string.localizable.walletConnectDappWebsite() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(dappUrl.absoluteString), headerName: dappWebsiteHeader, configuration: .init(section: 0))), |
||||
] |
||||
} |
||||
|
||||
if let server = requester.server { |
||||
var dappServerHeader: String { R.string.localizable.settingsNetworkButtonTitle() } |
||||
viewModels += [ |
||||
.header(.init(title: .normal(server.name), headerName: dappServerHeader, configuration: .init(section: 0))) |
||||
] |
||||
} |
||||
|
||||
return viewModels |
||||
} |
||||
} |
@ -1,6 +1,7 @@ |
||||
// Copyright © 2018 Stormbird PTE. LTD. |
||||
|
||||
import UIKit |
||||
import AlphaWalletFoundation |
||||
|
||||
protocol AmountTextFieldDelegate: AnyObject { |
||||
func changeAmount(in textField: AmountTextField) |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue