ios: different speaker buttons on call screen

This commit is contained in:
Evgeny Poberezkin
2023-03-16 08:46:13 +00:00
parent 2643ea9066
commit 809cc1f234

View File

@@ -264,7 +264,7 @@ struct ActiveCallOverlay: View {
private func endCallButton() -> some View {
let cc = CallController.shared
return callButton("phone.down.fill", size: 60) {
return callButton("phone.down.fill", width: 60, height: 60) {
if let uuid = call.callkitUUID {
cc.endCall(callUUID: uuid)
} else {
@@ -286,7 +286,7 @@ struct ActiveCallOverlay: View {
}
private func toggleSpeakerButton() -> some View {
controlButton(call, call.speakerEnabled ? "speaker.fill" : "speaker.slash") {
controlButton(call, call.speakerEnabled ? "speaker.wave.2.fill" : "speaker.wave.1.fill") {
Task {
client.setSpeakerEnabledAndConfigureSession(!call.speakerEnabled)
DispatchQueue.main.async {
@@ -317,22 +317,22 @@ struct ActiveCallOverlay: View {
@ViewBuilder private func controlButton(_ call: Call, _ imageName: String, _ perform: @escaping () -> Void) -> some View {
if call.hasMedia {
callButton(imageName, size: 40, perform)
callButton(imageName, width: 50, height: 38, perform)
.foregroundColor(.white)
.opacity(0.85)
} else {
Color.clear.frame(width: 40, height: 40)
Color.clear.frame(width: 50, height: 38)
}
}
private func callButton(_ imageName: String, size: CGFloat, _ perform: @escaping () -> Void) -> some View {
private func callButton(_ imageName: String, width: CGFloat, height: CGFloat, _ perform: @escaping () -> Void) -> some View {
Button {
perform()
} label: {
Image(systemName: imageName)
.resizable()
.scaledToFit()
.frame(maxWidth: size, maxHeight: size)
.frame(maxWidth: width, maxHeight: height)
}
}
}