nextcloud / talk-ios

📱😀 Video & audio calls through Nextcloud on iOS
GNU General Public License v3.0
146 stars 86 forks source link

Simplify external signaling method calls #1670

Closed SystemKeeper closed 3 weeks ago

SystemKeeper commented 1 month ago

Currently we do something like this:

                    if let extSignalingController = NCSettingsController.sharedInstance().externalSignalingController(forAccountId: activeAccount.accountId) {
                        if extSignalingController.isEnabled() {
                            extSignalingController.leaveRoom(token)
                        }
                    }

As a first step we should move the isEnabled() check to the corresponding public methods, so we can write it like

                    if let extSignalingController = NCSettingsController.sharedInstance().externalSignalingController(forAccountId: activeAccount.accountId) {
                        extSignalingController.leaveRoom(token)
                    }

we could further simplify the calls, e.g.:

 NCSettingsController.shared.externalSignalingController(for: activeAccount)?.leaveRoom(token)
SystemKeeper commented 1 month ago

if extSignalingController.isEnabled() {

Seems this ins entirely unneeded and can be removed