diff --git a/Rocket.Chat.ShareExtension/Info.plist b/Rocket.Chat.ShareExtension/Info.plist index e955833bac..498a8c959b 100644 --- a/Rocket.Chat.ShareExtension/Info.plist +++ b/Rocket.Chat.ShareExtension/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 3.0.3 + 3.0.4 CFBundleVersion - 203 + 206 ITSEncryptionExportComplianceCode NSExtension diff --git a/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift b/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift index 0440829cf9..9baddaa5e5 100644 --- a/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift +++ b/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift @@ -183,6 +183,12 @@ final class ConnectServerViewController: BaseViewController { controller.serverVersion = infoRequestHandler.version controller.serverURL = url controller.serverPublicSettings = serverPublicSettings + + if let credentials = deepLinkCredentials { + _ = controller.view + controller.authenticateWithDeepLinkCredentials(credentials) + deepLinkCredentials = nil + } } if let controller = segue.destination as? AuthTableViewController, segue.identifier == "Auth" { diff --git a/Rocket.Chat/Controllers/Auth/LoginTableViewController.swift b/Rocket.Chat/Controllers/Auth/LoginTableViewController.swift index 01d73cc6f5..f8b053f112 100644 --- a/Rocket.Chat/Controllers/Auth/LoginTableViewController.swift +++ b/Rocket.Chat/Controllers/Auth/LoginTableViewController.swift @@ -164,6 +164,12 @@ class LoginTableViewController: BaseTableViewController { // MARK: Actions + func authenticateWithDeepLinkCredentials(_ credentials: DeepLinkCredentials) { + view.layoutIfNeeded() + startLoading() + AuthManager.auth(token: credentials.token, completion: self.handleAuthenticationResponse) + } + @IBAction func buttonOnePasswordDidPressed(_ sender: Any) { let siteURL = serverPublicSettings?.siteURL ?? "" OnePasswordExtension.shared().findLogin(forURLString: siteURL, for: self, sender: sender) { [weak self] (login, _) in diff --git a/Rocket.Chat/Info.plist b/Rocket.Chat/Info.plist index 08da950e0f..5f5f9ec140 100644 --- a/Rocket.Chat/Info.plist +++ b/Rocket.Chat/Info.plist @@ -206,7 +206,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0.3 + 3.0.4 CFBundleSignature ???? CFBundleURLTypes @@ -222,7 +222,7 @@ CFBundleVersion - 203 + 206 Fabric APIKey diff --git a/Rocket.Chat/Models/User/UserPermissions.swift b/Rocket.Chat/Models/User/UserPermissions.swift index 93db4897fc..91233e4b47 100644 --- a/Rocket.Chat/Models/User/UserPermissions.swift +++ b/Rocket.Chat/Models/User/UserPermissions.swift @@ -5,7 +5,6 @@ // Created by Matheus Cardoso on 5/16/18. // Copyright © 2018 Rocket.Chat. All rights reserved. // - import RealmSwift extension User { @@ -20,11 +19,9 @@ extension User { func hasPermission(_ permission: PermissionType, subscription: Subscription? = nil, realm: Realm? = Realm.current) -> Bool { guard let permissionRoles = PermissionManager.roles(for: permission, realm: realm) else { return false } - let roles: [String] + var roles: [String] = Array(self.roles) if let subscription = subscription { - roles = rolesInSubscription(subscription) - } else { - roles = Array(self.roles) + roles += rolesInSubscription(subscription) } for userRole in roles {