Skip to content

Commit

Permalink
Call completion block in all cases
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
SystemKeeper committed Mar 14, 2024
1 parent f4baf4f commit 95a1750
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions NextcloudTalk/NCAPIControllerExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ import Foundation
}

public func getRoomCapabilities(for accountId: String, token: String, completionBlock: @escaping (_ roomCapabilities: [String: AnyObject]?, _ proxyHash: String?) -> Void) {
guard let encodedToken = token.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) else { return }
let account = NCDatabaseManager.sharedInstance().talkAccount(forAccountId: accountId)!
let apiVersion = self.conversationAPIVersion(for: account)
let urlString = self.getRequestURL(forEndpoint: "room/\(encodedToken)/capabilities", withAPIVersion: apiVersion, for: account)

guard let apiSessionManager = self.apiSessionManagers.object(forKey: account.accountId) as? NCAPISessionManager
guard let account = NCDatabaseManager.sharedInstance().talkAccount(forAccountId: accountId),
let apiSessionManager = self.apiSessionManagers.object(forKey: account.accountId) as? NCAPISessionManager,
let encodedToken = token.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
else {
completionBlock(nil, nil)
return
}

let apiVersion = self.conversationAPIVersion(for: account)
let urlString = self.getRequestURL(forEndpoint: "room/\(encodedToken)/capabilities", withAPIVersion: apiVersion, for: account)

apiSessionManager.get(urlString, parameters: nil, progress: nil) { task, result in
if let ocs = self.getOcsResponse(data: result),
let data = ocs["data"] as? [String: AnyObject],
Expand Down

0 comments on commit 95a1750

Please sign in to comment.