ios: Refactored code

This commit is contained in:
openvidu 2024-08-07 12:47:20 +02:00 committed by Unknown
parent a5d1afedf0
commit 00248c9870
5 changed files with 8 additions and 18 deletions

View File

@ -38,6 +38,7 @@ struct LazyView<Content: View>: View {
struct LKButton: View {
let title: String
let action: () -> Void
var color: Color = Color.ovBlue // Default color
var body: some View {
Button(action: action,
@ -47,7 +48,7 @@ struct LKButton: View {
.padding(.horizontal, 12)
.padding(.vertical, 10)
})
.background(Color.ovBlue)
.background(color)
.cornerRadius(8)
}
}

View File

@ -68,8 +68,6 @@ struct ConfigureUrlsView: View {
Text(errorMessage)
.foregroundColor(.red)
}
.padding()
.frame(width: geometry.size.width) // Make the scroll view full-width
@ -79,10 +77,7 @@ struct ConfigureUrlsView: View {
#if os(macOS)
.frame(minWidth: 500, minHeight: 500)
#endif
.alert(isPresented: $roomCtx.shouldShowDisconnectReason) {
Alert(title: Text("Disconnected"),
message: Text("Reason: " + String(describing: roomCtx.latestError)))
}
}
func isValidURL(_ urlString: String) -> Bool {

View File

@ -61,15 +61,15 @@ struct ConnectView: View {
Spacer()
LKButton(title: "Reset urls") {
LKButton(title: "Reset urls", action: {
Task.detached { @MainActor in
roomCtx.livekitUrl = ""
appCtx.applicationServerUrl = ""
}
}
}, color: Color.ovYellow)
LKButton(title: "Connect") {
LKButton(title: "Join") {
Task.detached { @MainActor in
await connectToRoom()
}

View File

@ -81,14 +81,8 @@ struct RoomView: View {
@EnvironmentObject var room: Room
@State var isCameraPublishingBusy = false
@State var isMicrophonePublishingBusy = false
@State var isScreenSharePublishingBusy = false
@State private var screenPickerPresented = false
@State private var publishOptionsPickerPresented = false
@State private var cameraPublishOptions = VideoPublishOptions()
@State var isMicrophonePublishingBusy = false
#if os(macOS)
@ObservedObject private var windowAccess = WindowAccess()
#endif