From 3b93284d934c9074c4574e89a35636ee9865c345 Mon Sep 17 00:00:00 2001 From: Anton Yarmolenko Date: Fri, 9 Feb 2024 13:29:21 +0100 Subject: [PATCH] chore: address review feedback --- OpenEdX/AppDelegate.swift | 28 ++++++++++++------- .../DeepLinkManager/DeepLinkManager.swift | 4 +-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/OpenEdX/AppDelegate.swift b/OpenEdX/AppDelegate.swift index e2386a8e7..e10373d43 100644 --- a/OpenEdX/AppDelegate.swift +++ b/OpenEdX/AppDelegate.swift @@ -84,23 +84,29 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } if config.facebook.enabled { - ApplicationDelegate.shared.application( + if ApplicationDelegate.shared.application( app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation] - ) + ) { + return true + } } if config.google.enabled { - return GIDSignIn.sharedInstance.handle(url) + if GIDSignIn.sharedInstance.handle(url) { + return true + } } if config.microsoft.enabled { - return MSALPublicClientApplication.handleMSALResponse( + if MSALPublicClientApplication.handleMSALResponse( url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String - ) + ) { + return true + } } return false @@ -151,16 +157,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate { didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void ) { - if let pushManager = Container.shared.resolve(PushNotificationsManager.self) { - pushManager.didReceiveRemoteNotification(userInfo: userInfo) + guard let pushManager = Container.shared.resolve(PushNotificationsManager.self) + else { + completionHandler(.newData) + return } + pushManager.didReceiveRemoteNotification(userInfo: userInfo) completionHandler(.newData) } // Deep link func configureDeepLinkServices(launchOptions: [UIApplication.LaunchOptionsKey: Any]?) { - if let deepLinkManager = Container.shared.resolve(DeepLinkManager.self) { - deepLinkManager.configureDeepLinkService(launchOptions: launchOptions) - } + guard let deepLinkManager = Container.shared.resolve(DeepLinkManager.self) else { return } + deepLinkManager.configureDeepLinkService(launchOptions: launchOptions) } } diff --git a/OpenEdX/Managers/DeepLinkManager/DeepLinkManager.swift b/OpenEdX/Managers/DeepLinkManager/DeepLinkManager.swift index 28399e812..157bf2bb7 100644 --- a/OpenEdX/Managers/DeepLinkManager/DeepLinkManager.swift +++ b/OpenEdX/Managers/DeepLinkManager/DeepLinkManager.swift @@ -57,9 +57,7 @@ class DeepLinkManager { // This method do redirect with link from push notification func processLinkFromNotification(_ link: PushLink) { - if anyServiceEnabled { - // redirect if possible - } + // redirect if possible } // This method process the deep link with response parameters