4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'motion/ui/ui_activity_view_controller_wrapper.rb', line 4
def new(options = {}, presenting_controller = nil, &block)
options = {
activities: nil,
animated: true
}.merge(options)
if options[:item] || options[:items]
items = Array(options[:item] || options[:items])
else
raise ArgumentError, "You must specify at least one item - #{options.inspect}"
end
vc = alloc.initWithActivityItems(items, applicationActivities:options[:activities])
vc.excludedActivityTypes = BW::Constants.get("UIActivityType", Array(options[:excluded])) if options[:excluded]
unless block.nil?
block.weak! if BubbleWrap.use_weak_callbacks?
vc.setCompletionHandler block
end
presenting_controller ||= App.window.rootViewController.presentedViewController
presenting_controller ||= App.window.rootViewController
presenting_controller.presentViewController(vc, animated:options[:animated], completion: lambda {})
vc
end
|