Skip to content

Commit

Permalink
MOB-1910 - Confirm send crypto UI (#455)
Browse files Browse the repository at this point in the history
* Updated receive button place. Removed current profile switcher.
Added send button

* Updated home screen title view

* Added send crypto view.
Show from the home view.
Added input field and scan qr option

* Added section with user's wallets

* Added send crypto view model
Added UI for following selection

* Refactoring

* Updated nav bar customisation

* Disable interactive dismiss when navigate

* Extracted tab selection view from explore module

* Refactoring

* Created UI for token balance

* Make tokens selectable

* Added UI for domains list in assets selection
Adjusted navigation header UI

* Created senc crypto flow actions
Handle actions in view model
Hide empty sections on receiver selection screen

* Pass actions from select receiver and asset type views

* Refactoring

* Fixed initial onAppear call in token icons view

* Created UDNumberButtonView

* Created number pad view and input interpreter.
Created tests for interpreter

* Improved number pad logic

* Added UI for input and token info

* Added converted value label and toggle

* Added confirmation button

* Refactoring

* Disable animation for primary input view

* Swap buy and send actions on home screen

* Fixed copy on select receiver screen

* Added token icon near primary input value

* Adjusted UI for nav bar and in the IP SE

* Added search by domain profiles

* Show direct wallet address result

* Fixed first responder reset issue

* Implemented UI for token's sending value info

* Implemented UI for connector between sender and receiver

* Created curve shape for info section

* Implemented UI for send info

* Added confirm button
Adjusted UI for IP SE

* Updated icons on info view

* Localize content

* Use data from selected token

* Created structure for asset receiver.
Pass structure from select receiver screen.

* Pass data to SelectTokenAssetAmountToSendView

* Pass data to ConfirmSendTokenView

* Show receiver info on confirmation screen

* Show sender information

* Calculate and show formatted amount  to send

* Added convertation and formatting on select amount and confirm screens
  • Loading branch information
Oleg-Pecheneg authored Mar 22, 2024
1 parent f941702 commit 0ea829a
Show file tree
Hide file tree
Showing 32 changed files with 2,567 additions and 46 deletions.
26 changes: 26 additions & 0 deletions unstoppable-ios-app/domains-manager-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,12 @@
C62901012BAAD3C3008B35A2 /* NumberPadInputInterpreter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62900FF2BAAD3C3008B35A2 /* NumberPadInputInterpreter.swift */; };
C629A4602A3FF13600A528A1 /* MessagingChatMessageImageBase64TypeDisplayInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = C629A45F2A3FF13600A528A1 /* MessagingChatMessageImageBase64TypeDisplayInfo.swift */; };
C629A4802A403C1C00A528A1 /* MessagingChatConversationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C629A47F2A403C1C00A528A1 /* MessagingChatConversationState.swift */; };
C62AC1FC2BABE565003FB69E /* ConfirmSendTokenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62AC1FB2BABE565003FB69E /* ConfirmSendTokenView.swift */; };
C62AC1FD2BABE565003FB69E /* ConfirmSendTokenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62AC1FB2BABE565003FB69E /* ConfirmSendTokenView.swift */; };
C62AC1FF2BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62AC1FE2BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift */; };
C62AC2002BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62AC1FE2BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift */; };
C62AC2022BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62AC2012BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift */; };
C62AC2032BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62AC2012BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift */; };
C62BDA412B5E4104008E21AD /* MessagingBlockUserInChatType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62BDA402B5E4104008E21AD /* MessagingBlockUserInChatType.swift */; };
C62BDA422B5E4104008E21AD /* MessagingBlockUserInChatType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62BDA402B5E4104008E21AD /* MessagingBlockUserInChatType.swift */; };
C62C3F8B283F34B90094FC93 /* ResendCodeButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62C3F8A283F34B90094FC93 /* ResendCodeButton.swift */; };
Expand Down Expand Up @@ -2940,6 +2946,9 @@
C62900FF2BAAD3C3008B35A2 /* NumberPadInputInterpreter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberPadInputInterpreter.swift; sourceTree = "<group>"; };
C629A45F2A3FF13600A528A1 /* MessagingChatMessageImageBase64TypeDisplayInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagingChatMessageImageBase64TypeDisplayInfo.swift; sourceTree = "<group>"; };
C629A47F2A403C1C00A528A1 /* MessagingChatConversationState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagingChatConversationState.swift; sourceTree = "<group>"; };
C62AC1FB2BABE565003FB69E /* ConfirmSendTokenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmSendTokenView.swift; sourceTree = "<group>"; };
C62AC1FE2BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmSendTokenSenderReceiverConnectView.swift; sourceTree = "<group>"; };
C62AC2012BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmSendTokenReviewInfoView.swift; sourceTree = "<group>"; };
C62BDA402B5E4104008E21AD /* MessagingBlockUserInChatType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagingBlockUserInChatType.swift; sourceTree = "<group>"; };
C62C3F8A283F34B90094FC93 /* ResendCodeButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResendCodeButton.swift; sourceTree = "<group>"; };
C62C3F8F283F35610094FC93 /* CodeVerificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeVerificationView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5245,6 +5254,16 @@
path = SelectTokenAssetAmount;
sourceTree = "<group>";
};
C62AC1FA2BABE544003FB69E /* ConfirmSendToken */ = {
isa = PBXGroup;
children = (
C62AC1FB2BABE565003FB69E /* ConfirmSendTokenView.swift */,
C62AC1FE2BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift */,
C62AC2012BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift */,
);
path = ConfirmSendToken;
sourceTree = "<group>";
};
C62C3F94283F35730094FC93 /* CodeVerificationView */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6305,6 +6324,7 @@
C67213CD2BAA80670075B9C7 /* SelectReceiver */,
C67213E72BAA98EC0075B9C7 /* SelectAssetToSend */,
C62900F32BAAC821008B35A2 /* SelectTokenAssetAmount */,
C62AC1FA2BABE544003FB69E /* ConfirmSendToken */,
);
path = SendCryptoAsset;
sourceTree = "<group>";
Expand Down Expand Up @@ -8661,6 +8681,7 @@
C603E8C9285859560028C21C /* CollectionViewHeaderCell.swift in Sources */,
C635194828D03FFB00FC6AF8 /* ChooseReverseResolutionCollectionCell.swift in Sources */,
C6C1EC5A2A3AD2F3005EB37D /* UIMenuDomainAvatarLoader.swift in Sources */,
C62AC1FF2BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift in Sources */,
C64BCB7B2A6FB5B700EF8B47 /* MessagingChatMessageImageDataTypeDisplayInfo.swift in Sources */,
C6526DC529D2DC8500D6F2EB /* LoginInAppViewPresenter.swift in Sources */,
C6E1189E28F85BC600C6AD4D /* PrimaryWhiteButton.swift in Sources */,
Expand Down Expand Up @@ -9047,6 +9068,7 @@
C63392FC2B7271E800941C9D /* OffsetObservingListView.swift in Sources */,
C69F99772A9F2206004B1958 /* PublicProfileFollowersViewModel.swift in Sources */,
C6E69FF6288AE47D000A8346 /* ExternalEventsService.swift in Sources */,
C62AC1FC2BABE565003FB69E /* ConfirmSendTokenView.swift in Sources */,
C61DB11B2B95BD1200CDA243 /* DomainProfileDisplayInfo.swift in Sources */,
C64836C2282CC435007BD3F1 /* WalletCopyAddressAction.swift in Sources */,
C6F060CF2ACBC81300BA2E7E /* MessagingService+UserProfile.swift in Sources */,
Expand Down Expand Up @@ -9672,6 +9694,7 @@
C689C1752ADE56AF00AA0186 /* UDFeatureFlagsService.swift in Sources */,
C6B6858B280077F7000F9037 /* UIImage.swift in Sources */,
290A60422950A89900882109 /* WalletConnectServiceV2.swift in Sources */,
C62AC2022BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift in Sources */,
C6C9DEA02834B56200BAC36F /* ManageDomainLoadingCell.swift in Sources */,
C617FD9E2B58DBCA00B93433 /* WalletsDataServiceEnvironmentKey.swift in Sources */,
C68BEC0F2A397AD400A0B809 /* MessagingChatUserProfile.swift in Sources */,
Expand Down Expand Up @@ -9874,6 +9897,7 @@
C6D645BC2B1DBCE400D724AC /* ScrollViewOffsetListener.swift in Sources */,
C6C8F8352B217E9600A9834D /* CreateLocalWalletRecoveryWordsPresenter.swift in Sources */,
C6D645E82B1DBE6B00D724AC /* RaisedTertiaryButton.swift in Sources */,
C62AC2032BABF532003FB69E /* ConfirmSendTokenReviewInfoView.swift in Sources */,
C61807E52B19A5890032E543 /* MintingDomain.swift in Sources */,
C6D647602B1EDDBD00D724AC /* BaseTransactionInProgressViewPresenter.swift in Sources */,
C6C8F8A92B2182CF00A9834D /* MintDomainsConfigurationListHeaderView.swift in Sources */,
Expand Down Expand Up @@ -10124,6 +10148,7 @@
C6D6468A2B1ED12D00D724AC /* DomainProfileTopInfoSection.swift in Sources */,
C6D645892B1DBACB00D724AC /* CGSize.swift in Sources */,
C6D6467D2B1ED12900D724AC /* DomainProfileSection.swift in Sources */,
C62AC2002BABF0D0003FB69E /* ConfirmSendTokenSenderReceiverConnectView.swift in Sources */,
C6D645852B1DBA9D00D724AC /* BaseButton.swift in Sources */,
C64939FD2B637DDB00457363 /* ReverseResolutionSelectionView.swift in Sources */,
C6D646A82B1ED15A00D724AC /* PublicProfileCryptoListView.swift in Sources */,
Expand Down Expand Up @@ -10570,6 +10595,7 @@
C618081D2B19AB110032E543 /* PurchaseDomainsServiceEnvironmentKey.swift in Sources */,
C6D647382B1ED9EF00D724AC /* PaymentTransactionRequestConfirmationView.swift in Sources */,
C6D646A42B1ED15A00D724AC /* PublicProfileViewDelegate.swift in Sources */,
C62AC1FD2BABE565003FB69E /* ConfirmSendTokenView.swift in Sources */,
C6D646EF2B1ED5B200D724AC /* AddWalletViewController.swift in Sources */,
C6C8F82E2B217DE300A9834D /* ExternalWalletMake.swift in Sources */,
C61807D02B19A4040032E543 /* AnalyticsServiceEnvironment.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,23 @@ import Foundation

struct BalanceStringFormatter {

static func tokensBalanceString(_ balance: Double) -> String {
"$\(balance.formatted(toMaxNumberAfterComa: 2))"
static func tokenBalanceString(_ token: BalanceTokenUIDescription) -> String {
tokenBalanceString(balance: token.balance,
symbol: token.symbol)
}

static func tokenBalanceString(balance: Double,
symbol: String) -> String {
"\(balance.formattedBalance()) \(symbol)"
}

static func tokenFullBalanceString(balance: Double,
symbol: String) -> String {
"\(balance.formatted(toMaxNumberAfterComa: 8)) \(symbol)"
}

static func tokensBalanceUSDString(_ balance: Double) -> String {
"$\(balance.formattedBalance())"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ struct BalanceTokenUIDescription: Hashable, Identifiable {
// MARK: - Open methods
extension BalanceTokenUIDescription {
var formattedBalanceWithSymbol: String {
"\(balance.formatted(toMaxNumberAfterComa: 2)) \(symbol)"
BalanceStringFormatter.tokenBalanceString(self)
}

var formattedBalanceUSD: String {
"$\(balanceUsd.formatted(toMaxNumberAfterComa: 2))"
BalanceStringFormatter.tokensBalanceUSDString(balanceUsd)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ extension MockEntitiesFabric {
SendCryptoAssetViewModel(initialData: .init(sourceWallet: Wallet.mockEntities()[0]))
}

static func mockReceiver() -> SendCryptoAsset.AssetReceiver {
.init(wallet: Wallet.mockEntities()[1])
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ extension MockEntitiesFabric {
static func mockUIToken() -> BalanceTokenUIDescription {
BalanceTokenUIDescription(chain: "ETH",
symbol: "ETH",
name: "ETH",
name: "Ethereum",
balance: 1,
balanceUsd: 1,
marketUsd: 1)
marketUsd: 3900.34)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ extension Double {
func formatted(toMaxNumberAfterComa maxNumberAfterComa: Int) -> String {
String(format: "%.\(maxNumberAfterComa)f", self)
}

func formattedBalance() -> String {
formatted(toMaxNumberAfterComa: 2)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,11 @@ extension String {
static let usingMax = "USING_MAX"
static let useMax = "USE_MAX"
static let results = "RESULTS"
static let youAreSending = "YOU_ARE_SENDING"
static let from = "FROM"
static let speed = "SPEED"
static let feeEstimate = "FEE_ESTIMATE"
static let sendCryptoReviewPromptMessage = "SEND_CRYPTO_REVIEW_PROMPT_MESSAGE"
}

enum BlockChainIcons: String {
Expand Down Expand Up @@ -1232,4 +1237,8 @@ extension String {
return self
}
}

var asURL: URL? {
URL(string: self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ extension UIImage {
static let walletAddressesIcon = UIImage(named: "walletAddressesIcon")!
static let globeRotated = UIImage(named: "globeRotated")!
static let verticalLines = UIImage(named: "verticalLines")!
static let chevronGrabberVertical = UIImage(named: "chevronGrabberVertical")!
static let tildaIcon = UIImage(named: "tildaIcon")!
static let walletExternalIcon = UIImage(named: "walletExternalIcon")!

static let twitterIcon24 = UIImage(named: "twitterIcon24")!
static let discordIcon24 = UIImage(named: "discordIcon24")!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private extension PublicProfileTokensSectionView {

@ViewBuilder
func totalValueView(tokens: [BalanceTokenUIDescription]) -> some View {
Text(String.Constants.totalN.localized(BalanceStringFormatter.tokensBalanceString(tokens.totalBalanceUSD())))
Text(String.Constants.totalN.localized(BalanceStringFormatter.tokensBalanceUSDString(tokens.totalBalanceUSD())))
.foregroundStyle(Color.white.opacity(0.56))
.font(.currentFont(size: 16, weight: .medium))
}
Expand Down
Loading

0 comments on commit 0ea829a

Please sign in to comment.