Reduce size of bottom sheet when a button is clicked in callview

This commit is contained in:
Benoit Martins 2024-07-04 12:01:18 +02:00
parent f2312a2e36
commit 21ab16271c
2 changed files with 63 additions and 5 deletions

View file

@ -1927,6 +1927,13 @@ struct CallView: View {
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
}
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} else {
callViewModel.transferClicked()
}
@ -1956,6 +1963,13 @@ struct CallView: View {
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
}
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} label: {
HStack {
Image("phone-plus")
@ -2031,6 +2045,13 @@ struct CallView: View {
withAnimation {
isShowCallsListFragment.toggle()
}
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} label: {
HStack {
Image("phone-list")
@ -2076,6 +2097,12 @@ struct CallView: View {
VStack {
Button {
showingDialer.toggle()
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} label: {
HStack {
Image("dialer")
@ -2248,10 +2275,21 @@ struct CallView: View {
if callViewModel.isOneOneCall {
VStack {
Button {
withAnimation {
callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
if callViewModel.callsCounter < 2 {
withAnimation {
callViewModel.isTransferInsteadCall = true
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
}
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} else {
callViewModel.transferClicked()
}
} label: {
HStack {
@ -2279,6 +2317,13 @@ struct CallView: View {
MagicSearchSingleton.shared.searchForSuggestions()
isShowStartCallFragment.toggle()
}
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} label: {
HStack {
Image("phone-plus")
@ -2357,6 +2402,13 @@ struct CallView: View {
withAnimation {
isShowCallsListFragment.toggle()
}
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} label: {
HStack {
Image("phone-list")
@ -2402,6 +2454,12 @@ struct CallView: View {
VStack {
Button {
showingDialer.toggle()
DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {
telecomManager.callStarted = false
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
telecomManager.callStarted = true
}
}
} label: {
HStack {
Image("dialer")

View file

@ -35,7 +35,7 @@ class CallStatsModel: ObservableObject {
func update(call: Call, stats: CallStats) {
coreContext.doOnCoreQueue { core in
if call.params != nil {
self.isVideoEnabled = call.params!.videoEnabled && call.currentParams!.videoDirection != .Inactive
self.isVideoEnabled = call.params!.videoEnabled && call.currentParams != nil && call.currentParams!.videoDirection != .Inactive
switch stats.type {
case .Audio:
if call.currentParams != nil {