Skip to content

Commit

Permalink
Add loader animations
Browse files Browse the repository at this point in the history
  • Loading branch information
radeknovis committed Nov 8, 2023
1 parent 1640299 commit a2fbd04
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 81 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/WalletConnect/WalletConnectSwiftV2",
"state" : {
"branch" : "remove-wcm",
"revision" : "0085250fd993f40a638f8d3e300f4af8cbf9e7a8"
"revision" : "4aa4c8229077c133730e361d0d7a17f9e56bdffd",
"version" : "1.9.6"
}
}
],
Expand Down
8 changes: 7 additions & 1 deletion Sources/Web3Modal/Components/ConnectButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ public struct ConnectButton: View {
Web3Modal.present()
} label: {
if store.connecting {
CircleProgressView(color: .white, lineWidth: 2, isAnimating: .constant(true))
DrawingProgressView(
shape: .circle,
color: .white,
lineWidth: 2,
duration: 1,
isAnimating: .constant(true)
)
.frame(width: 20, height: 20)
} else {
Text("Connect wallet")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@ struct NetworkDetailView: View {

func chainImage() -> some View {
VStack(spacing: Spacing.xs) {
Image(
uiImage: store.chainImages[viewModel.chain.imageId] ?? UIImage()
)
.resizable()
.frame(width: 80, height: 80)
.clipShape(Polygon(count: 6, relativeCornerRadius: 0.25))
.cornerRadius(Radius.m)
ZStack {
Image(
uiImage: store.chainImages[viewModel.chain.imageId] ?? UIImage()
)
.resizable()
.frame(width: 80, height: 80)
.clipShape(Polygon(count: 6, relativeCornerRadius: 0.25))
.cornerRadius(Radius.m)

if !viewModel.switchFailed {
DrawingProgressView(shape: .hexagon, color: .Blue100, lineWidth: 3, isAnimating: .constant(true))
.frame(width: 100, height: 100)
}
}
.padding(.bottom, Spacing.s)

Text(!viewModel.switchFailed ? "Approve in wallet" : "Switch declined")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@ struct WalletDetail: View {
@ViewBuilder
func content() -> some View {
VStack(spacing: 0) {
walletImage()

walletImage()
.padding(.top, 40)
.padding(.bottom, Spacing.l)



appStoreRow()
.opacity(viewModel.preferredPlatform != .native ? 0 : 1)
}
Expand All @@ -88,12 +87,17 @@ struct WalletDetail: View {

func walletImage() -> some View {
VStack(spacing: Spacing.xs) {
Image(
uiImage: store.walletImages[viewModel.wallet.imageId] ?? UIImage()
)
.resizable()
.frame(width: 80, height: 80)
.cornerRadius(Radius.m)
ZStack {
Image(
uiImage: store.walletImages[viewModel.wallet.imageId] ?? UIImage()
)
.resizable()
.frame(width: 80, height: 80)
.cornerRadius(Radius.m)

DrawingProgressView(shape: .roundedRectangleAbsolute(cornerRadius: 20), color: .Blue100, lineWidth: 3, isAnimating: .constant(true))
.frame(width: 100, height: 100)
}
.padding(.bottom, Spacing.s)

Text("Continue in \(viewModel.wallet.name)")
Expand Down
2 changes: 2 additions & 0 deletions Sources/Web3Modal/Sheets/Web3ModalViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class Web3ModalViewModel: ObservableObject {
}

store.selectedChain = ChainPresets.ethChains.first(where: { $0.chainReference == String(chainReference) })
self.fetchBalance()
self.fetchIdentity()
default:
return
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/Web3ModalUI/Components/W3MListItemButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ public struct W3MListItemButtonStyle<ImageContent: View>: ButtonStyle {

Group {
if isLoading {
CircleProgressView(
DrawingProgressView(
shape: .circle,
color: .Blue100,
lineWidth: 2 * scale,
duration: 1,
isAnimating: $isLoading
)
.frame(width: 15 * scale, height: 15 * scale)
Expand Down
Loading

0 comments on commit a2fbd04

Please sign in to comment.