lib/ProMotion/web/web_screen_module.rb in ProMotion-1.2.1 vs lib/ProMotion/web/web_screen_module.rb in ProMotion-2.0.0.rc1

- old
+ new

@@ -1,30 +1,33 @@ module ProMotion module WebScreenModule - attr_accessor :webview, :external_links, :detector_types + attr_accessor :webview, :external_links, :detector_types, :scale_to_fit def screen_setup check_content_data self.external_links ||= false + self.scale_to_fit ||= false + self.detector_types ||= :none end def on_init - - self.detector_types ||= UIDataDetectorTypeNone if self.detector_types.is_a? Array detectors = UIDataDetectorTypeNone self.detector_types.each { |dt| detectors |= map_detector_symbol(dt) } self.detector_types = detectors + else + self.detector_types = map_detector_symbol(self.detector_types) end self.webview ||= add UIWebView.new, { frame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height), resize: [ :width, :height ], delegate: self, data_detector_types: self.detector_types } + self.webview.scalesPageToFit = self.scale_to_fit self.webview.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal set_initial_content end def web @@ -106,14 +109,14 @@ return open_in_safari(inRequest) unless chrome_controller.isChromeInstalled chrome_controller.openInChrome(inRequest.URL) end def open_in_safari(inRequest) - #Open UIWebView delegate links in Safari. + # Open UIWebView delegate links in Safari. UIApplication.sharedApplication.openURL(inRequest.URL) end - #UIWebViewDelegate Methods - Camelcase + # UIWebViewDelegate Methods - Camelcase def webView(inWeb, shouldStartLoadWithRequest:inRequest, navigationType:inType) if self.external_links == true && inType == UIWebViewNavigationTypeLinkClicked if defined?(OpenInChromeController) open_in_chrome inRequest else