From fa50f5b81dfedcc601785cb9b8a43f88c4497eb8 Mon Sep 17 00:00:00 2001 From: talksik Date: Sun, 2 Jan 2022 02:32:51 -0800 Subject: [PATCH] nicer text and tweaks --- .../Views/InnerCircle/CircleFooterView.swift | 67 ++++++------------- .../Views/InnerCircle/CircleGridView.swift | 8 +-- .../Views/Templates/UserStatusView.swift | 35 ++++++++-- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/nirvana-ios/Views/InnerCircle/CircleFooterView.swift b/nirvana-ios/Views/InnerCircle/CircleFooterView.swift index 82d6d69..4202dd9 100644 --- a/nirvana-ios/Views/InnerCircle/CircleFooterView.swift +++ b/nirvana-ios/Views/InnerCircle/CircleFooterView.swift @@ -36,16 +36,7 @@ struct CircleFooterView: View { .clipShape(Circle()) .overlay(alignment: .topTrailing) { // user status - switch self.selectedFriend!.userStatus { - case .online: - Circle() - .frame(width: 10, height: 10) - .foregroundColor(Color.green) - case .offline: - EmptyView() - default: - EmptyView() - } + UserStatusView(status: self.selectedFriend!.userStatus, size: 10) } .padding(5) .contextMenu { @@ -69,50 +60,34 @@ struct CircleFooterView: View { // meta data of convo VStack (alignment: .leading) { if self.selectedFriend != nil { - Text(self.selectedFriend!.nickname ?? "") + Text((self.selectedFriend!.nickname ?? "") + " ") .font(.footnote) .foregroundColor(NirvanaColor.light) - } - if !self.convoRelativeTime.isEmpty && self.myTurn != nil { - if self.myTurn! { - Label("your turn", systemImage: "wave.3.right.circle.fill") - .foregroundColor(Color.orange) - .font(.caption) - } else { - Label("their turn", systemImage: "wave.3.right.circle.fill") - .foregroundColor(NirvanaColor.dimTeal) - .font(.caption) + + + UserStatusTextView(status: self.selectedFriend!.userStatus).body + + if !self.convoRelativeTime.isEmpty && self.myTurn != nil { + if self.myTurn! { + Label("your turn", systemImage: "wave.3.right.circle.fill") + .foregroundColor(Color.orange) + .font(.caption) + } else { + Label("their turn", systemImage: "wave.3.right.circle.fill") + .foregroundColor(NirvanaColor.dimTeal) + .font(.caption) + } + + Text(self.convoRelativeTime) + .font(.caption2) + .foregroundColor(.gray) } - Text(self.convoRelativeTime) - .font(.caption2) - .foregroundColor(.gray) + } + } Spacer() - - if self.selectedFriend != nil { - // 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) - } - } } .frame(maxWidth: .infinity, maxHeight: 60) // 60 is the height of the footer control big circle .background(Color.white.opacity(0.5)) diff --git a/nirvana-ios/Views/InnerCircle/CircleGridView.swift b/nirvana-ios/Views/InnerCircle/CircleGridView.swift index c8304a1..3a5d739 100644 --- a/nirvana-ios/Views/InnerCircle/CircleGridView.swift +++ b/nirvana-ios/Views/InnerCircle/CircleGridView.swift @@ -189,10 +189,10 @@ struct CircleGridView: View { print("activated long press!") // if in a convo, I don't want to have user footer show up - if self.convoVM.isInCall() { - print("can't select another friend because I am in a call...leave call first") - return - } +// if self.convoVM.isInCall() { +// print("can't select another friend because I am in a call...leave call first") +// return +// } // stop any player still playing of a message self.queuePlayer.removeAllItems() diff --git a/nirvana-ios/Views/Templates/UserStatusView.swift b/nirvana-ios/Views/Templates/UserStatusView.swift index 687b231..340853a 100644 --- a/nirvana-ios/Views/Templates/UserStatusView.swift +++ b/nirvana-ios/Views/Templates/UserStatusView.swift @@ -20,16 +20,16 @@ struct UserStatusView: View { .frame(width: size, height: size) .foregroundColor(Color.green) .padding(padding) - case .offline: - Circle() - .frame(width: size, height: size) - .foregroundColor(Color.red) - .padding(padding) case .inConvo: Circle() .frame(width: size, height: size) .foregroundColor(Color.orange) .padding(padding) + case .background: + Circle() + .frame(width: size, height: size) + .foregroundColor(NirvanaColor.dimTeal) + .padding(padding) default: EmptyView() } @@ -41,3 +41,28 @@ struct UserStatusView: View { // UserStatusView() // } //} + +struct UserStatusTextView { + var status: UserStatus? + + var body: Text { + switch self.status { + case .online: + return Text("online") + .font(.caption2) + .foregroundColor(Color.green) + case .inConvo: + return Text("in convo") + .font(.caption2) + .foregroundColor(Color.orange) + case .background: + return Text("idle") + .font(.caption2) + .foregroundColor(NirvanaColor.dimTeal) + default: + return Text("offline") + .font(.caption2) + .foregroundColor(Color.gray) + } + } +}