lib/ProMotion/screen_helpers/screen_navigation.rb in ProMotion-0.6.0 vs lib/ProMotion/screen_helpers/screen_navigation.rb in ProMotion-0.6.1

- old
+ new

@@ -8,14 +8,17 @@ ensure_wrapper_controller_in_place(screen, args) screen.send(:on_load) if screen.respond_to?(:on_load) animated = args[:animated] || true - return self.split_screen.detail_screen = screen if args[:in_detail] && self.split_screen - return self.split_screen.master_screen = screen if args[:in_master] && self.split_screen + if args[:in_detail] && self.split_screen + self.split_screen.detail_screen = screen - if args[:close_all] + elsif args[:in_master] && self.split_screen + self.split_screen.master_screen = screen + + elsif args[:close_all] open_root_screen screen elsif args[:modal] present_modal_view_controller screen, animated @@ -23,15 +26,12 @@ present_view_controller_in_tab_bar_controller screen, args[:in_tab] elsif self.navigation_controller push_view_controller screen - elsif screen.respond_to?(:main_controller) - open_view_controller screen.main_controller - else - open_view_controller screen + open_root_screen screen end end alias :open :open_screen @@ -70,12 +70,13 @@ self.parent_screen.send(:on_return) end end end - def open_view_controller(vc) - app_delegate.load_root_view vc + def open_view_controller(screen) + PM.logger.deprecated "Use `open_root_screen` instead of the more ambiguous `open_view_controller`." + open_root_screen screen end def push_view_controller(vc, nav_controller=nil) unless self.navigation_controller PM.logger.error "You need a nav_bar if you are going to push #{vc.to_s} onto it." @@ -127,9 +128,11 @@ if vc.is_a?(UINavigationController) screen.navigation_controller = vc if screen.respond_to?("navigation_controller=") push_view_controller(screen, vc) else + # TODO: This should probably open the vc, shouldn't it? + # This isn't well tested and needs to work better. self.tab_bar.selectedIndex = vc.tabBarItem.tag end else PM.logger.error "No tab bar item '#{tab_name}'"