3
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 'lib/mobile_intent/helpers.rb', line 3
def launch_app(*args, &block)
if block_given?
app_name = args.shift
app_path = args.shift
else
text = args.shift
app_name = args.shift
app_path = args.shift
end
app = MobileIntent.config.apps[app_name.to_sym]
url = app.launch_url(app_path, request.user_agent)
options = args.shift
unless request.user_agent =~ /Android/ && request.user_agent =~ /Chrome/
options["data-app-scheme"] = app_name
if options[:class]
options[:class] += ' launch_app'
else
options[:class] = 'launch_app'
end
end
if block_given?
link_to(url, options, &block)
else
link_to(text, url, options)
end
end
|