diff --git a/UpcomingMovies.xcodeproj/project.pbxproj b/UpcomingMovies.xcodeproj/project.pbxproj index 8dc4b9e6..aa528158 100644 --- a/UpcomingMovies.xcodeproj/project.pbxproj +++ b/UpcomingMovies.xcodeproj/project.pbxproj @@ -382,6 +382,7 @@ E2B6CFD82C1AAF3500E2C6FE /* MockListProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B6CFD72C1AAF3500E2C6FE /* MockListProtocol.swift */; }; E2B8C49B28B738E2006A8ECC /* FavoritesSavedMoviesInteractorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B8C49A28B738E2006A8ECC /* FavoritesSavedMoviesInteractorTests.swift */; }; E2BACB952BB6754800BA5417 /* MovieProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2BACB942BB6754800BA5417 /* MovieProtocol.swift */; }; + E2BB433C2CC60F5B006567E9 /* DeepLinkDestination.swift in Sources */ = {isa = PBXBuildFile; fileRef = E20EF3BC2CC3801300FA72C1 /* DeepLinkDestination.swift */; }; E2BB64D22C2923EA007D77C2 /* ReviewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2BB64D12C2923EA007D77C2 /* ReviewModelTests.swift */; }; E2BB6F682BB52D6B00332AAB /* MovieListCellViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2BB6F672BB52D6B00332AAB /* MovieListCellViewModelTests.swift */; }; E2BC7F812C44F098003BB16A /* MovieVisitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2BC7F802C44F098003BB16A /* MovieVisitProtocol.swift */; }; @@ -3498,6 +3499,7 @@ files = ( E2A02471256F635000D2018C /* UpcomingMoviesWidget.swift in Sources */, E2671D8925D8AD9E00E457FF /* AppGroup.swift in Sources */, + E2BB433C2CC60F5B006567E9 /* DeepLinkDestination.swift in Sources */, E2A02462256F634B00D2018C /* SearchMoviesWidget.swift in Sources */, E2A02489256F662400D2018C /* WidgetProvider.swift in Sources */, E2A024AA256F6B7600D2018C /* SmallWidgetView.swift in Sources */, diff --git a/UpcomingMovies/Helpers/Handlers/NavigationHandler/NavigationHandler.swift b/UpcomingMovies/Helpers/Handlers/NavigationHandler/NavigationHandler.swift index 7f644e05..3c906b85 100644 --- a/UpcomingMovies/Helpers/Handlers/NavigationHandler/NavigationHandler.swift +++ b/UpcomingMovies/Helpers/Handlers/NavigationHandler/NavigationHandler.swift @@ -39,13 +39,16 @@ final class NavigationHandler: NavigationHandlerProtocol { guard let url = url, let urlHost = url.host else { return } if url.scheme == AppExtension.scheme { - guard let host = AppExtension.Host(rawValue: urlHost) else { return } + guard let host = DeepLinkDestination(rawValue: urlHost) else { return } switch host { case .upcomingMovies: changeTabBarToSelectedIndex(RootCoordinatorIdentifier.upcomingMovies, from: window) case .searchMovies: changeTabBarToSelectedIndex(RootCoordinatorIdentifier.searchMovies, from: window) + case .detail: + // TODO: - Implement DeepLink Handler + break } } } diff --git a/UpcomingMovies/Helpers/Utils/AppExtension.swift b/UpcomingMovies/Helpers/Utils/AppExtension.swift index 61b968a1..5d3619cc 100644 --- a/UpcomingMovies/Helpers/Utils/AppExtension.swift +++ b/UpcomingMovies/Helpers/Utils/AppExtension.swift @@ -10,16 +10,9 @@ import Foundation struct AppExtension { - static let scheme = "extension" + static let scheme = "upcomingmovies" - enum Host: String { - - case upcomingMovies = "upcoming" - case searchMovies = "search" - - } - - static func url(for host: AppExtension.Host) -> URL? { + static func url(for host: DeepLinkDestination) -> URL? { let urlString = scheme + "://" + host.rawValue return URL(string: urlString) } diff --git a/UpcomingMovies/Helpers/Utils/DeepLinks/DeepLinkDestination.swift b/UpcomingMovies/Helpers/Utils/DeepLinks/DeepLinkDestination.swift index 62ac7b38..a1f87323 100644 --- a/UpcomingMovies/Helpers/Utils/DeepLinks/DeepLinkDestination.swift +++ b/UpcomingMovies/Helpers/Utils/DeepLinks/DeepLinkDestination.swift @@ -9,5 +9,7 @@ import Foundation enum DeepLinkDestination: String { + case upcomingMovies = "upcoming" + case searchMovies = "search" case detail } diff --git a/UpcomingMovies/Info.plist b/UpcomingMovies/Info.plist index 923c2a53..0d80bc5f 100755 --- a/UpcomingMovies/Info.plist +++ b/UpcomingMovies/Info.plist @@ -25,7 +25,7 @@ Editor CFBundleURLSchemes - extension + upcomingmovies