Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Benoit Martins
66df197e08 Update the call transfer 2025-04-01 17:55:52 +02:00
3 changed files with 162 additions and 75 deletions

View file

@ -2031,7 +2031,6 @@ struct CallView: View {
if callViewModel.isOneOneCall { if callViewModel.isOneOneCall {
VStack { VStack {
Button { Button {
if callViewModel.callsCounter < 2 {
withAnimation { withAnimation {
callViewModel.isTransferInsteadCall = true callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions() MagicSearchSingleton.shared.searchForSuggestions()
@ -2044,9 +2043,6 @@ struct CallView: View {
telecomManager.callStarted = true telecomManager.callStarted = true
} }
} }
} else {
callViewModel.transferClicked()
}
} label: { } label: {
HStack { HStack {
Image("phone-transfer") Image("phone-transfer")
@ -2061,7 +2057,7 @@ struct CallView: View {
.background(Color.gray500) .background(Color.gray500)
.cornerRadius(40) .cornerRadius(40)
Text(callViewModel.callsCounter < 2 ? "call_action_blind_transfer" : "call_action_attended_transfer") Text("call_action_blind_transfer")
.foregroundStyle(.white) .foregroundStyle(.white)
.default_text_style(styleSize: 15) .default_text_style(styleSize: 15)
} }
@ -2402,7 +2398,6 @@ struct CallView: View {
if callViewModel.isOneOneCall { if callViewModel.isOneOneCall {
VStack { VStack {
Button { Button {
if callViewModel.callsCounter < 2 {
withAnimation { withAnimation {
callViewModel.isTransferInsteadCall = true callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions() MagicSearchSingleton.shared.searchForSuggestions()
@ -2415,9 +2410,6 @@ struct CallView: View {
telecomManager.callStarted = true telecomManager.callStarted = true
} }
} }
} else {
callViewModel.transferClicked()
}
} label: { } label: {
HStack { HStack {
Image("phone-transfer") Image("phone-transfer")
@ -2432,7 +2424,7 @@ struct CallView: View {
.background(Color.gray500) .background(Color.gray500)
.cornerRadius(40) .cornerRadius(40)
Text(callViewModel.callsCounter < 2 ? "call_action_blind_transfer" : "call_action_attended_transfer") Text("call_action_blind_transfer")
.foregroundStyle(.white) .foregroundStyle(.white)
.default_text_style(styleSize: 15) .default_text_style(styleSize: 15)
} }

View file

@ -96,6 +96,98 @@ struct StartCallFragment: View {
.background(.white) .background(.white)
VStack(spacing: 0) { VStack(spacing: 0) {
if callViewModel.isTransferInsteadCall {
VStack {
HStack(alignment: .center) {
Text("contacts_list_all_contacts_title")
.default_text_style_800(styleSize: 16)
Spacer()
}
.padding(.vertical, 10)
.padding(.horizontal, 16)
if callViewModel.calls.count > 1 {
ForEach(0..<callViewModel.calls.count, id: \.self) { index in
HStack {
HStack {
if callViewModel.calls[index].callLog != nil && callViewModel.calls[index].callLog!.remoteAddress != nil {
if callViewModel.callsContactAvatarModel[index] != nil && callViewModel.calls[index].callLog?.conferenceInfo == nil {
Avatar(contactAvatarModel: callViewModel.callsContactAvatarModel[index]!, avatarSize: 50)
} else {
VStack {
Image("users-three-square")
.renderingMode(.template)
.resizable()
.frame(width: 28, height: 28)
.foregroundStyle(Color.grayMain2c600)
}
.frame(width: 50, height: 50)
.background(Color.grayMain2c200)
.clipShape(Circle())
}
if callViewModel.calls[index].callLog?.conferenceInfo == nil {
Text(callViewModel.callsContactAvatarModel[index]!.name)
.default_text_style(styleSize: 16)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(1)
} else {
Text(callViewModel.calls[index].callLog!.conferenceInfo!.subject ?? String(localized: "conference_name_error"))
.default_text_style(styleSize: 16)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(1)
}
Spacer()
HStack {
if callViewModel.calls[index].state == .PausedByRemote
|| callViewModel.calls[index].state == .Pausing
|| callViewModel.calls[index].state == .Paused
|| callViewModel.calls[index].state == .Resuming {
Text(callViewModel.calls[index].state == .Resuming ? String(localized: "call_state_resuming") : String(localized: "call_state_paused"))
.default_text_style_300(styleSize: 14)
.frame(maxWidth: .infinity, alignment: .trailing)
.lineLimit(1)
.padding(.horizontal, 4)
Image("pause")
.resizable()
.frame(width: 25, height: 25)
} else {
Text("call_state_connected")
.default_text_style_300(styleSize: 14)
.frame(maxWidth: .infinity, alignment: .trailing)
.lineLimit(1)
.padding(.horizontal, 4)
Image("phone-call")
.resizable()
.frame(width: 25, height: 25)
}
}
}
}
}
.buttonStyle(.borderless)
.listRowInsets(EdgeInsets(top: 10, leading: 20, bottom: 10, trailing: 20))
.listRowSeparator(.hidden)
.background(.white)
.onTapGesture {
}
}
} else {
HStack(alignment: .center) {
Text("contacts_list_all_contacts_title")
.default_text_style_800(styleSize: 16)
}
.padding(.vertical, 10)
.padding(.horizontal, 16)
}
}
}
ZStack(alignment: .trailing) { ZStack(alignment: .trailing) {
TextField("history_call_start_search_bar_filter_hint", text: $startCallViewModel.searchField) TextField("history_call_start_search_bar_filter_hint", text: $startCallViewModel.searchField)
.default_text_style(styleSize: 15) .default_text_style(styleSize: 15)
@ -170,6 +262,8 @@ struct StartCallFragment: View {
.padding(.vertical) .padding(.vertical)
.padding(.horizontal) .padding(.horizontal)
if !callViewModel.isTransferInsteadCall {
NavigationLink(destination: { NavigationLink(destination: {
StartGroupCallFragment(startCallViewModel: startCallViewModel) StartGroupCallFragment(startCallViewModel: startCallViewModel)
}, label: { }, label: {
@ -205,6 +299,7 @@ struct StartCallFragment: View {
.padding(.vertical, 10) .padding(.vertical, 10)
.padding(.horizontal, 40) .padding(.horizontal, 40)
) )
}
ScrollView { ScrollView {
if !ContactsManager.shared.lastSearch.isEmpty { if !ContactsManager.shared.lastSearch.isEmpty {