From 4261089e5013a7c5bb1ceebaa8b7b8c29f4f8532 Mon Sep 17 00:00:00 2001 From: filipealva Date: Thu, 2 Aug 2018 17:38:42 -0300 Subject: [PATCH 1/4] Add deeplink auth handling to LoginTableViewController since AuthTableViewController is not showed when the server doesn't have any login service --- .../Controllers/Auth/ConnectServerViewController.swift | 6 ++++++ Rocket.Chat/Controllers/Auth/LoginTableViewController.swift | 6 ++++++ 2 files changed, 12 insertions(+) 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 From 83b0c36996881d9a36e4d8e40af9c8ac05d47355 Mon Sep 17 00:00:00 2001 From: Rafael Kellermann Streit Date: Thu, 2 Aug 2018 18:07:20 -0300 Subject: [PATCH 2/4] Increase app version to 3.0.4 --- Rocket.Chat.ShareExtension/Info.plist | 4 ++-- Rocket.Chat/Info.plist | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Rocket.Chat.ShareExtension/Info.plist b/Rocket.Chat.ShareExtension/Info.plist index e955833bac..506de93322 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 + 205 ITSEncryptionExportComplianceCode NSExtension diff --git a/Rocket.Chat/Info.plist b/Rocket.Chat/Info.plist index 08da950e0f..afb2e2cbbd 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 + 205 Fabric APIKey From 53bfc8bd39d5764ae0442a9fb6e4cc2fcd2db2fe Mon Sep 17 00:00:00 2001 From: Matheus Cardoso Date: Fri, 3 Aug 2018 10:58:49 -0300 Subject: [PATCH 3/4] Take server roles into account in room context --- Rocket.Chat/Models/User/UserPermissions.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 { From 496c343becb14699c93e26b11be43ca2d0aec00a Mon Sep 17 00:00:00 2001 From: Rafael Kellermann Streit Date: Fri, 3 Aug 2018 16:18:36 -0300 Subject: [PATCH 4/4] Increment build --- Rocket.Chat.ShareExtension/Info.plist | 2 +- Rocket.Chat/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Rocket.Chat.ShareExtension/Info.plist b/Rocket.Chat.ShareExtension/Info.plist index 506de93322..498a8c959b 100644 --- a/Rocket.Chat.ShareExtension/Info.plist +++ b/Rocket.Chat.ShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 3.0.4 CFBundleVersion - 205 + 206 ITSEncryptionExportComplianceCode NSExtension diff --git a/Rocket.Chat/Info.plist b/Rocket.Chat/Info.plist index afb2e2cbbd..5f5f9ec140 100644 --- a/Rocket.Chat/Info.plist +++ b/Rocket.Chat/Info.plist @@ -222,7 +222,7 @@ CFBundleVersion - 205 + 206 Fabric APIKey