Update the call transfer

This commit is contained in:
Benoit Martins 2025-04-01 17:55:52 +02:00
parent 512ca5afe8
commit 66df197e08
3 changed files with 162 additions and 75 deletions

View file

@ -2031,21 +2031,17 @@ struct CallView: View {
if callViewModel.isOneOneCall {
VStack {
Button {
if callViewModel.callsCounter < 2 {
withAnimation {
callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
withAnimation {
callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} else {
callViewModel.transferClicked()
}
} label: {
HStack {
@ -2061,7 +2057,7 @@ struct CallView: View {
.background(Color.gray500)
.cornerRadius(40)
Text(callViewModel.callsCounter < 2 ? "call_action_blind_transfer" : "call_action_attended_transfer")
Text("call_action_blind_transfer")
.foregroundStyle(.white)
.default_text_style(styleSize: 15)
}
@ -2402,21 +2398,17 @@ struct CallView: View {
if callViewModel.isOneOneCall {
VStack {
Button {
if callViewModel.callsCounter < 2 {
withAnimation {
callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
withAnimation {
callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} else {
callViewModel.transferClicked()
}
} label: {
HStack {
@ -2432,7 +2424,7 @@ struct CallView: View {
.background(Color.gray500)
.cornerRadius(40)
Text(callViewModel.callsCounter < 2 ? "call_action_blind_transfer" : "call_action_attended_transfer")
Text("call_action_blind_transfer")
.foregroundStyle(.white)
.default_text_style(styleSize: 15)
}

View file

@ -165,20 +165,20 @@ struct CallsListFragment: View {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
callViewModel.resetCallView()
}
}
}, label: {
HStack {
HStack {
Image((callViewModel.selectedCall!.state == .PausedByRemote
|| callViewModel.selectedCall!.state == .Pausing
}
}, label: {
HStack {
HStack {
Image((callViewModel.selectedCall!.state == .PausedByRemote
|| callViewModel.selectedCall!.state == .Pausing
|| callViewModel.selectedCall!.state == .Paused) ? String(localized: "call_action_resume_call") : String(localized: "call_action_pause_call"))
.resizable()
.frame(width: 30, height: 30)
}
.frame(width: 35, height: 30)
.background(.clear)
.cornerRadius(40)
.resizable()
.frame(width: 30, height: 30)
}
.frame(width: 35, height: 30)
.background(.clear)
.cornerRadius(40)
Text((callViewModel.selectedCall!.state == .PausedByRemote
|| callViewModel.selectedCall!.state == .Pausing

View file

@ -96,6 +96,98 @@ struct StartCallFragment: View {
.background(.white)
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) {
TextField("history_call_start_search_bar_filter_hint", text: $startCallViewModel.searchField)
.default_text_style(styleSize: 15)
@ -170,41 +262,44 @@ struct StartCallFragment: View {
.padding(.vertical)
.padding(.horizontal)
NavigationLink(destination: {
StartGroupCallFragment(startCallViewModel: startCallViewModel)
}, label: {
HStack {
HStack(alignment: .center) {
Image("meetings")
if !callViewModel.isTransferInsteadCall {
NavigationLink(destination: {
StartGroupCallFragment(startCallViewModel: startCallViewModel)
}, label: {
HStack {
HStack(alignment: .center) {
Image("meetings")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)
.frame(width: 20, height: 20, alignment: .leading)
}
.padding(16)
.background(Color.orangeMain500)
.cornerRadius(40)
Text("history_call_start_create_group_call")
.foregroundStyle(.black)
.default_text_style_800(styleSize: 16)
Spacer()
Image("caret-right")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)
.frame(width: 20, height: 20, alignment: .leading)
.foregroundStyle(Color.grayMain2c500)
.frame(width: 25, height: 25, alignment: .leading)
}
.padding(16)
.background(Color.orangeMain500)
.cornerRadius(40)
Text("history_call_start_create_group_call")
.foregroundStyle(.black)
.default_text_style_800(styleSize: 16)
Spacer()
Image("caret-right")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c500)
.frame(width: 25, height: 25, alignment: .leading)
}
})
.padding(.vertical, 10)
.padding(.horizontal, 20)
.background(
LinearGradient(gradient: Gradient(colors: [.grayMain2c100, .white]), startPoint: .leading, endPoint: .trailing)
.padding(.vertical, 10)
.padding(.horizontal, 40)
)
})
.padding(.vertical, 10)
.padding(.horizontal, 20)
.background(
LinearGradient(gradient: Gradient(colors: [.grayMain2c100, .white]), startPoint: .leading, endPoint: .trailing)
.padding(.vertical, 10)
.padding(.horizontal, 40)
)
}
ScrollView {
if !ContactsManager.shared.lastSearch.isEmpty {