-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSafariDialog.yml
128 lines (108 loc) · 4.04 KB
/
SafariDialog.yml
1
2
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Modules.SafariDialog
summary: Allows a Titanium application to use the iOS Safari ViewController to create an embedded browser.
platforms: [iphone, ipad]
since: "5.1.0"
extends: Titanium.Module
description: |
The SafariDialog module provides Titanium access to the native SFSafariViewController. This enables you to
deliver interactive web content in your app just like Safari, including the key Safari UI elements already
familiar to your users. See how to easily bring Safari features like Reader and AutoFill into your app.
### Requirements
The SafariDialog module is available with the Titanium SDK starting with Release 5.1.0.
This module only works with devices running iOS 9.
Please make sure you have at least Xcode 7 to build to the required sources.
### Getting Started
Add the module as a dependency to your application by adding a **`<module>`** item to the
**`<modules>`** element of your `tiapp.xml` file:
<ti:app>
...
<modules>
<module platform="iphone">ti.safaridialog</module>
</modules>
...
</ti:app>
Use `require()` to access the module from JavaScript:
var dialog = require("ti.safaridialog");
The `dialog` variable is a reference to the module. Make API calls using this reference:
if(dialog.isSupported()){
dialog.open({
url:"http://appcelerator.com",
title:"Hello World",
tintColor:"red"
});
}
### Sample Application
The module contains a sample application in the
`<TITANIUM_SDK_HOME>/modules/iphone/ti.safaridialog/<VERSION>/example/` folder.
properties:
- name: supported
summary: Indicates if SafariDialog is supported.
type: Boolean
osver: {ios: {min: "9.0"}}
platforms: [iphone,ipad]
- name: opened
summary: Indicates is SafariDialog is open.
type: Boolean
osver: {ios: {min: "9.0"}}
platforms: [iphone,ipad]
methods:
- name: isOpen
summary: Indicates if SafariDialog is open.
osver: {ios: {min: "9.0"}}
platforms: [iphone,ipad]
returns:
type: Boolean
- name: isSupported
summary: Indicates if SafariDialog is supported.
osver: {ios: {min: "9.0"}}
platforms: [iphone,ipad]
returns:
type: Boolean
- name: open
summary: Opens the SafariDialog with the options provided.
description: |
var dialog = require("ti.safaridialog");
if(dialog.isSupported()){
dialog.open({
url:"http://appcelerator.com",
title:"Hello World",
tintColor:"red"
});
}
osver: {ios: {min: "9.0"}}
platforms: [iphone,ipad]
parameters:
- name: params
summary: |
Dictionary containing the following properties:
* `url` (String): Required field. The URL to be opened in the SafariDialog.
* `entersReaderIfAvailable` (Boolean): Optional field. Indicates if the Safari Reader version of content should be shown automatically.
* `title` (String): Optional field. Sets the title of the page displayed.
* `tintColor` (String): Optional field. The tintColor applied to SafariDialog.
type: Dictionary
- name: close
summary: Programmatically closes the SafariDialog.
description: |
var dialog = require("ti.safaridialog");
if(dialog.isOpen()){
dialog.close();
}
osver: {ios: {min: "9.0"}}
platforms: [iphone,ipad]
events:
- name: open
summary: |
The open event is fired after the SafariDialog has opened.
properties:
- name: url
summary: The URL provided when opening the SafariDialog
type: String
platforms: [iphone, ipad]
- name: close
summary: |
The close event is fired when the SafariDialog is closed by the user or programmatically.
properties:
- name: url
summary: The URL provided when opening the SafariDialog
type: String
platforms: [iphone, ipad]