Skip to content

Commit

Permalink
Show error message if TRC is choosen for Loop
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorkert committed Jan 27, 2025
1 parent 10b582f commit a9757f3
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions LoopFollow/Remote/RemoteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ class RemoteViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

cancellable = Storage.shared.remoteType.objectWillChange
.sink { [weak self] _ in
DispatchQueue.main.async {
self?.updateView()
}
cancellable = Publishers.CombineLatest(
Storage.shared.remoteType.objectWillChange,
ObservableUserDefaults.shared.device.objectWillChange
)
.sink { [weak self] _, _ in
DispatchQueue.main.async {
self?.updateView()
}
}

updateView()
}
Expand Down Expand Up @@ -53,9 +56,17 @@ class RemoteViewController: UIViewController {

hostingController = UIHostingController(rootView: remoteView)
} else if remoteType == .trc {
let trioRemoteControlViewModel = TrioRemoteControlViewModel()
let trioRemoteControlView = TrioRemoteControlView(viewModel: trioRemoteControlViewModel)
hostingController = UIHostingController(rootView: AnyView(trioRemoteControlView))
if ObservableUserDefaults.shared.device.value != "Trio" {
hostingController = UIHostingController(
rootView: AnyView(
Text("Trio Remote Control is only supported for 'Trio'")
)
)
} else {
let trioRemoteControlViewModel = TrioRemoteControlViewModel()
let trioRemoteControlView = TrioRemoteControlView(viewModel: trioRemoteControlViewModel)
hostingController = UIHostingController(rootView: AnyView(trioRemoteControlView))
}
} else {
hostingController = UIHostingController(rootView: AnyView(Text("Please select a Remote Type in Settings.")))
}
Expand Down

0 comments on commit a9757f3

Please # to comment.