Skip to content

Commit

Permalink
(ios) The "Add contact" option now allows the offer/address to be add…
Browse files Browse the repository at this point in the history
…ed to an existing contact.
  • Loading branch information
robbiehanson committed Oct 16, 2024
1 parent e13f317 commit d28f252
Show file tree
Hide file tree
Showing 7 changed files with 501 additions and 8 deletions.
8 changes: 8 additions & 0 deletions phoenix-ios/phoenix-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
DC949E6A2B45B1EC00E80BB5 /* LiquidityAdsHelp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC949E692B45B1EC00E80BB5 /* LiquidityAdsHelp.swift */; };
DC98D3962AF170AC005BD177 /* PaymentWarningPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC98D3952AF170AC005BD177 /* PaymentWarningPopover.swift */; };
DC98D3982AF2AE41005BD177 /* ReceiveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC98D3972AF2AE41005BD177 /* ReceiveView.swift */; };
DC9933322CC03D7500EB3100 /* ContactsListSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC9933312CC03D7500EB3100 /* ContactsListSheet.swift */; };
DC9933342CC0426300EB3100 /* AddContactOptionsSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC9933332CC0426300EB3100 /* AddContactOptionsSheet.swift */; };
DC99E90925B78FA800FB20F7 /* EnabledSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC99E90825B78FA800FB20F7 /* EnabledSecurity.swift */; };
DC99E94025BA141000FB20F7 /* LocalWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC99E93F25BA141000FB20F7 /* LocalWebView.swift */; };
DC99E94D25BA258C00FB20F7 /* about.html in Resources */ = {isa = PBXBuildFile; fileRef = DC99E94825BA258C00FB20F7 /* about.html */; };
Expand Down Expand Up @@ -617,6 +619,8 @@
DC949E692B45B1EC00E80BB5 /* LiquidityAdsHelp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiquidityAdsHelp.swift; sourceTree = "<group>"; };
DC98D3952AF170AC005BD177 /* PaymentWarningPopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentWarningPopover.swift; sourceTree = "<group>"; };
DC98D3972AF2AE41005BD177 /* ReceiveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveView.swift; sourceTree = "<group>"; };
DC9933312CC03D7500EB3100 /* ContactsListSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsListSheet.swift; sourceTree = "<group>"; };
DC9933332CC0426300EB3100 /* AddContactOptionsSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddContactOptionsSheet.swift; sourceTree = "<group>"; };
DC99E90825B78FA800FB20F7 /* EnabledSecurity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnabledSecurity.swift; sourceTree = "<group>"; };
DC99E93F25BA141000FB20F7 /* LocalWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalWebView.swift; sourceTree = "<group>"; };
DC99E94925BA258C00FB20F7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = Base; path = Base.lproj/about.html; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1049,7 +1053,9 @@
children = (
DC3345CF2C2B4C1200EDD2D4 /* ManageContact.swift */,
DC5567442C2F1A6900008E11 /* ContactsList.swift */,
DC9933312CC03D7500EB3100 /* ContactsListSheet.swift */,
DC6F04262C3895E300627B4F /* ContactPhoto.swift */,
DC9933332CC0426300EB3100 /* AddContactOptionsSheet.swift */,
);
path = contacts;
sourceTree = "<group>";
Expand Down Expand Up @@ -1838,6 +1844,7 @@
DC6F19BF2C46FB0F004EC469 /* NSItemProvider+Async.swift in Sources */,
DCCFE6C22B7140FA002FFF11 /* LoggerFactory+Foreground.swift in Sources */,
7555FF7F242A565900829871 /* AppDelegate.swift in Sources */,
DC9933342CC0426300EB3100 /* AddContactOptionsSheet.swift in Sources */,
DC74174B270F332700F7E3E3 /* KotlinTypes.swift in Sources */,
DC142135261E72320075857A /* AboutHTML.swift in Sources */,
DC33C5632A7C15D40053D785 /* MainView_BigPrimary.swift in Sources */,
Expand Down Expand Up @@ -2043,6 +2050,7 @@
DC5CA4ED28F83C3B0048A737 /* DrainWalletView.swift in Sources */,
DC5E288E2C62C3DF0037B3D3 /* NavigationStackDestination.swift in Sources */,
DC784A112B31EA180018DC4A /* LiquidityAdsView.swift in Sources */,
DC9933322CC03D7500EB3100 /* ContactsListSheet.swift in Sources */,
DC6D26E329E76557006A7814 /* AnimatedClock.swift in Sources */,
DC72CEF52C99DCEB00C810A8 /* LnurlFlowErrorNotice.swift in Sources */,
DC5631C52C541E5C00DCB5BF /* Experimental.swift in Sources */,
Expand Down
7 changes: 6 additions & 1 deletion phoenix-ios/phoenix-ios/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -5590,6 +5590,9 @@
}
}
}
},
"Add to existing contact" : {

},
"adding to existing channel" : {
"comment" : "Transaction Info: Explanation",
Expand Down Expand Up @@ -13474,6 +13477,9 @@
}
}
}
},
"Create new contact" : {

},
"Create new wallet" : {
"localizations" : {
Expand Down Expand Up @@ -34729,7 +34735,6 @@
}
},
"Search" : {
"extractionState" : "stale",
"localizations" : {
"ar" : {
"stringUnit" : {
Expand Down
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
)
)
}
}
Loading

0 comments on commit d28f252

Please sign in to comment.