Sha256: 631f9377aa66ac3d60bfca0e4d2748d346105304dce9e7e97c9e1eb448f09478

Contents?: true

Size: 1.48 KB

Versions: 11

Compression:

Stored size: 1.48 KB

Contents

motion_require '../support/mp_view_controller.rb'
motion_require '../views/layout.rb'
motion_require '../screens/_base_mixin.rb'
motion_require './extensions/_indicators_mixin'
motion_require './extensions/_navigation_bar_mixin'
motion_require '../helpers/has_authorization'
motion_require '../helpers/has_search_bar'
module MotionPrime
  class Screen < MPViewController
    include Layout
    include ScreenBaseMixin

    # extensions
    include ScreenIndicatorsMixin
    include ScreenNavigationBarMixin

    # helpers
    include HasAuthorization
    include HasSearchBar

    extend HasClassFactory

    define_callbacks :render

    before_render :add_sections

    def render
    end

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

    def will_appear
      @visible = true
      @on_appear_happened ||= {}
      unless @on_appear_happened[view.object_id]
        setup view, styles: default_styles do
          run_callbacks :render { render }
        end
      end
      @on_appear_happened[view.object_id] = true
    end

    def will_disappear
      @visible = false
    end

    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

    def strong_references
      self.main_controller
    end

    def visible?
      @visible
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
motion-prime-0.8.12 motion-prime/screens/screen.rb
motion-prime-0.8.11 motion-prime/screens/screen.rb
motion-prime-0.8.10 motion-prime/screens/screen.rb
motion-prime-0.8.9 motion-prime/screens/screen.rb
motion-prime-0.8.8 motion-prime/screens/screen.rb
motion-prime-0.8.7 motion-prime/screens/screen.rb
motion-prime-0.8.6 motion-prime/screens/screen.rb
motion-prime-0.8.5 motion-prime/screens/screen.rb
motion-prime-0.8.4 motion-prime/screens/screen.rb
motion-prime-0.8.3 motion-prime/screens/screen.rb
motion-prime-0.8.2 motion-prime/screens/screen.rb