From c283316cff1953cc66ab7ecec8334c973bc21d67 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Thu, 23 May 2013 22:20:47 -0700 Subject: [PATCH 1/9] Push notifications, delegate methods, cleaning up delegate. --- app/app_delegate.rb | 2 + lib/ProMotion.rb | 2 +- lib/ProMotion/delegate.rb | 63 ------------------- lib/ProMotion/delegate/delegate.rb | 30 +++++++++ lib/ProMotion/delegate/delegate_helper.rb | 51 +++++++++++++++ .../delegate/delegate_notifications.rb | 61 ++++++++++++++++++ .../push_notifications/push_notification.rb | 35 +++++++++++ 7 files changed, 180 insertions(+), 64 deletions(-) delete mode 100644 lib/ProMotion/delegate.rb create mode 100644 lib/ProMotion/delegate/delegate.rb create mode 100644 lib/ProMotion/delegate/delegate_helper.rb create mode 100644 lib/ProMotion/delegate/delegate_notifications.rb create mode 100644 lib/ProMotion/push_notifications/push_notification.rb diff --git a/app/app_delegate.rb b/app/app_delegate.rb index 7cc9afe..11dbe72 100644 --- a/app/app_delegate.rb +++ b/app/app_delegate.rb @@ -1,5 +1,7 @@ class AppDelegate + def on_load(app, options) open BasicScreen.new(nav_bar: true) end + end diff --git a/lib/ProMotion.rb b/lib/ProMotion.rb index 6585978..a1346ec 100644 --- a/lib/ProMotion.rb +++ b/lib/ProMotion.rb @@ -6,7 +6,7 @@ require "ProMotion/version" Motion::Project::App.setup do |app| original_files = app.files - delegate = File.join(File.dirname(__FILE__), 'ProMotion/delegate.rb') + delegate = File.join(File.dirname(__FILE__), 'ProMotion/delegate/delegate.rb') promotion_files = FileList[File.join(File.dirname(__FILE__), 'ProMotion/**/*.rb')].exclude(delegate).to_a app.files = (promotion_files << delegate) + original_files end \ No newline at end of file diff --git a/lib/ProMotion/delegate.rb b/lib/ProMotion/delegate.rb deleted file mode 100644 index 172f338..0000000 --- a/lib/ProMotion/delegate.rb +++ /dev/null @@ -1,63 +0,0 @@ -module ProMotion - class Delegate - include ProMotion::ScreenTabs - include ProMotion::SplitScreen if NSBundle.mainBundle.infoDictionary["UIDeviceFamily"].include?("2") # Only with iPad - attr_accessor :window - - def application(application, didFinishLaunchingWithOptions:launch_options) - unless self.respond_to?(:on_load) - PM.logger.error "Your AppDelegate (usually in app_delegate.rb) needs an on_load(application, options) method." - end - - on_load(application, launch_options) - - true - end - - def app_delegate - UIApplication.sharedApplication.delegate - end - - def app_window - self.app_delegate.window - end - - def home(screen) - screen = screen.new if screen.respond_to?(:new) - @home_screen = screen - end - - def load_root_screen(new_screen) - new_screen = new_screen.pm_main_controller - - self.window ||= self.ui_window.alloc.initWithFrame(UIScreen.mainScreen.bounds) - self.window.rootViewController = new_screen - self.window.makeKeyAndVisible - end - - def ui_window - (defined?(Motion) && defined?(Motion::Xray) && defined?(Motion::Xray::XrayWindow)) ? Motion::Xray::XrayWindow : UIWindow - end - - def open_screen(screen, args={}) - home(screen) - open_home_screen - end - alias :open :open_screen - alias :open_root_screen :open_screen - - def open_home_screen - get_home_screen.send(:on_load) if get_home_screen.respond_to?(:on_load) - load_root_screen get_home_screen - end - - def get_home_screen - @home_screen - end - - def has_home_screen - @home_screen.nil? == false - end - end - class AppDelegateParent < Delegate; end # For backwards compatibility -end diff --git a/lib/ProMotion/delegate/delegate.rb b/lib/ProMotion/delegate/delegate.rb new file mode 100644 index 0000000..a302dfe --- /dev/null +++ b/lib/ProMotion/delegate/delegate.rb @@ -0,0 +1,30 @@ +module ProMotion + class Delegate + + include ProMotion::ScreenTabs + include ProMotion::SplitScreen if NSBundle.mainBundle.infoDictionary["UIDeviceFamily"].include?("2") # Only with iPad + include DelegateHelper + include DelegateNotifications + + attr_accessor :window, :aps_notification + + def application(application, didFinishLaunchingWithOptions:launch_options) + + check_on_load + + on_load application, launch_options + + check_for_notification launch_options + + true + + end + + end + + class AppDelegateParent < Delegate + def self.inherited(klass) + PM.logger.deprecated "PM::AppDelegateParent is deprecated. Use PM::Delegate." + end + end +end diff --git a/lib/ProMotion/delegate/delegate_helper.rb b/lib/ProMotion/delegate/delegate_helper.rb new file mode 100644 index 0000000..db18cc3 --- /dev/null +++ b/lib/ProMotion/delegate/delegate_helper.rb @@ -0,0 +1,51 @@ +module ProMotion + module DelegateHelper + + def app_delegate + self + end + + def app_window + self.window + end + + def ui_window + (defined?(Motion) && defined?(Motion::Xray) && defined?(Motion::Xray::XrayWindow)) ? Motion::Xray::XrayWindow : UIWindow + end + + def open_screen(screen, args={}) + + screen = screen.new if screen.respond_to?(:new) + screen.send(:on_load) if screen.respond_to?(:on_load) + + self.window ||= self.ui_window.alloc.initWithFrame(UIScreen.mainScreen.bounds) + self.window.rootViewController = screen.pm_main_controller + self.window.makeKeyAndVisible + + end + alias :open :open_screen + alias :open_root_screen :open_screen + alias :home :open_screen + + module ClassMethods + + def status_bar(visible = true, opts={}) + UIApplication.sharedApplication.setStatusBarHidden(!visible, withAnimation:status_bar_animation(opts[:animation])) + end + + def status_bar_animation(opt) + { + fade: UIStatusBarAnimationFade, + slide: UIStatusBarAnimationSlide, + none: UIStatusBarAnimationNone + }[opt] || UIStatusBarAnimationNone + end + + end + + def self.included(base) + base.extend(ClassMethods) + end + + end +end \ No newline at end of file diff --git a/lib/ProMotion/delegate/delegate_notifications.rb b/lib/ProMotion/delegate/delegate_notifications.rb new file mode 100644 index 0000000..8503cd6 --- /dev/null +++ b/lib/ProMotion/delegate/delegate_notifications.rb @@ -0,0 +1,61 @@ +module ProMotion + module DelegateNotifications + + attr_accessor :aps_notification + + def check_for_notification(options) + if options && options[UIApplicationLaunchOptionsRemoteNotificationKey] + received_notification options[UIApplicationLaunchOptionsRemoteNotificationKey] + end + end + + def register_for_notifications(*notification_types) + notification_types = Array.new(notification_types) + notification_types = [ :badge, :sound, :alert, :newsstand ] if notification_types.include?(:all) + + types = UIRemoteNotificationTypeNone + types = types | UIRemoteNotificationTypeBadge if notification_types.include?(:badge) + types = types | UIRemoteNotificationTypeSound if notification_types.include?(:sound) + types = types | UIRemoteNotificationTypeAlert if notification_types.include?(:alert) + types = types | UIRemoteNotificationTypeNewsstandContentAvailability if notification_types.include?(:newsstand) + + UIApplication.sharedApplication.registerForRemoteNotificationTypes types + end + + def unregister_for_notifications + UIApplication.sharedApplication.unregisterForRemoteNotifications + end + + def registered_notifications + mask = UIApplication.sharedApplication.enabledRemoteNotificationTypes + types = [] + + types << :badge if mask & UIRemoteNotificationTypeBadge + types << :sound if mask & UIRemoteNotificationTypeSound + types << :alert if mask & UIRemoteNotificationTypeAlert + types << :newsstand if mask & UIRemoteNotificationTypeNewsstandContentAvailability + + types + end + + def received_notification(notification) + @aps_notification = PM::Notification.new(notification) + on_notification(@aps_notification) if respond_to?(:on_notification) + end + + # CocoaTouch + + def application(application, didRegisterForRemoteNotificationsWithDeviceToken:device_token) + on_register(device_token, nil) if respond_to?(:on_register) + end + + def application(application, didFailToRegisterForRemoteNotificationsWithError:error) + on_register(nil, error) if respond_to?(:on_register) + end + + def application(application, didReceiveRemoteNotification:notification) + received_notification(notification) + end + + end +end \ No newline at end of file diff --git a/lib/ProMotion/push_notifications/push_notification.rb b/lib/ProMotion/push_notifications/push_notification.rb new file mode 100644 index 0000000..acb5f1b --- /dev/null +++ b/lib/ProMotion/push_notifications/push_notification.rb @@ -0,0 +1,35 @@ +module ProMotion + class PushNotification + + attr_accessor :notification + + def initialize(n) + self.notification = n + end + + def to_s + self.notification.inspect + end + + def to_json + PM.logger.warn "PM::PushNotification.to_json not implemented yet." + end + + # For testing from the REPL + # > PM::PushNotification.simulate alert: "My test message", badge: 4 + def self.simulate(args = {}) + UIApplication.sharedApplication.delegate.on_notification self.fake_notification(args) + end + + def self.fake_notification(args = {}) + self.new({ + "aps" => { + "alert" => args[:alert] || "Test Push Notification", + "badge" => args[:badge] || 2, + "sound" => args[:sound] || "default" + } + }) + end + + end +end \ No newline at end of file From 42b9944c4219e56f0179c804dbfb2768262141ee Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Thu, 23 May 2013 22:27:07 -0700 Subject: [PATCH 2/9] Deprecated is_modal? --- lib/ProMotion/screen_helpers/screen_navigation.rb | 2 +- lib/ProMotion/screens/_screen_module.rb | 5 +++++ spec/unit/screen_helpers_spec.rb | 2 +- spec/unit/screen_spec.rb | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ProMotion/screen_helpers/screen_navigation.rb b/lib/ProMotion/screen_helpers/screen_navigation.rb index a78c3b0..65fe30c 100644 --- a/lib/ProMotion/screen_helpers/screen_navigation.rb +++ b/lib/ProMotion/screen_helpers/screen_navigation.rb @@ -52,7 +52,7 @@ module ProMotion args ||= {} args[:animated] ||= true - if self.is_modal? + if self.modal? close_modal_screen args elsif self.navigation_controller diff --git a/lib/ProMotion/screens/_screen_module.rb b/lib/ProMotion/screens/_screen_module.rb index 5139d3d..c6ab874 100644 --- a/lib/ProMotion/screens/_screen_module.rb +++ b/lib/ProMotion/screens/_screen_module.rb @@ -28,6 +28,11 @@ module ProMotion end def is_modal? + PM.logger.deprecated "`is_modal?` is deprecated. Use `modal?`." + modal? + end + + def modal? self.modal == true end diff --git a/spec/unit/screen_helpers_spec.rb b/spec/unit/screen_helpers_spec.rb index 54bfa0d..7c2b1ca 100644 --- a/spec/unit/screen_helpers_spec.rb +++ b/spec/unit/screen_helpers_spec.rb @@ -116,7 +116,7 @@ describe "screen helpers" do new_screen.parent_screen.should == @screen new_screen.title.should == 'Some Title' - new_screen.is_modal?.should == true + new_screen.modal?.should == true new_screen.hidesBottomBarWhenPushed.should == true new_screen.has_nav_bar?.should == true end diff --git a/spec/unit/screen_spec.rb b/spec/unit/screen_spec.rb index fdedcdc..88f60ad 100644 --- a/spec/unit/screen_spec.rb +++ b/spec/unit/screen_spec.rb @@ -31,8 +31,8 @@ describe "screen properties" do HomeScreen.debug_mode.should == true end - it "#is_modal? should be true" do - @screen.is_modal?.should == true + it "#modal? should be true" do + @screen.modal?.should == true end it "should know it is the first screen" do From 6e756e65015c506ad1701747ec8001e821ae0c71 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Thu, 23 May 2013 22:50:43 -0700 Subject: [PATCH 3/9] Adding the ability to remove status bar Also changed has_nav_bar? to nav_bar? --- lib/ProMotion/delegate/delegate.rb | 2 +- lib/ProMotion/delegate/delegate_helper.rb | 19 ++++++++++++++++++- lib/ProMotion/screen_helpers/screen_tabs.rb | 4 ++-- lib/ProMotion/screens/_screen_module.rb | 11 ++++++++--- spec/unit/screen_helpers_spec.rb | 2 +- spec/unit/screen_spec.rb | 2 +- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/lib/ProMotion/delegate/delegate.rb b/lib/ProMotion/delegate/delegate.rb index a302dfe..a13655f 100644 --- a/lib/ProMotion/delegate/delegate.rb +++ b/lib/ProMotion/delegate/delegate.rb @@ -10,7 +10,7 @@ module ProMotion def application(application, didFinishLaunchingWithOptions:launch_options) - check_on_load + apply_status_bar on_load application, launch_options diff --git a/lib/ProMotion/delegate/delegate_helper.rb b/lib/ProMotion/delegate/delegate_helper.rb index db18cc3..503d6df 100644 --- a/lib/ProMotion/delegate/delegate_helper.rb +++ b/lib/ProMotion/delegate/delegate_helper.rb @@ -18,6 +18,8 @@ module ProMotion screen = screen.new if screen.respond_to?(:new) screen.send(:on_load) if screen.respond_to?(:on_load) + @home_screen = screen + self.window ||= self.ui_window.alloc.initWithFrame(UIScreen.mainScreen.bounds) self.window.rootViewController = screen.pm_main_controller self.window.makeKeyAndVisible @@ -27,10 +29,25 @@ module ProMotion alias :open_root_screen :open_screen alias :home :open_screen + def apply_status_bar + self.class.send(:apply_status_bar) + end + + def status_bar? + UIApplication.sharedApplication.statusBarHidden + end + module ClassMethods def status_bar(visible = true, opts={}) - UIApplication.sharedApplication.setStatusBarHidden(!visible, withAnimation:status_bar_animation(opts[:animation])) + @status_bar_visible = visible + @status_bar_opts = opts + end + + def apply_status_bar + @status_bar_visible ||= true + @status_bar_opts ||= :none + UIApplication.sharedApplication.setStatusBarHidden(!@apply_status_bar, withAnimation:status_bar_animation(@status_bar_opts[:animation])) end def status_bar_animation(opt) diff --git a/lib/ProMotion/screen_helpers/screen_tabs.rb b/lib/ProMotion/screen_helpers/screen_tabs.rb index f95ccee..2ebad92 100644 --- a/lib/ProMotion/screen_helpers/screen_tabs.rb +++ b/lib/ProMotion/screen_helpers/screen_tabs.rb @@ -34,9 +34,9 @@ module ProMotion def open_tab_bar(*screens) tab_bar = tab_bar_controller(*screens) - a = self.respond_to?(:load_root_screen) ? self : UIApplication.sharedApplication.delegate + a = self.respond_to?(:open_root_screen) ? self : UIApplication.sharedApplication.delegate - a.load_root_screen(tab_bar) + a.open_root_screen(tab_bar) tab_bar end diff --git a/lib/ProMotion/screens/_screen_module.rb b/lib/ProMotion/screens/_screen_module.rb index c6ab874..1874aad 100644 --- a/lib/ProMotion/screens/_screen_module.rb +++ b/lib/ProMotion/screens/_screen_module.rb @@ -37,9 +37,14 @@ module ProMotion end def has_nav_bar? - self.navigation_controller.nil? != true + PM.logger.deprecated "`has_nav_bar? is deprecated. Use `nav_bar?`." + nav_bar? end - + + def nav_bar? + !!self.navigation_controller + end + def navigation_controller @navigation_controller ||= self.navigationController end @@ -51,7 +56,7 @@ module ProMotion # [DEPRECATED] def load_view_controller - warn "[DEPRECATION] `load_view_controller` is deprecated and doesn't actually do anything anymore. You can safely remove it from your code." + PM.logger.deprecated "`load_view_controller` is deprecated and doesn't actually do anything anymore. You can safely remove it from your code." end def set_tab_bar_item(args = {}) diff --git a/spec/unit/screen_helpers_spec.rb b/spec/unit/screen_helpers_spec.rb index 7c2b1ca..ff5be75 100644 --- a/spec/unit/screen_helpers_spec.rb +++ b/spec/unit/screen_helpers_spec.rb @@ -118,7 +118,7 @@ describe "screen helpers" do new_screen.title.should == 'Some Title' new_screen.modal?.should == true new_screen.hidesBottomBarWhenPushed.should == true - new_screen.has_nav_bar?.should == true + new_screen.nav_bar?.should == true end it "should present the #main_controller when showing a modal screen" do diff --git a/spec/unit/screen_spec.rb b/spec/unit/screen_spec.rb index 88f60ad..ca5509b 100644 --- a/spec/unit/screen_spec.rb +++ b/spec/unit/screen_spec.rb @@ -115,7 +115,7 @@ describe "screen properties" do describe "navigation controller behavior" do it "should have a nav bar" do - @screen.has_nav_bar?.should == true + @screen.nav_bar?.should == true end it "#main_controller should return a navigation controller" do From aefd01449554e04d5d7b385b26cbcc4a196a0725 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Thu, 23 May 2013 23:44:54 -0700 Subject: [PATCH 4/9] Added on_unload, PushNotification methods, tests --- lib/ProMotion/delegate/delegate.rb | 6 ++++ .../delegate/delegate_notifications.rb | 2 +- .../push_notifications/push_notification.rb | 16 ++++++++++ spec/helpers/test_delegate.rb | 2 ++ spec/unit/delegate_spec.rb | 29 +++++++++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 spec/unit/delegate_spec.rb diff --git a/lib/ProMotion/delegate/delegate.rb b/lib/ProMotion/delegate/delegate.rb index a13655f..c76e012 100644 --- a/lib/ProMotion/delegate/delegate.rb +++ b/lib/ProMotion/delegate/delegate.rb @@ -19,6 +19,12 @@ module ProMotion true end + + def applicationWillTerminate(application) + + on_unload if respond_to?(:on_unload) + + end end diff --git a/lib/ProMotion/delegate/delegate_notifications.rb b/lib/ProMotion/delegate/delegate_notifications.rb index 8503cd6..67628fc 100644 --- a/lib/ProMotion/delegate/delegate_notifications.rb +++ b/lib/ProMotion/delegate/delegate_notifications.rb @@ -39,7 +39,7 @@ module ProMotion end def received_notification(notification) - @aps_notification = PM::Notification.new(notification) + @aps_notification = PM::PushNotification.new(notification) on_notification(@aps_notification) if respond_to?(:on_notification) end diff --git a/lib/ProMotion/push_notifications/push_notification.rb b/lib/ProMotion/push_notifications/push_notification.rb index acb5f1b..f7d57e8 100644 --- a/lib/ProMotion/push_notifications/push_notification.rb +++ b/lib/ProMotion/push_notifications/push_notification.rb @@ -15,6 +15,22 @@ module ProMotion PM.logger.warn "PM::PushNotification.to_json not implemented yet." end + def aps + self.notification["aps"] + end + + def alert + aps["alert"] if aps + end + + def badge + aps["badge"] if aps + end + + def sound + aps["sound"] if aps + end + # For testing from the REPL # > PM::PushNotification.simulate alert: "My test message", badge: 4 def self.simulate(args = {}) diff --git a/spec/helpers/test_delegate.rb b/spec/helpers/test_delegate.rb index becdf95..bd45aa3 100644 --- a/spec/helpers/test_delegate.rb +++ b/spec/helpers/test_delegate.rb @@ -1,4 +1,6 @@ class TestDelegate < ProMotion::Delegate + status_bar false + def on_load(app, options) end end diff --git a/spec/unit/delegate_spec.rb b/spec/unit/delegate_spec.rb new file mode 100644 index 0000000..4b7e61b --- /dev/null +++ b/spec/unit/delegate_spec.rb @@ -0,0 +1,29 @@ +describe "PM::Delegate" do + + before { @subject = TestDelegate.new } + + it 'should call on_load on launch' do + @subject.mock!(:on_load) do |app, options| + options[:jamon].should.be.true + app.should.be.kind_of(UIApplication) + end + + @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions:{jamon: true}) + end + + it "should handle push notifications" do + + @subject.mock!(:on_notification) do |notification| + notification.should.be.kind_of(PM::PushNotification) + notification.alert.should == "Eating Bacon" + notification.badge.should == 42 + notification.sound.should == "jamon" + @subject.aps_notification.should == notification + end + + launch_options = { UIApplicationLaunchOptionsRemoteNotificationKey => PM::PushNotification.fake_notification(alert: "Eating Bacon", badge: 42, sound: "jamon").notification } + @subject.application(nil, didFinishLaunchingWithOptions:launch_options ) + + end + +end From ab7d0947129e148ee0df5069f336c7d35cd78ae7 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Fri, 24 May 2013 00:06:54 -0700 Subject: [PATCH 5/9] on_registration, not on_register --- lib/ProMotion/delegate/delegate_notifications.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ProMotion/delegate/delegate_notifications.rb b/lib/ProMotion/delegate/delegate_notifications.rb index 67628fc..efe0288 100644 --- a/lib/ProMotion/delegate/delegate_notifications.rb +++ b/lib/ProMotion/delegate/delegate_notifications.rb @@ -46,11 +46,11 @@ module ProMotion # CocoaTouch def application(application, didRegisterForRemoteNotificationsWithDeviceToken:device_token) - on_register(device_token, nil) if respond_to?(:on_register) + on_registration(device_token, nil) if respond_to?(:on_registration) end def application(application, didFailToRegisterForRemoteNotificationsWithError:error) - on_register(nil, error) if respond_to?(:on_register) + on_registration(nil, error) if respond_to?(:on_registration) end def application(application, didReceiveRemoteNotification:notification) From 4b6d80be1efeeb6335229ed80df6f202d6c61f03 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Fri, 24 May 2013 00:10:11 -0700 Subject: [PATCH 6/9] A commit just for @macfanatic . --- lib/ProMotion/push_notifications/push_notification.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProMotion/push_notifications/push_notification.rb b/lib/ProMotion/push_notifications/push_notification.rb index f7d57e8..db2cfea 100644 --- a/lib/ProMotion/push_notifications/push_notification.rb +++ b/lib/ProMotion/push_notifications/push_notification.rb @@ -48,4 +48,4 @@ module ProMotion end end -end \ No newline at end of file +end From 513482bdf15bf0f6a6643e16e7effc95672bf169 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Mon, 27 May 2013 10:43:20 -0700 Subject: [PATCH 7/9] Fix per @rheoli suggestion --- lib/ProMotion/delegate/delegate_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProMotion/delegate/delegate_helper.rb b/lib/ProMotion/delegate/delegate_helper.rb index 503d6df..275e94f 100644 --- a/lib/ProMotion/delegate/delegate_helper.rb +++ b/lib/ProMotion/delegate/delegate_helper.rb @@ -46,7 +46,7 @@ module ProMotion def apply_status_bar @status_bar_visible ||= true - @status_bar_opts ||= :none + @status_bar_opts ||= { animation: :none } UIApplication.sharedApplication.setStatusBarHidden(!@apply_status_bar, withAnimation:status_bar_animation(@status_bar_opts[:animation])) end From cadfb2ad1247f68eae865d8f6cfd7c973bacf4c7 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Mon, 27 May 2013 13:24:34 -0700 Subject: [PATCH 8/9] Fix per @rheoli --- lib/ProMotion/delegate/delegate_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProMotion/delegate/delegate_helper.rb b/lib/ProMotion/delegate/delegate_helper.rb index 275e94f..68ed44b 100644 --- a/lib/ProMotion/delegate/delegate_helper.rb +++ b/lib/ProMotion/delegate/delegate_helper.rb @@ -47,7 +47,7 @@ module ProMotion def apply_status_bar @status_bar_visible ||= true @status_bar_opts ||= { animation: :none } - UIApplication.sharedApplication.setStatusBarHidden(!@apply_status_bar, withAnimation:status_bar_animation(@status_bar_opts[:animation])) + UIApplication.sharedApplication.setStatusBarHidden(!@status_bar_visible, withAnimation:status_bar_animation(@status_bar_opts[:animation])) end def status_bar_animation(opt) From 250222f96077d5434686c2d9cf50864fa4b01389 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Mon, 27 May 2013 21:05:32 -0700 Subject: [PATCH 9/9] Comment --- lib/ProMotion/helpers/view_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProMotion/helpers/view_helper.rb b/lib/ProMotion/helpers/view_helper.rb index 2831cf4..7c2acf3 100644 --- a/lib/ProMotion/helpers/view_helper.rb +++ b/lib/ProMotion/helpers/view_helper.rb @@ -50,7 +50,7 @@ module ProMotion end def frame_from_array(array) - PM.logger.deprecated "`frame_from_array` is deprecated and will be removed. Use RubyMotion's built-in [[x, y], [width, height]]." + PM.logger.deprecated "`frame_from_array` is deprecated and will be removed. Use RubyMotion's built-in [[x, y], [width, height]] or CGRectMake(x, y, w, h)." return CGRectMake(array[0], array[1], array[2], array[3]) if array.length == 4 PM.logger.error "frame_from_array expects an array with four elements: [x, y, width, height]" CGRectZero.dup