Skip to content

Commit

Permalink
Add deeplink show GDS map
Browse files Browse the repository at this point in the history
  • Loading branch information
mjdevs committed Apr 2, 2021
1 parent 6394473 commit b308c73
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
30 changes: 30 additions & 0 deletions Shared/Classes/Controller/OTMainGuideViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class OTMainGuideViewController: UIViewController {
var isShowMap = false
var isFirstLaunch = true

@objc var isFromDeeplink = false

//MARK: - LifeCycle -
override func viewDidLoad() {
super.viewDidLoad()
Expand Down Expand Up @@ -97,6 +99,34 @@ class OTMainGuideViewController: UIViewController {
isFirstLaunch = false
}

if isFromDeeplink {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) {
DispatchQueue.main.async {
self.showMap(animated: false)
}
}
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if isFromDeeplink {
let navigationBar = navigationController?.navigationBar

if #available(iOS 13.0, *) {
let navBarAppear = UINavigationBarAppearance()
navBarAppear.configureWithOpaqueBackground()
navBarAppear.backgroundColor = UIColor.appOrange()
navBarAppear.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.white as Any]

navigationBar?.standardAppearance = navBarAppear
navigationBar?.scrollEdgeAppearance = navBarAppear
} else {
navigationBar?.backgroundColor = UIColor.appOrange()
navigationBar?.tintColor = UIColor.white
navigationBar?.barTintColor = UIColor.appOrange()
navigationBar?.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white as Any]
}
}
}

func changeBackbutton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class OTDetailActionEventViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
OTAppConfiguration.configureNavigationControllerAppearance(self.navigationController)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewDidAppear(_ animated: Bool) {
Expand Down
14 changes: 13 additions & 1 deletion Shared/Classes/Utils/Services/OTDeepLinkService.m
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ - (void)handleDeepLinkWithKey:(NSString *)key
else if([key isEqualToString:@"profilePhoto"]) {
[self showProfilePhotoFromAnywhere];
}
else if([key isEqualToString:@"guidemap"]) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .500 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{

UIViewController *vc = [self instatiateControllerWithStoryboardIdentifier:@"Main" andControllerIdentifier:@"OTMainGuide"];
((OTMainGuideViewController* )vc).isFromDeeplink = YES;
[self showController:vc animated:YES];
});
}
}

- (void)openWithWebView: (NSURL *)url {
Expand All @@ -229,12 +237,16 @@ - (UIViewController *)instatiateControllerWithStoryboardIdentifier: (NSString *)
}

- (void)showController: (UIViewController *)controller {
[self showController:controller animated:NO];
}

- (void)showController: (UIViewController *)controller animated:(BOOL) animated {
UITabBarController *tabViewController = [OTAppConfiguration configureMainTabBarWithDefaultSelectedIndex:MAP_TAB_INDEX];
[self updateAppWindow:tabViewController];

UINavigationController *navigationController = (UINavigationController *)tabViewController.viewControllers[0];

[navigationController pushViewController:controller animated:NO];
[navigationController pushViewController:controller animated:animated];
}

- (void)showControllerFromAnywhere:(UIViewController *)controller {
Expand Down

0 comments on commit b308c73

Please sign in to comment.