creating another footer to handle convos
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
8904DEC8277055E90071E6CA /* OnboardingOneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8904DEC7277055E90071E6CA /* OnboardingOneView.swift */; };
|
||||
89091993277D958D0025F4BB /* ConvoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89091992277D958D0025F4BB /* ConvoViewModel.swift */; };
|
||||
89091995277DD9F80025F4BB /* ConvoFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89091994277DD9F80025F4BB /* ConvoFooterView.swift */; };
|
||||
890C245D277BF628009B4A30 /* AgoraRtcKit in Frameworks */ = {isa = PBXBuildFile; productRef = 890C245C277BF628009B4A30 /* AgoraRtcKit */; };
|
||||
890C2460277BF896009B4A30 /* AgoraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890C245F277BF896009B4A30 /* AgoraViewController.swift */; };
|
||||
890C2462277BF935009B4A30 /* CallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890C2461277BF935009B4A30 /* CallView.swift */; };
|
||||
@@ -94,6 +95,7 @@
|
||||
/* Begin PBXFileReference section */
|
||||
8904DEC7277055E90071E6CA /* OnboardingOneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingOneView.swift; sourceTree = "<group>"; };
|
||||
89091992277D958D0025F4BB /* ConvoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConvoViewModel.swift; sourceTree = "<group>"; };
|
||||
89091994277DD9F80025F4BB /* ConvoFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConvoFooterView.swift; sourceTree = "<group>"; };
|
||||
890C245F277BF896009B4A30 /* AgoraViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgoraViewController.swift; sourceTree = "<group>"; };
|
||||
890C2461277BF935009B4A30 /* CallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallView.swift; sourceTree = "<group>"; };
|
||||
890C2463277BFA97009B4A30 /* AgroRep.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgroRep.swift; sourceTree = "<group>"; };
|
||||
@@ -376,6 +378,7 @@
|
||||
children = (
|
||||
89814682277D83F300DA46CD /* ConvosView.swift */,
|
||||
89091992277D958D0025F4BB /* ConvoViewModel.swift */,
|
||||
89091994277DD9F80025F4BB /* ConvoFooterView.swift */,
|
||||
);
|
||||
path = Convos;
|
||||
sourceTree = "<group>";
|
||||
@@ -632,6 +635,7 @@
|
||||
89F05BA6276ACD830002E9C7 /* ContactsPickerView.swift in Sources */,
|
||||
8904DEC8277055E90071E6CA /* OnboardingOneView.swift in Sources */,
|
||||
896CE7022770892F00DB474E /* CircleGridView.swift in Sources */,
|
||||
89091995277DD9F80025F4BB /* ConvoFooterView.swift in Sources */,
|
||||
89BDCDEA27697F9C00577829 /* UserMenu.swift in Sources */,
|
||||
89BCABE7276B3D64009E9B10 /* InnerCircleViewModel.swift in Sources */,
|
||||
89A107E5277476CC00B971FD /* PushNotificationService.swift in Sources */,
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// ConvoFooterView.swift
|
||||
// nirvana-ios
|
||||
//
|
||||
// Created by Arjun Patel on 12/30/21.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ConvoFooterView: View {
|
||||
@EnvironmentObject var convoVM: ConvoViewModel
|
||||
|
||||
@State private var convoRelativeTime = "started 20 minutes ago"
|
||||
|
||||
var body: some View {
|
||||
ZStack(alignment:.bottomTrailing) {
|
||||
VStack(alignment:.center) {
|
||||
Spacer()
|
||||
|
||||
HStack {
|
||||
ProfilePictureOverlap()
|
||||
|
||||
// meta data of convo
|
||||
VStack (alignment: .leading) {
|
||||
Text("kev, sarth, and 5 others")
|
||||
.font(.footnote)
|
||||
.foregroundColor(NirvanaColor.light)
|
||||
|
||||
Text(self.convoRelativeTime)
|
||||
.font(.caption2)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
// disconnect button
|
||||
Button {
|
||||
print("showing more info about the chat")
|
||||
|
||||
// show a sheet of the members in the call and add them if I want
|
||||
|
||||
} label: {
|
||||
Label("attendees", systemImage: "person.2.circle.fill")
|
||||
.labelStyle(.iconOnly)
|
||||
.foregroundColor(NirvanaColor.teal)
|
||||
.padding()
|
||||
.font(.title2)
|
||||
}
|
||||
|
||||
// disconnect button
|
||||
Button {
|
||||
print("disconnecting user now ")
|
||||
|
||||
self.convoVM.leaveConvo()
|
||||
|
||||
// show success or failure toast
|
||||
} label: {
|
||||
Label("Call", systemImage: "powerplug.fill")
|
||||
.labelStyle(.iconOnly)
|
||||
.foregroundColor(Color.orange)
|
||||
.padding()
|
||||
.font(.title2)
|
||||
}
|
||||
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: 60) // 60 is the height of the footer control big circle
|
||||
.background(Color.white.opacity(0.5))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 30, style: .continuous))
|
||||
.shadow(color: Color.black.opacity(0.25), radius: 30, x: 0, y: 20)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.animation(Animation.spring(), value: self.convoVM.selectedConvoId)
|
||||
.offset(
|
||||
x:0,
|
||||
y:self.convoVM.selectedConvoId == nil ? 150 : 0
|
||||
)
|
||||
.onChange(of: self.convoVM.selectedConvoId) {newConvo in
|
||||
// update meta data based on which convo was selected
|
||||
|
||||
// reset the selected options to start fresh
|
||||
// self.convoRelativeTime = ""
|
||||
|
||||
// get relative start time of convo
|
||||
// let formatter = RelativeDateTimeFormatter()
|
||||
// formatter.unitsStyle = .full
|
||||
//
|
||||
// let relativeDate = formatter.localizedString(for: ?.sentTimestamp ?? Date(), relativeTo: Date())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ConvoFooterView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ConvoFooterView()
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ struct CircleFooterView: View {
|
||||
@EnvironmentObject var navigationStack: NavigationStack
|
||||
@EnvironmentObject var authSessionStore: AuthSessionStore
|
||||
@EnvironmentObject var innerCircleVM: InnerCircleViewModel
|
||||
@EnvironmentObject var convoVM: ConvoViewModel
|
||||
|
||||
@Binding var selectedFriendIndex: String?
|
||||
|
||||
@@ -131,6 +130,11 @@ struct CircleFooterView: View {
|
||||
// update meta data based on which friend was selected
|
||||
let myId = self.authSessionStore.user?.id
|
||||
|
||||
// reset the selected options to start fresh
|
||||
self.selectedFriend = nil
|
||||
self.myTurn = false
|
||||
self.convoRelativeTime = ""
|
||||
|
||||
// set convo moment/relative time to show
|
||||
if newValue != nil && myId != nil {
|
||||
self.selectedFriend = self.authSessionStore.relevantUsersDict[newValue!]
|
||||
|
||||
@@ -86,19 +86,11 @@ struct InnerCircleView: View {
|
||||
}
|
||||
.padding()
|
||||
} else {
|
||||
VStack(alignment: .leading) {
|
||||
// convos
|
||||
// ConvosView()
|
||||
// .environmentObject(self.convoViewModel)
|
||||
// .padding(.top, 50)
|
||||
|
||||
// inner circle grid
|
||||
CircleGridView(selectedFriendIndex: self.$selectedFriendIndex)
|
||||
.environmentObject(self.innerCircleVM)
|
||||
.environmentObject(self.convoViewModel)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
// inner circle grid
|
||||
CircleGridView(selectedFriendIndex: self.$selectedFriendIndex)
|
||||
.environmentObject(self.innerCircleVM)
|
||||
.environmentObject(self.convoViewModel)
|
||||
|
||||
}
|
||||
|
||||
// header
|
||||
|
||||
Reference in New Issue
Block a user