-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(encryption): polish key transfer flow
- Loading branch information
Showing
9 changed files
with
228 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
Sources/Rownd/Views/KeyTransfer/KeyTransferProgress.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// | ||
// KeyTransferProgress.swift | ||
// RowndSDK | ||
// | ||
// Created by Matt Hamann on 8/23/22. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct KeyTransferProgress: View { | ||
@Environment(\.presentationMode) var presentationMode | ||
@EnvironmentObject var keyState: KeyTransferViewState | ||
|
||
@Binding var isShowingProgressView: Bool | ||
|
||
var body: some View { | ||
ZStack { | ||
Color(.systemGray6).edgesIgnoringSafeArea(.all) | ||
VStack(alignment: .leading, spacing: 10) { | ||
Text("Hang on just a sec. Don't close this window.") | ||
.font(.subheadline) | ||
Spacer() | ||
if keyState.isReceivingKey { | ||
VStack(alignment: .center, spacing: 20) { | ||
HStack(alignment: .center) { | ||
Spacer() | ||
ProgressView() | ||
.scaleEffect(2) | ||
Spacer() | ||
} | ||
|
||
HStack(alignment: .center) { | ||
Spacer() | ||
Text("Securely syncing your data to this device...") | ||
.multilineTextAlignment(.center) | ||
.padding(.horizontal) | ||
.frame(minWidth: 0, maxWidth: .infinity) | ||
Spacer() | ||
} | ||
}.frame(maxHeight: .infinity) | ||
|
||
Spacer() | ||
|
||
HStack(alignment: .center) { | ||
Spacer() | ||
Button(action: { | ||
presentationMode.wrappedValue.dismiss() | ||
}, label: { | ||
Text("Cancel") | ||
}) | ||
Spacer() | ||
}.padding(.bottom) | ||
} else if keyState.operationError != nil { | ||
VStack(alignment: .center, spacing: 20) { | ||
HStack(alignment: .center) { | ||
Spacer() | ||
Image(systemName: "x.circle.fill") | ||
.resizable() | ||
.frame(width: 32, height: 32, alignment: .center) | ||
Spacer() | ||
} | ||
|
||
HStack(alignment: .center) { | ||
Spacer() | ||
Text("Something went wrong. Please initiate the transfer again.") | ||
.multilineTextAlignment(.center) | ||
.padding(.horizontal) | ||
.frame(minWidth: 0, maxWidth: .infinity) | ||
Spacer() | ||
} | ||
|
||
Button(action: { | ||
isShowingProgressView = false | ||
}, label: { | ||
Text("Try again") | ||
}) | ||
}.frame(maxHeight: .infinity) | ||
} else { | ||
VStack(alignment: .center, spacing: 20) { | ||
HStack(alignment: .center) { | ||
Spacer() | ||
Image(systemName: "checkmark.circle.fill") | ||
.resizable() | ||
.frame(width: 32, height: 32, alignment: .center) | ||
Spacer() | ||
} | ||
|
||
HStack(alignment: .center) { | ||
Spacer() | ||
Text("Success!") | ||
.multilineTextAlignment(.center) | ||
.padding(.horizontal) | ||
.frame(minWidth: 0, maxWidth: .infinity) | ||
Spacer() | ||
} | ||
}.frame(maxHeight: .infinity) | ||
} | ||
} | ||
.padding(.horizontal) | ||
} | ||
.navigationBarBackButtonHidden(true) | ||
.toolbar { | ||
ToolbarItem(placement: .navigationBarLeading) { | ||
VStack(alignment: .leading) { | ||
Text("Signing in with your key") | ||
.font(.headline) | ||
.padding(.top) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.