mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Fix add participant process in group call and group conversation
This commit is contained in:
parent
e2432683ae
commit
917d22b1ec
6 changed files with 210 additions and 207 deletions
|
|
@ -220,7 +220,7 @@ struct ConversationForwardMessageFragment: View {
|
|||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.onAppear {
|
||||
if !magicSearch.currentFilter.isEmpty {
|
||||
if !magicSearch.currentFilter.isEmpty || (self.contactsManager.lastSearch.isEmpty && self.contactsManager.lastSearchSuggestions.isEmpty) {
|
||||
magicSearch.currentFilter = ""
|
||||
magicSearch.searchForContacts()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ struct StartConversationFragment: View {
|
|||
@FocusState var isSearchFieldFocused: Bool
|
||||
@State private var delayedColor = Color.white
|
||||
|
||||
@FocusState var isMessageTextFocused: Bool
|
||||
|
||||
@State var operationInProgress: Bool = false
|
||||
|
||||
var body: some View {
|
||||
|
|
@ -133,7 +131,7 @@ struct StartConversationFragment: View {
|
|||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
StartGroupConversationFragment()
|
||||
StartGroupConversationFragment(isShowStartConversationFragment: $isShowStartConversationFragment)
|
||||
.environmentObject(startConversationViewModel)
|
||||
}, label: {
|
||||
HStack {
|
||||
|
|
@ -204,37 +202,9 @@ struct StartConversationFragment: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.background(.white)
|
||||
|
||||
if !startConversationViewModel.participants.isEmpty {
|
||||
startConversationPopup
|
||||
.background(.black.opacity(0.65))
|
||||
.onAppear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
|
||||
isMessageTextFocused = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if startConversationViewModel.operationInProgress {
|
||||
PopupLoadingView()
|
||||
.background(.black.opacity(0.65))
|
||||
.onDisappear {
|
||||
startConversationViewModel.searchField = ""
|
||||
magicSearch.currentFilter = ""
|
||||
magicSearch.searchForContacts()
|
||||
delayColorDismiss()
|
||||
|
||||
isShowStartConversationFragment = false
|
||||
|
||||
if let displayedConversation = startConversationViewModel.displayedConversation {
|
||||
self.conversationsListViewModel.changeDisplayedChatRoom(conversationModel: displayedConversation)
|
||||
startConversationViewModel.displayedConversation = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if !magicSearch.currentFilter.isEmpty {
|
||||
if !magicSearch.currentFilter.isEmpty || (self.contactsManager.lastSearch.isEmpty && self.contactsManager.lastSearchSuggestions.isEmpty) {
|
||||
magicSearch.currentFilter = ""
|
||||
magicSearch.searchForContacts()
|
||||
}
|
||||
|
|
@ -297,75 +267,6 @@ struct StartConversationFragment: View {
|
|||
.listRowSeparator(.hidden)
|
||||
}
|
||||
}
|
||||
|
||||
var startConversationPopup: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading) {
|
||||
Text("conversation_dialog_set_subject")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.frame(alignment: .leading)
|
||||
.padding(.bottom, 2)
|
||||
|
||||
TextField("conversation_dialog_subject_hint", text: $startConversationViewModel.messageText)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isMessageTextFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isMessageTextFocused)
|
||||
|
||||
Button(action: {
|
||||
startConversationViewModel.participants.removeAll()
|
||||
}, label: {
|
||||
Text("dialog_cancel")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Button(action: {
|
||||
startConversationViewModel.createGroupChatRoom()
|
||||
}, label: {
|
||||
Text("dialog_ok")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(startConversationViewModel.messageText.isEmpty ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(startConversationViewModel.messageText.isEmpty)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 20)
|
||||
.background(.white)
|
||||
.cornerRadius(20)
|
||||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
.onDisappear {
|
||||
startConversationViewModel.messageText = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
|
|||
|
|
@ -26,14 +26,114 @@ struct StartGroupConversationFragment: View {
|
|||
|
||||
@State var addParticipantsViewModel = AddParticipantsViewModel()
|
||||
|
||||
@FocusState var isMessageTextFocused: Bool
|
||||
|
||||
@Binding var isShowStartConversationFragment: Bool
|
||||
|
||||
var body: some View {
|
||||
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startConversationViewModel.addParticipants)
|
||||
.onAppear {
|
||||
addParticipantsViewModel.participantsToAdd = startConversationViewModel.participants
|
||||
ZStack {
|
||||
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startConversationViewModel.addParticipants)
|
||||
.onAppear {
|
||||
addParticipantsViewModel.participantsToAdd = startConversationViewModel.participants
|
||||
}
|
||||
|
||||
|
||||
if !startConversationViewModel.participants.isEmpty {
|
||||
startConversationPopup
|
||||
.background(.black.opacity(0.65))
|
||||
.onAppear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
|
||||
isMessageTextFocused = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if startConversationViewModel.operationInProgress {
|
||||
PopupLoadingView()
|
||||
.background(.black.opacity(0.65))
|
||||
.onDisappear {
|
||||
startConversationViewModel.searchField = ""
|
||||
MagicSearchSingleton.shared.currentFilter = ""
|
||||
MagicSearchSingleton.shared.searchForContacts()
|
||||
//delayColorDismiss()
|
||||
|
||||
isShowStartConversationFragment = false
|
||||
|
||||
if let displayedConversation = startConversationViewModel.displayedConversation {
|
||||
self.conversationsListViewModel.changeDisplayedChatRoom(conversationModel: displayedConversation)
|
||||
startConversationViewModel.displayedConversation = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var startConversationPopup: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading) {
|
||||
Text("conversation_dialog_set_subject")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.frame(alignment: .leading)
|
||||
.padding(.bottom, 2)
|
||||
|
||||
TextField("conversation_dialog_subject_hint", text: $startConversationViewModel.messageText)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isMessageTextFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isMessageTextFocused)
|
||||
|
||||
Button(action: {
|
||||
startConversationViewModel.participants.removeAll()
|
||||
}, label: {
|
||||
Text("dialog_cancel")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Button(action: {
|
||||
startConversationViewModel.createGroupChatRoom()
|
||||
}, label: {
|
||||
Text("dialog_ok")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(startConversationViewModel.messageText.isEmpty ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(startConversationViewModel.messageText.isEmpty)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 20)
|
||||
.background(.white)
|
||||
.cornerRadius(20)
|
||||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
.onDisappear {
|
||||
startConversationViewModel.messageText = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
StartGroupConversationFragment()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ struct StartCallFragment: View {
|
|||
@FocusState var isSearchFieldFocused: Bool
|
||||
@State private var delayedColor = Color.white
|
||||
|
||||
@FocusState var isMessageTextFocused: Bool
|
||||
|
||||
var resetCallView: () -> Void
|
||||
|
||||
var body: some View {
|
||||
|
|
@ -198,7 +196,8 @@ struct StartCallFragment: View {
|
|||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
StartGroupCallFragment(startCallViewModel: startCallViewModel)
|
||||
StartGroupCallFragment(isShowStartCallFragment: $isShowStartCallFragment)
|
||||
.environmentObject(startCallViewModel)
|
||||
}, label: {
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -308,29 +307,11 @@ struct StartCallFragment: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.background(.white)
|
||||
|
||||
if !startCallViewModel.participants.isEmpty {
|
||||
startCallPopup
|
||||
.background(.black.opacity(0.65))
|
||||
.onAppear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
|
||||
isMessageTextFocused = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if startCallViewModel.operationInProgress {
|
||||
PopupLoadingView()
|
||||
.background(.black.opacity(0.65))
|
||||
.onDisappear {
|
||||
isShowStartCallFragment.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.onAppear {
|
||||
if !magicSearch.currentFilter.isEmpty {
|
||||
if !magicSearch.currentFilter.isEmpty || (self.contactsManager.lastSearch.isEmpty && self.contactsManager.lastSearchSuggestions.isEmpty) {
|
||||
magicSearch.currentFilter = ""
|
||||
magicSearch.searchForContacts()
|
||||
}
|
||||
|
|
@ -431,72 +412,6 @@ struct StartCallFragment: View {
|
|||
.listRowSeparator(.hidden)
|
||||
}
|
||||
}
|
||||
|
||||
var startCallPopup: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading) {
|
||||
Text("history_group_call_start_dialog_set_subject")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.frame(alignment: .leading)
|
||||
.padding(.bottom, 2)
|
||||
|
||||
TextField("history_group_call_start_dialog_subject_hint", text: $startCallViewModel.messageText)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isMessageTextFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isMessageTextFocused)
|
||||
|
||||
Button(action: {
|
||||
startCallViewModel.participants.removeAll()
|
||||
}, label: {
|
||||
Text("dialog_cancel")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Button(action: {
|
||||
startCallViewModel.createGroupCall()
|
||||
}, label: {
|
||||
Text("dialog_call")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(startCallViewModel.messageText.isEmpty ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(startCallViewModel.messageText.isEmpty)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 20)
|
||||
.background(.white)
|
||||
.cornerRadius(20)
|
||||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
|
|||
|
|
@ -20,17 +20,104 @@
|
|||
import SwiftUI
|
||||
|
||||
struct StartGroupCallFragment: View {
|
||||
@ObservedObject var startCallViewModel: StartCallViewModel
|
||||
@EnvironmentObject var startCallViewModel: StartCallViewModel
|
||||
|
||||
@State var addParticipantsViewModel = AddParticipantsViewModel()
|
||||
|
||||
@FocusState var isMessageTextFocused: Bool
|
||||
|
||||
@Binding var isShowStartCallFragment: Bool
|
||||
|
||||
var body: some View {
|
||||
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startCallViewModel.addParticipants)
|
||||
.onAppear {
|
||||
addParticipantsViewModel.participantsToAdd = startCallViewModel.participants
|
||||
ZStack {
|
||||
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startCallViewModel.addParticipants)
|
||||
.onAppear {
|
||||
addParticipantsViewModel.participantsToAdd = startCallViewModel.participants
|
||||
}
|
||||
|
||||
if !startCallViewModel.participants.isEmpty {
|
||||
startCallPopup
|
||||
.background(.black.opacity(0.65))
|
||||
.onAppear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
|
||||
isMessageTextFocused = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if startCallViewModel.operationInProgress {
|
||||
PopupLoadingView()
|
||||
.background(.black.opacity(0.65))
|
||||
.onDisappear {
|
||||
isShowStartCallFragment.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
StartGroupCallFragment(startCallViewModel: StartCallViewModel())
|
||||
|
||||
var startCallPopup: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading) {
|
||||
Text("history_group_call_start_dialog_set_subject")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.frame(alignment: .leading)
|
||||
.padding(.bottom, 2)
|
||||
|
||||
TextField("history_group_call_start_dialog_subject_hint", text: $startCallViewModel.messageText)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isMessageTextFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isMessageTextFocused)
|
||||
|
||||
Button(action: {
|
||||
startCallViewModel.participants.removeAll()
|
||||
}, label: {
|
||||
Text("dialog_cancel")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Button(action: {
|
||||
startCallViewModel.createGroupCall()
|
||||
}, label: {
|
||||
Text("dialog_call")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(startCallViewModel.messageText.isEmpty ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(startCallViewModel.messageText.isEmpty)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 20)
|
||||
.background(.white)
|
||||
.cornerRadius(20)
|
||||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ struct AddParticipantsFragment: View {
|
|||
Button {
|
||||
withAnimation {
|
||||
confirmAddParticipantsFunc(addParticipantsViewModel.participantsToAdd)
|
||||
dismiss()
|
||||
//dismiss()
|
||||
|
||||
magicSearch.currentFilter = ""
|
||||
magicSearch.searchForContacts()
|
||||
|
|
@ -272,7 +272,7 @@ struct AddParticipantsFragment: View {
|
|||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.onAppear {
|
||||
if !magicSearch.currentFilter.isEmpty {
|
||||
if !magicSearch.currentFilter.isEmpty || (self.contactsManager.lastSearch.isEmpty && self.contactsManager.lastSearchSuggestions.isEmpty) {
|
||||
magicSearch.currentFilter = ""
|
||||
magicSearch.searchForContacts()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue