From 637d70e4ff678dabe74ca9d2d28274179abf9a25 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 4 Jan 2022 14:31:00 -0800 Subject: [PATCH] adding call option --- .../Views/InnerCircle/CircleFooterView.swift | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/nirvana-ios/Views/InnerCircle/CircleFooterView.swift b/nirvana-ios/Views/InnerCircle/CircleFooterView.swift index 2567a8f..6d79bc2 100644 --- a/nirvana-ios/Views/InnerCircle/CircleFooterView.swift +++ b/nirvana-ios/Views/InnerCircle/CircleFooterView.swift @@ -78,6 +78,7 @@ struct CircleFooterView: View { // friend options Menu { + // remove friend Button(role: .destructive) { print("deactivating friend...removing from circle") if self.authSessionStore.user?.id != nil && self.selectedFriendIndex != nil { @@ -89,15 +90,30 @@ struct CircleFooterView: View { Label("remove from circle", systemImage: "person.crop.circle.fill.badge.minus") } + // share addy Button { self.innerCircleVM.toast = .shareAddyPreview } label: { Label("share addy", systemImage: "house.circle.fill") } - + // regular call + Button { + print("calling user now") + + if self.selectedFriend?.phoneNumber != nil { + let tel: String = "tel://\(self.selectedFriend!.phoneNumber!)" + let strUrl: String = tel.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! + + UIApplication.shared.open(URL(string: strUrl)!, options: [:], completionHandler: nil) + } else { + print("phone number is nil of contact") + } + } label: { + Label("regular phone call", systemImage: "phone.and.waveform") + } } label: { - Label("friend options", systemImage: "leaf.circle.fill") + Label("friend options", systemImage: "pawprint.circle.fill") .labelStyle(.iconOnly) .foregroundColor(NirvanaColor.dimTeal) .font(.title)