lib/ProMotion/map/map_screen_module.rb in ProMotion-map-0.4.1 vs lib/ProMotion/map/map_screen_module.rb in ProMotion-map-0.4.2
- old
+ new
@@ -45,10 +45,14 @@
animated:params[:animated]
)
end
def show_user_location
+ if location_manager.respondsToSelector('requestWhenInUseAuthorization')
+ location_manager.requestWhenInUseAuthorization
+ end
+
set_show_user_location true
end
def hide_user_location
set_show_user_location false
@@ -276,8 +280,17 @@
end
end
def self.included(base)
base.extend(MapClassMethods)
end
+
+ private
+
+ def location_manager
+ @location_manager ||= CLLocationManager.alloc.init
+ @location_manager.delegate ||= self
+ @location_manager
+ end
+
end
end