-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): update demo app with new features (#133)
- Loading branch information
1 parent
7bfcaaf
commit 931c843
Showing
77 changed files
with
3,426 additions
and
154 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
366 changes: 343 additions & 23 deletions
366
Sample/AtalaPrismWalletDemo/AtalaPrismWalletDemo.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...WalletDemo/AtalaPrismWalletDemo/Helper/AtalaSwiftUIComponents/CommonUI/ActivityView.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,16 @@ | ||
import SwiftUI | ||
|
||
struct ActivityView: UIViewControllerRepresentable { | ||
let activityItems: [Any] | ||
let applicationActivities: [UIActivity]? | ||
|
||
func makeUIViewController(context: UIViewControllerRepresentableContext<ActivityView>) -> UIActivityViewController { | ||
UIActivityViewController(activityItems: activityItems, | ||
applicationActivities: applicationActivities) | ||
} | ||
|
||
func updateUIViewController( | ||
_ uiViewController: UIActivityViewController, | ||
context: UIViewControllerRepresentableContext<ActivityView> | ||
) {} | ||
} |
61 changes: 61 additions & 0 deletions
61
...mWalletDemo/AtalaPrismWalletDemo/Helper/AtalaSwiftUIComponents/CommonUI/AtalaButton.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,61 @@ | ||
import SwiftUI | ||
|
||
struct AtalaButton<Label: View>: View { | ||
enum Configuration { | ||
case primary | ||
case secondary | ||
} | ||
|
||
let configuration: Configuration | ||
let loading: Bool | ||
let action: () -> Void | ||
@ViewBuilder var label: () -> Label | ||
|
||
init( | ||
configuration: Configuration = .primary, | ||
loading: Bool = false, | ||
action: @escaping () -> Void, | ||
@ViewBuilder label: @escaping () -> Label | ||
) { | ||
self.configuration = configuration | ||
self.loading = loading | ||
self.action = action | ||
self.label = label | ||
} | ||
|
||
@Environment(\.isEnabled) var isEnabled: Bool | ||
|
||
var body: some View { | ||
let button = Button(action: action, label: { | ||
HStack(spacing: 6) { | ||
label() | ||
if loading { | ||
ProgressView() | ||
.progressViewStyle( | ||
CircularProgressViewStyle( | ||
tint: .white | ||
) | ||
) | ||
} | ||
} | ||
}) | ||
if configuration == .primary { | ||
button | ||
.primeButtonConfiguration() | ||
.environment(\.isLoading, loading) | ||
} else { | ||
button | ||
.secondaryButtonConfiguration() | ||
.environment(\.isLoading, loading) | ||
} | ||
} | ||
} | ||
|
||
struct AtalaButton_Previews: PreviewProvider { | ||
static var previews: some View { | ||
AtalaButton(loading: true, action: {}, label: { | ||
Text("Something") | ||
}) | ||
.disabled(true) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...mo/AtalaPrismWalletDemo/Helper/AtalaSwiftUIComponents/CommonUI/ButtonNavigationLink.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,35 @@ | ||
import SwiftUI | ||
|
||
struct PrimeButtonNavidationLink<Destination: View>: View { | ||
let text: String | ||
let destination: Destination | ||
|
||
var body: some View { | ||
NavigationLink( | ||
destination: destination, | ||
label: { | ||
Text(text) | ||
.bold() | ||
.frame(maxWidth: .infinity) | ||
.primeButtonModifier() | ||
} | ||
) | ||
} | ||
} | ||
|
||
struct SecondaryButtonNavidationLink<Destination: View>: View { | ||
let text: String | ||
let destination: Destination | ||
|
||
var body: some View { | ||
NavigationLink( | ||
destination: destination, | ||
label: { | ||
Text(text) | ||
.bold() | ||
.frame(maxWidth: .infinity) | ||
.secondaryButtonModifier() | ||
} | ||
) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...mWalletDemo/AtalaPrismWalletDemo/Helper/AtalaSwiftUIComponents/CommonUI/CheckButton.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,22 @@ | ||
import SwiftUI | ||
|
||
struct CheckButton: View { | ||
@Binding var isSelected: Bool | ||
|
||
var body: some View { | ||
Button(action: { | ||
withAnimation { | ||
self.isSelected = !isSelected | ||
} | ||
}, label: { | ||
if isSelected { | ||
Image("ico_check_on") | ||
.resizable() | ||
} else { | ||
Image("ico_check_off") | ||
.resizable() | ||
} | ||
}) | ||
.frame(width: 40, height: 40) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...alletDemo/AtalaPrismWalletDemo/Helper/AtalaSwiftUIComponents/CommonUI/ClosableSheet.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,25 @@ | ||
import SwiftUI | ||
|
||
struct ClosableSheet<SheetContent: View>: View { | ||
@Environment(\.presentationMode) var presentationMode | ||
@ViewBuilder let content: () -> SheetContent | ||
|
||
var body: some View { | ||
VStack(spacing: 16) { | ||
content() | ||
Button(action: { | ||
self.presentationMode.wrappedValue.dismiss() | ||
}, label: { | ||
Image("ico_close_red") | ||
}) | ||
} | ||
} | ||
} | ||
|
||
struct ClosableSheet_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ClosableSheet(content: { | ||
Text("") | ||
}) | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
...smWalletDemo/AtalaPrismWalletDemo/Helper/AtalaSwiftUIComponents/CommonUI/DeleteView.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,106 @@ | ||
import SwiftUI | ||
|
||
struct DeleteView<Content: View, Info: View>: View { | ||
private let deleteAction: () -> Void | ||
private let showInfoView: Bool | ||
private var loading: Bool | ||
|
||
@ViewBuilder private var content: () -> Content | ||
@ViewBuilder private var info: () -> Info | ||
|
||
@Environment(\.presentationMode) var presentationMode | ||
|
||
init( | ||
showInfoView: Bool = true, | ||
loading: Bool = false, | ||
deleteAction: @escaping () -> Void, | ||
@ViewBuilder content: @escaping () -> Content, | ||
@ViewBuilder info: @escaping () -> Info | ||
) { | ||
self.deleteAction = deleteAction | ||
self.content = content | ||
self.info = info | ||
self.showInfoView = showInfoView | ||
self.loading = loading | ||
} | ||
|
||
var body: some View { | ||
VStack(spacing: 15) { | ||
VStack(spacing: 9) { | ||
Image("icon_delete") | ||
VStack(spacing: 4) { | ||
Text("contacts_delete_confrimation_title".localize()) | ||
.font(.body) | ||
.fontWeight(.heavy) | ||
.bold() | ||
.foregroundColor(Color(.red)) | ||
Text("contacts_delete_confrimation_message".localize()) | ||
.font(.body) | ||
.foregroundColor(.gray) | ||
} | ||
} | ||
Divider() | ||
content() | ||
Divider() | ||
if showInfoView { | ||
info() | ||
Divider() | ||
} | ||
HStack { | ||
Button(action: { | ||
self.presentationMode.wrappedValue.dismiss() | ||
}, label: { | ||
Text("cancel".localize()) | ||
.frame(maxWidth: .infinity) | ||
.secondaryButtonModifier() | ||
}) | ||
|
||
AtalaButton(loading: self.loading) { | ||
self.deleteAction() | ||
} label: { | ||
Text("delete".localize()) | ||
.frame(maxWidth: .infinity) | ||
} | ||
} | ||
} | ||
.padding(24) | ||
.background(Color.white) | ||
.clipShape(RoundedRectangle(cornerRadius: 10)) | ||
.padding() | ||
} | ||
} | ||
|
||
struct DeleteView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
DeleteView(showInfoView: true) {} content: { | ||
HStack(spacing: 16) { | ||
Image("ico_placeholder_credential") | ||
.resizable() | ||
.frame(width: 40, height: 40) | ||
.clipShape(RoundedRectangle(cornerRadius: 10)) | ||
Text("Atala KYC") | ||
.font(.title3) | ||
.fontWeight(.heavy) | ||
.bold() | ||
.foregroundColor(.black) | ||
Spacer() | ||
} | ||
} info: { | ||
VStack(alignment: .leading, spacing: 9) { | ||
Text("contacts_delete_description".localize()) | ||
.font(.body) | ||
.foregroundColor(.gray) | ||
VStack(alignment: .leading, spacing: 6) { | ||
Text(". ID Credential") | ||
.bold() | ||
.font(.body) | ||
.foregroundColor(.black) | ||
Text(". University Credential") | ||
.bold() | ||
.font(.body) | ||
.foregroundColor(.black) | ||
} | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.