module ProMotion::UIWebScreenModule

Public Instance Methods

back_forward_list() click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 34
def back_forward_list
  # self.webview.backForwardList
  PM.logger.warn "`back_forward_list` is not implemented with the older UIWebView, which doesn't support it."
  false
end
evaluate(js) click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 15
def evaluate(js)
  self.webview.stringByEvaluatingJavaScriptFromString(js)
end
evaluate_async(js, &block) click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 19
def evaluate_async(js, &block)
  Dispatch::Queue.concurrent.async do
    result = evaluate(js)
    Dispatch::Queue.main.async do
      block.call result
    end
  end
end
go_to_item(item) click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 28
def go_to_item(item)
  # self.webview.goToBackForwardListItem(item)
  PM.logger.warn "`go_to_item` is not implemented with the older UIWebView, which doesn't support it."
  false
end
progress() click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 40
def progress
  # self.webview.estimatedProgress
  PM.logger.warn "`progress` is not implemented with the older UIWebView, which doesn't support it."
  false
end
webView(in_web, shouldStartLoadWithRequest:in_request, navigationType:in_type) click to toggle source

CocoaTouch methods

# File lib/ProMotion/web/ui_web_screen_module.rb, line 48
def webView(in_web, shouldStartLoadWithRequest:in_request, navigationType:in_type)
  if %w(http https).include?(in_request.URL.scheme)
    if self.external_links == true && in_type == UIWebViewNavigationTypeLinkClicked
      if defined?(OpenInChromeController)
        open_in_chrome in_request
      else
        open_in_safari in_request
      end
      return false # don't allow the web view to load the link.
    end
  end

  load_request_enable = true #return true on default for local file loading.
  load_request_enable = !!on_request(in_request, in_type) if self.respond_to?(:on_request)
  load_request_enable
end
webViewDidFinishLoad(webView) click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 69
def webViewDidFinishLoad(webView)
  load_finished if self.respond_to?(:load_finished)
end
webViewDidStartLoad(webView) click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 65
def webViewDidStartLoad(webView)
  load_started if self.respond_to?(:load_started)
end
web_view_setup() click to toggle source
# File lib/ProMotion/web/ui_web_screen_module.rb, line 3
def web_view_setup
  self.webview = add UIWebView.new, {
    frame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height),
    delegate: self,
    data_detector_types: data_detector_types
  }

  self.webview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
  self.webview.scalesPageToFit = self.scale_to_fit
  self.webview.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal
end