Skip to content

Commit

Permalink
feat: sync mute button state in CallView with call state when app ent…
Browse files Browse the repository at this point in the history
…ers foreground
  • Loading branch information
gbattistel committed Dec 9, 2024
1 parent 69c286e commit df01d4b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions TelnyxWebRTCDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ class ViewController: UIViewController {
self.telnyxClient = appDelegate.telnyxClient
self.initViews()

// Register notifications
NotificationCenter.default.addObserver(self,
selector: #selector(appWillEnterForeground),
name: UIApplication.willEnterForegroundNotification,
object: nil)
}

deinit {
NotificationCenter.default.removeObserver(self)
}

func initViews() {
Expand Down Expand Up @@ -132,6 +141,11 @@ class ViewController: UIViewController {
self.showHiddenOptions()
}
}

@objc func appWillEnterForeground() {
print("ViewController:: App is about to enter the foreground")
self.callView.isMuted = self.appDelegate.currentCall?.isMuted ?? false
}

func showHiddenOptions() {
let alert = UIAlertController(title: "Options", message: "", preferredStyle: .actionSheet)
Expand Down

0 comments on commit df01d4b

Please sign in to comment.