Class: MIM::MotionBrowserToolbarDelegate

Inherits:
Object
  • Object
show all
Defined in:
lib/delegates/motion_browser_toolbar_delegate.rb

Instance Method Summary collapse

Constructor Details

#initialize(webview) ⇒ MotionBrowserToolbarDelegate

Returns a new instance of MotionBrowserToolbarDelegate.



3
4
5
# File 'lib/delegates/motion_browser_toolbar_delegate.rb', line 3

def initialize(webview)
  @webview = webview
end

Instance Method Details

#backButtonPressed(back_button) ⇒ Object



12
13
14
15
16
# File 'lib/delegates/motion_browser_toolbar_delegate.rb', line 12

def backButtonPressed(back_button)
  if @webview.canGoBack
    @webview.goBack
  end
end

#forwardButtonPressed(forward_button) ⇒ Object



18
19
20
21
22
# File 'lib/delegates/motion_browser_toolbar_delegate.rb', line 18

def forwardButtonPressed(forward_button)
  if @webview.canGoForward
    @webview.goForward
  end
end

#shareButtonPressed(shared_button) ⇒ Object



7
8
9
10
# File 'lib/delegates/motion_browser_toolbar_delegate.rb', line 7

def shareButtonPressed(shared_button)
  vc = UIActivityViewController.alloc.initWithActivityItems([{'url' => @webview.request.URL.absoluteString}], applicationActivities: nil)
  UIWindow.keyWindow.rootViewController.presentViewController(vc, animated: true, completion: nil)
end