Class: MotionPrime::Screen

Inherits:
MPViewController show all
Extended by:
HasClassFactory
Includes:
HasAuthorization, HasSearchBar, Layout, ScreenBaseMixin, ScreenIndicatorsMixin, ScreenNavigationBarMixin
Defined in:
motion-prime/screens/screen.rb

Instance Attribute Summary

Attributes included from ScreenBaseMixin

#action, #modal, #options, #params, #parent_screen, #tab_bar

Attributes included from ScreenSectionsMixin

#_action_section_options

Instance Method Summary collapse

Methods included from HasClassFactory

camelize_factory, class_factory, low_camelize_factory, underscore_factory

Methods included from HasSearchBar

#add_search_bar, #create_search_bar, #searchBar, #searchBarSearchButtonClicked

Methods included from HasAuthorization

#api_client, #current_user, #reset_current_user, #user_signed_in?

Methods included from ScreenNavigationBarMixin

#create_navigation_button, #create_navigation_button_with_image, #create_navigation_button_with_title, #navigation_left_button, #navigation_right_button, #remove_navigation_right_button, #set_navigation_back_button, #set_navigation_back_or_menu, #set_navigation_left_button, #set_navigation_right_button, #set_navigation_right_image

Methods included from ScreenIndicatorsMixin

#hide_activity_indicator, #hide_progress_indicator, #hide_spinner, #show_activity_indicator, #show_notice, #show_progress_indicator, #show_spinner

Methods included from ScreenBaseMixin

#action?, #app_delegate, #content_controller, #main_controller, #modal?, #on_create, #title, #title=

Methods included from ScreenSectionsMixin

#all_sections, #all_sections_with_main, included, #main_section, #main_section=, #refresh, #set_section, #set_sections_wrapper

Methods included from HasNormalizer

#debug_info, #element?, #normalize_object, #normalize_options, #normalize_value

Methods included from ScreenNavigationMixin

#back, #close_screen, #has_navigation?, #navigation_controller, #navigation_controller=, #open_screen, #send_on_leave, #send_on_return, #wrap_in_navigation, #wrap_in_navigation?

Methods included from ScreenOrientationsMixin

#should_rotate, #supported_orientation?, #supported_orientations

Methods included from ScreenAliasesMixin

#on_appear, #on_disappear, #on_rotate, #should_autorotate, #view_did_appear, #view_did_disappear, #view_did_load, #view_will_appear, #view_will_disappear, #will_rotate

Methods included from Layout

#add_view, included, #set_options_for, #setup, #view_stack

Methods inherited from MPViewController

#didRotateFromInterfaceOrientation, new, #shouldAutorotate, #shouldAutorotateToInterfaceOrientation, #viewDidAppear, #viewDidDisappear, #viewDidLoad, #viewWillAppear, #viewWillDisappear, #willRotateToInterfaceOrientation

Instance Method Details

#deallocObject



51
52
53
54
55
56
# File 'motion-prime/screens/screen.rb', line 51

def dealloc
  Prime.logger.dealloc_message :screen, self
  # FIXME: calling instance_eval in title method (_base_screen_mixin) instance variables need to be cleared manually
  clear_instance_variables(except: [:_search_bar])
  super
end

#default_stylesObject



30
31
32
# File 'motion-prime/screens/screen.rb', line 30

def default_styles
  [:base_screen, self.class_name_without_kvo.underscore.to_sym]
end

#renderObject



27
28
# File 'motion-prime/screens/screen.rb', line 27

def render
end

#strong_referencesObject



58
59
60
# File 'motion-prime/screens/screen.rb', line 58

def strong_references
  self.main_controller
end

#visible?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'motion-prime/screens/screen.rb', line 62

def visible?
  !!@visible
end

#will_appearObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'motion-prime/screens/screen.rb', line 34

def will_appear
  @visible = true
  @on_appear_happened ||= {}
  unless @on_appear_happened[view.object_id]
    set_options_for view, styles: default_styles do
      run_callbacks :render do
        send((action).to_sym)
      end
    end
  end
  @on_appear_happened[view.object_id] = true
end

#will_disappearObject



47
48
49
# File 'motion-prime/screens/screen.rb', line 47

def will_disappear
  @visible = false
end