diff --git a/Example/ExampleApp.xcodeproj/project.pbxproj b/Example/ExampleApp.xcodeproj/project.pbxproj index 0dcc34c2a..ab2b202dd 100644 --- a/Example/ExampleApp.xcodeproj/project.pbxproj +++ b/Example/ExampleApp.xcodeproj/project.pbxproj @@ -275,6 +275,7 @@ C56EE28F293F5757004840D1 /* MigrationConfigurator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C56EE283293F5757004840D1 /* MigrationConfigurator.swift */; }; C56EE2A3293F6BAF004840D1 /* UIPasteboardWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C56EE2A2293F6BAF004840D1 /* UIPasteboardWrapper.swift */; }; C579FEB62AFA86CD008855EB /* Web3Modal in Frameworks */ = {isa = PBXBuildFile; productRef = C579FEB52AFA86CD008855EB /* Web3Modal */; }; + C579FEBA2AFCDFA6008855EB /* ConnectedSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C579FEB92AFCDFA6008855EB /* ConnectedSheetView.swift */; }; C58099352A543CD000AB58F5 /* BlinkAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C58099342A543CD000AB58F5 /* BlinkAnimation.swift */; }; C5B2F6F629705293000DBA0E /* SessionRequestModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B2F6F12970511B000DBA0E /* SessionRequestModule.swift */; }; C5B2F6F729705293000DBA0E /* SessionRequestRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B2F6F32970511B000DBA0E /* SessionRequestRouter.swift */; }; @@ -638,6 +639,7 @@ C56EE287293F5757004840D1 /* AppearanceConfigurator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceConfigurator.swift; sourceTree = ""; }; C56EE29F293F5C4F004840D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C56EE2A2293F6BAF004840D1 /* UIPasteboardWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIPasteboardWrapper.swift; sourceTree = ""; }; + C579FEB92AFCDFA6008855EB /* ConnectedSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectedSheetView.swift; sourceTree = ""; }; C58099342A543CD000AB58F5 /* BlinkAnimation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlinkAnimation.swift; sourceTree = ""; }; C5B2F6F12970511B000DBA0E /* SessionRequestModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionRequestModule.swift; sourceTree = ""; }; C5B2F6F22970511B000DBA0E /* SessionRequestPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionRequestPresenter.swift; sourceTree = ""; }; @@ -1655,6 +1657,7 @@ C56EE25C293F56D6004840D1 /* Common */ = { isa = PBXGroup; children = ( + C579FEB82AFCDF83008855EB /* Views */, C56EE25D293F56D6004840D1 /* InputConfig.swift */, 84B8154D2991099000FAD54E /* BuildConfiguration.swift */, C56EE267293F56D6004840D1 /* Style */, @@ -1769,6 +1772,14 @@ path = Helpers; sourceTree = ""; }; + C579FEB82AFCDF83008855EB /* Views */ = { + isa = PBXGroup; + children = ( + C579FEB92AFCDFA6008855EB /* ConnectedSheetView.swift */, + ); + path = Views; + sourceTree = ""; + }; C5B2F6F029705111000DBA0E /* SessionRequest */ = { isa = PBXGroup; children = ( @@ -2547,6 +2558,7 @@ A51811A12A52E83100A52B15 /* SettingsRouter.swift in Sources */, C56EE279293F56D7004840D1 /* Color.swift in Sources */, 847BD1E6298A806800076C90 /* NotificationsRouter.swift in Sources */, + C579FEBA2AFCDFA6008855EB /* ConnectedSheetView.swift in Sources */, C55D3483295DD7140004314A /* AuthRequestView.swift in Sources */, C56EE243293F566D004840D1 /* ScanView.swift in Sources */, 84310D05298BC980000C15B6 /* MainInteractor.swift in Sources */, diff --git a/Example/WalletApp/Common/Views/ConnectedSheetView.swift b/Example/WalletApp/Common/Views/ConnectedSheetView.swift new file mode 100644 index 000000000..ca04d4301 --- /dev/null +++ b/Example/WalletApp/Common/Views/ConnectedSheetView.swift @@ -0,0 +1,38 @@ +import SwiftUI + +struct ConnectedSheetView: View { + let title: String + + var body: some View { + ZStack { + VStack { + Image("connected") + + Spacer() + } + + VStack(spacing: 8) { + Rectangle() + .foregroundColor(.clear) + .frame(width: 48, height: 4) + .background(Color(red: 0.02, green: 0.17, blue: 0.17).opacity(0.2)) + .cornerRadius(100) + .padding(.top, 8) + + Text(title) + .foregroundColor(.grey8) + .font(.system(size: 20, weight: .semibold, design: .rounded)) + .padding(.top, 168) + + + Text("You can go back to your browser now") + .foregroundColor(Color(red: 0.47, green: 0.53, blue: 0.53)) + .font(.system(size: 16, weight: .medium, design: .rounded)) + + Spacer() + } + } + .presentationDetents([.height(254)]) + .presentationDragIndicator(.hidden) + } +} diff --git a/Example/WalletApp/Other/Assets.xcassets/connected.imageset/Contents.json b/Example/WalletApp/Other/Assets.xcassets/connected.imageset/Contents.json new file mode 100644 index 000000000..a0c9ba91a --- /dev/null +++ b/Example/WalletApp/Other/Assets.xcassets/connected.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "connected.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/WalletApp/Other/Assets.xcassets/connected.imageset/connected.pdf b/Example/WalletApp/Other/Assets.xcassets/connected.imageset/connected.pdf new file mode 100644 index 000000000..082ee55f8 Binary files /dev/null and b/Example/WalletApp/Other/Assets.xcassets/connected.imageset/connected.pdf differ diff --git a/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestPresenter.swift b/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestPresenter.swift index f1fe362ef..2256c54f2 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestPresenter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestPresenter.swift @@ -15,6 +15,8 @@ final class AuthRequestPresenter: ObservableObject { return interactor.formatted(request: request, account: importAccount.account) } + @Published var showSignedSheet = false + private var disposeBag = Set() init( @@ -35,7 +37,7 @@ final class AuthRequestPresenter: ObservableObject { @MainActor func onApprove() async throws { try await interactor.approve(request: request, importAccount: importAccount) - router.dismiss() + showSignedSheet.toggle() } @MainActor @@ -43,6 +45,10 @@ final class AuthRequestPresenter: ObservableObject { try await interactor.reject(request: request) router.dismiss() } + + func onSignedSheetDismiss() { + router.dismiss() + } } // MARK: - Private functions diff --git a/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestView.swift b/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestView.swift index 97d40b444..46e38408f 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestView.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/AuthRequest/AuthRequestView.swift @@ -103,6 +103,12 @@ struct AuthRequestView: View { Spacer() } } + .sheet( + isPresented: $presenter.showSignedSheet, + onDismiss: presenter.onSignedSheetDismiss + ) { + ConnectedSheetView(title: "Request is signed") + } .edgesIgnoringSafeArea(.all) } diff --git a/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalPresenter.swift b/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalPresenter.swift index be919a381..49c1516fc 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalPresenter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalPresenter.swift @@ -13,6 +13,7 @@ final class SessionProposalPresenter: ObservableObject { @Published var showError = false @Published var errorMessage = "Error" + @Published var showConnectedSheet = false private var disposeBag = Set() @@ -35,7 +36,7 @@ final class SessionProposalPresenter: ObservableObject { func onApprove() async throws { do { try await interactor.approve(proposal: sessionProposal, account: importAccount.account) - router.dismiss() + showConnectedSheet.toggle() } catch { errorMessage = error.localizedDescription showError.toggle() @@ -52,6 +53,10 @@ final class SessionProposalPresenter: ObservableObject { showError.toggle() } } + + func onConnectedSheetDismiss() { + router.dismiss() + } } // MARK: - Private functions diff --git a/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalView.swift b/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalView.swift index cd595a158..19ee52d1e 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalView.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/SessionProposal/SessionProposalView.swift @@ -143,6 +143,12 @@ struct SessionProposalView: View { .alert(presenter.errorMessage, isPresented: $presenter.showError) { Button("OK", role: .cancel) {} } + .sheet( + isPresented: $presenter.showConnectedSheet, + onDismiss: presenter.onConnectedSheetDismiss + ) { + ConnectedSheetView(title: "Connected") + } .edgesIgnoringSafeArea(.all) } diff --git a/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestPresenter.swift b/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestPresenter.swift index 103002dd6..c1568f6ed 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestPresenter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestPresenter.swift @@ -20,6 +20,7 @@ final class SessionRequestPresenter: ObservableObject { @Published var showError = false @Published var errorMessage = "Error" + @Published var showSignedSheet = false private var disposeBag = Set() @@ -43,7 +44,7 @@ final class SessionRequestPresenter: ObservableObject { func onApprove() async throws { do { try await interactor.approve(sessionRequest: sessionRequest, importAccount: importAccount) - router.dismiss() + showSignedSheet.toggle() } catch { errorMessage = error.localizedDescription showError.toggle() @@ -55,6 +56,10 @@ final class SessionRequestPresenter: ObservableObject { try await interactor.reject(sessionRequest: sessionRequest) router.dismiss() } + + func onSignedSheetDismiss() { + router.dismiss() + } } // MARK: - Private functions diff --git a/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestView.swift b/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestView.swift index c8ce70396..a183d2c57 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestView.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/SessionRequest/SessionRequestView.swift @@ -99,6 +99,12 @@ struct SessionRequestView: View { .alert(presenter.errorMessage, isPresented: $presenter.showError) { Button("OK", role: .cancel) {} } + .sheet( + isPresented: $presenter.showSignedSheet, + onDismiss: presenter.onSignedSheetDismiss + ) { + ConnectedSheetView(title: "Request is signed") + } } .edgesIgnoringSafeArea(.all) } diff --git a/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletPresenter.swift b/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletPresenter.swift index 5a1bc3b85..59d5c1fc2 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletPresenter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletPresenter.swift @@ -19,6 +19,7 @@ final class WalletPresenter: ObservableObject { @Published var showPairingLoading = false @Published var showError = false @Published var errorMessage = "Error" + @Published var showConnectedSheet = false private var disposeBag = Set() diff --git a/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletView.swift b/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletView.swift index 4f5c8ffc1..db735a7cf 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletView.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Wallet/WalletView.swift @@ -101,6 +101,36 @@ struct WalletView: View { .alert(presenter.errorMessage, isPresented: $presenter.showError) { Button("OK", role: .cancel) {} } + .sheet(isPresented: $presenter.showConnectedSheet) { + ZStack { + VStack { + Image("connected") + + Spacer() + } + + VStack(spacing: 8) { + Rectangle() + .foregroundColor(.clear) + .frame(width: 48, height: 4) + .background(Color(red: 0.02, green: 0.17, blue: 0.17).opacity(0.2)) + .cornerRadius(100) + .padding(.top, 8) + + Text("Connected") + .foregroundColor(.grey8) + .font(.system(size: 20, weight: .semibold, design: .rounded)) + .padding(.top, 168) + + + Text("You can go back to your browser now") + .foregroundColor(Color(red: 0.47, green: 0.53, blue: 0.53)) + .font(.system(size: 16, weight: .medium, design: .rounded)) + + Spacer() + } + } + } .onAppear { presenter.onAppear() }