-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(ios) The "Add contact" option now allows the offer/address to be add…
…ed to an existing contact.
- Loading branch information
1 parent
e13f317
commit d28f252
Showing
7 changed files
with
501 additions
and
8 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
79 changes: 79 additions & 0 deletions
79
phoenix-ios/phoenix-ios/views/contacts/AddContactOptionsSheet.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,79 @@ | ||
import SwiftUI | ||
|
||
struct AddContactOptionsSheet: View { | ||
|
||
let createNewContact: () -> Void | ||
let addToExistingContact: () -> Void | ||
|
||
@EnvironmentObject var smartModalState: SmartModalState | ||
|
||
@ViewBuilder | ||
var body: some View { | ||
|
||
VStack(alignment: HorizontalAlignment.leading, spacing: 10) { | ||
title() | ||
createNewContactRow() | ||
addToExistingContactRow() | ||
} | ||
.padding(.all) | ||
} | ||
|
||
@ViewBuilder | ||
func title() -> some View { | ||
|
||
HStack(alignment: VerticalAlignment.center, spacing: 0) { | ||
Spacer(minLength: 4) | ||
Text("Add contact") | ||
Spacer(minLength: 4) | ||
} | ||
.font(.title2) | ||
} | ||
|
||
@ViewBuilder | ||
func createNewContactRow() -> some View { | ||
|
||
Button { | ||
smartModalState.close { | ||
createNewContact() | ||
} | ||
} label: { | ||
HStack(alignment: VerticalAlignment.center, spacing: 4) { | ||
Text("Create new contact") | ||
Spacer() | ||
} | ||
.padding([.top, .bottom], 8) | ||
.padding([.leading, .trailing], 16) | ||
.contentShape(Rectangle()) // make Spacer area tappable | ||
} | ||
.buttonStyle( | ||
ScaleButtonStyle( | ||
cornerRadius: 16, | ||
borderStroke: Color.appAccent | ||
) | ||
) | ||
} | ||
|
||
@ViewBuilder | ||
func addToExistingContactRow() -> some View { | ||
|
||
Button { | ||
smartModalState.close { | ||
addToExistingContact() | ||
} | ||
} label: { | ||
HStack(alignment: VerticalAlignment.center, spacing: 4) { | ||
Text("Add to existing contact") | ||
Spacer() | ||
} | ||
.padding([.top, .bottom], 8) | ||
.padding([.leading, .trailing], 16) | ||
.contentShape(Rectangle()) // make Spacer area tappable | ||
} | ||
.buttonStyle( | ||
ScaleButtonStyle( | ||
cornerRadius: 16, | ||
borderStroke: Color.appAccent | ||
) | ||
) | ||
} | ||
} |
Oops, something went wrong.