Class: UnderOs::Sharing::Interaction

Inherits:
Object
  • Object
show all
Defined in:
lib/under_os/sharing/interaction.rb

Instance Method Summary collapse

Constructor Details

#initialize(uti) ⇒ Interaction

Returns a new instance of Interaction.



4
5
6
# File 'lib/under_os/sharing/interaction.rb', line 4

def initialize(uti)
  @uti = uti
end

Instance Method Details

#documentInteractionController(controller, willBeginSendingToApplication: application) ⇒ Object



20
21
22
# File 'lib/under_os/sharing/interaction.rb', line 20

def documentInteractionController(controller, willBeginSendingToApplication: application)
  @callback.call(true)
end

#open(url, annotation = nil, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/under_os/sharing/interaction.rb', line 8

def open(url, annotation=nil, &block)
  @callback   = block

  @root_view  = UnderOs::App.history.current_page.navbar._.visibleViewController.view

  @controller = UIDocumentInteractionController.interactionControllerWithURL(url)
  @controller.annotation = annotation if annotation
  @controller.delegate = self
  @controller.setUTI @uti
  @controller.presentOpenInMenuFromRect @root_view.frame, inView: @root_view, animated: true
end