From 2a6c5a2a459a8413869ec3f2b1eae742c81b9236 Mon Sep 17 00:00:00 2001 From: talksik Date: Wed, 22 Dec 2021 01:48:43 -0800 Subject: [PATCH] adding call icon for now until I have insta join chat rooms --- .../Views/InnerCircle/CircleFooterView.swift | 59 ++++++++++++++----- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/nirvana-ios/Views/InnerCircle/CircleFooterView.swift b/nirvana-ios/Views/InnerCircle/CircleFooterView.swift index 2278914..6a5b026 100644 --- a/nirvana-ios/Views/InnerCircle/CircleFooterView.swift +++ b/nirvana-ios/Views/InnerCircle/CircleFooterView.swift @@ -26,15 +26,36 @@ struct CircleFooterView: View { HStack { if self.selectedFriend != nil && !self.convoRelativeTime.isEmpty && self.myTurn != nil { - Image(self.selectedFriend!.avatar ?? "") - .resizable() - .scaledToFit() - .background(NirvanaColor.teal.opacity(0.1)) - .frame(width: 40, height: 40) - .clipShape(Circle()) - .padding(5) + // call button + 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("Call", systemImage: "phone.and.waveform") + .labelStyle(.iconOnly) + .foregroundColor(NirvanaColor.teal) + .padding() + .font(.title2) + } - VStack (alignment: .leading) { + Text("Your Turn") + .padding() + .background(Color.orange.opacity(0.5)) + .clipShape(Capsule()) + + + Spacer() + + // meta data of convo + VStack (alignment: .trailing) { Text(self.selectedFriend!.nickname ?? "") .font(.footnote) .foregroundColor(NirvanaColor.light) @@ -43,14 +64,20 @@ struct CircleFooterView: View { .foregroundColor(.gray) } - if self.myTurn! { - Text("it's your turn") - } else { - Text("it's their turn") - } + Image(self.selectedFriend!.avatar ?? "") + .resizable() + .scaledToFit() + .background(NirvanaColor.teal.opacity(0.1)) + .frame(width: 40, height: 40) + .clipShape(Circle()) + .padding(5) + +// if self.myTurn! { +// Text("it's your turn") +// } else { +// Text("it's their turn") +// } } - - Spacer() } .frame(maxWidth: .infinity, maxHeight: 60) // 60 is the height of the footer control big circle .background(Color.white.opacity(0.5)) @@ -62,7 +89,7 @@ struct CircleFooterView: View { .animation(Animation.spring(), value: self.selectedFriendIndex) .offset( x:0, - y:self.selectedFriendIndex == nil ? 150 : 0 + y:self.selectedFriendIndex == nil ? 0 : 0 ) .onChange(of: self.selectedFriendIndex) {newValue in // update meta data based on which friend was selected