Skip to content
Snippets Groups Projects
Commit 55a3ed09 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

Added deeplink using router

parent 2fcaf4fa
No related branches found
No related tags found
3 merge requests!71Releasing v1.1.5 (214),!67v1.1.5 b(203),!59Invite friends
...@@ -143,8 +143,12 @@ public class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -143,8 +143,12 @@ public class AppDelegate: UIResponder, UIApplicationDelegate {
open url: URL, open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:] options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool { ) -> Bool {
if let invitationUsername = getUsernameFromInvitationDeepLink(url) { if let username = getUsernameFromInvitationDeepLink(url),
self.invitation = invitationUsername let _ = try? DependencyInjection.Container.shared.resolve() as SessionType,
let router = try? DependencyInjection.Container.shared.resolve() as PushRouter {
invitation = username
router.navigateTo(.search, {})
return true return true
} else { } else {
return dropboxService.handleOpenUrl(url) return dropboxService.handleOpenUrl(url)
......
...@@ -259,6 +259,11 @@ extension PushRouter { ...@@ -259,6 +259,11 @@ extension PushRouter {
launchController.pendingPushRoute = route launchController.pendingPushRoute = route
} else { } else {
switch route { switch route {
case .search:
if (navigationController.viewControllers.last as? SearchContainerController) == nil {
navigationController.setViewControllers([SearchContainerController()], animated: true)
}
case .requests: case .requests:
if (navigationController.viewControllers.last as? RequestsContainerController) == nil { if (navigationController.viewControllers.last as? RequestsContainerController) == nil {
navigationController.setViewControllers([RequestsContainerController()], animated: true) navigationController.setViewControllers([RequestsContainerController()], animated: true)
......
...@@ -54,6 +54,9 @@ public final class LaunchController: UIViewController { ...@@ -54,6 +54,9 @@ public final class LaunchController: UIViewController {
case .chats: case .chats:
if let pushRoute = pendingPushRoute { if let pushRoute = pendingPushRoute {
switch pushRoute { switch pushRoute {
case .search:
coordinator.toSearch(from: self)
case .requests: case .requests:
coordinator.toRequests(from: self) coordinator.toRequests(from: self)
......
...@@ -4,6 +4,7 @@ public struct PushRouter { ...@@ -4,6 +4,7 @@ public struct PushRouter {
public typealias NavigateTo = (Route, @escaping () -> Void) -> Void public typealias NavigateTo = (Route, @escaping () -> Void) -> Void
public enum Route { public enum Route {
case search
case requests case requests
case groupChat(id: Data) case groupChat(id: Data)
case contactChat(id: Data) case contactChat(id: Data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment