Class: MotionPrime::BaseAppDelegate

Inherits:
Object
  • Object
show all
Includes:
HasAuthorization
Defined in:
motion-prime/app_delegate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasAuthorization

#api_client, #user_signed_in?

Instance Attribute Details

#windowObject

Returns the value of attribute window.



7
8
9
# File 'motion-prime/app_delegate.rb', line 7

def window
  @window
end

Instance Method Details

#app_windowObject



38
39
40
# File 'motion-prime/app_delegate.rb', line 38

def app_window
  self.app_delegate.window
end

#application(application, didFailToRegisterForRemoteNotificationsWithError: error) ⇒ Object



9
10
11
12
13
14
15
# File 'motion-prime/app_delegate.rb', line 9

def application(application, willFinishLaunchingWithOptions:opts)
  MotionPrime::Config.configure!
  MotionPrime::Styles.define!
  Prime.logger.info "Loading Prime application with env: #{Prime.env}"
  application.setStatusBarStyle UIStatusBarStyleLightContent
  application.setStatusBarHidden false
end

#current_userObject



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

def current_user
  @current_user ||= if defined?(User) && User.respond_to?(:current)
    User.current
  end
end

#on_apn_register_fail(application, error) ⇒ Object



35
36
# File 'motion-prime/app_delegate.rb', line 35

def on_apn_register_fail(application, error)
end

#on_apn_register_success(application, token) ⇒ Object



32
33
# File 'motion-prime/app_delegate.rb', line 32

def on_apn_register_success(application, token)
end

#on_load(application, launch_options) ⇒ Object



29
30
# File 'motion-prime/app_delegate.rb', line 29

def on_load(application, launch_options)
end

#open_screen(screen, options = {}) ⇒ Object



42
43
44
45
46
47
48
49
# File 'motion-prime/app_delegate.rb', line 42

def open_screen(screen, options = {})
  screen = prepare_screen_for_open(screen, options)
  if options[:root] || !self.window
    open_root_screen(screen, options)
  else
    open_content_screen(screen, options)
  end
end

#reset_current_userObject



57
58
59
60
61
# File 'motion-prime/app_delegate.rb', line 57

def reset_current_user
  user_was = @current_user
  @current_user = nil
  NSNotificationCenter.defaultCenter.postNotificationName(:on_current_user_reset, object: user_was)
end