Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-16275] iOS Cookie management #5466

Merged
merged 11 commits into from
Mar 18, 2014
2 changes: 1 addition & 1 deletion apidoc/Titanium/App/App.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ events:
- name: memorywarning
summary: Fired when the app receives a warning from the operating system about low memory availability.
platforms: [iphone, ipad]
since: "3.3.0"
since: "3.2.3"

- name: pause
summary: Fired when the application transitions from active to inactive state on a multitasked system.
Expand Down
24 changes: 21 additions & 3 deletions apidoc/Titanium/Network/Cookie.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ summary: Cookie object used to manage the system cookie store and HTTP client co
description: |
Use <Titanium.Network.createCookie> to create a new `Cookie` object.
extends: Titanium.Proxy
since: "3.2.0"
platforms: [android]
since: {android: "3.2.0", iphone: "3.3.0", ipad: "3.3.0"}
platforms: [android, iphone, ipad]

methods:
- name: isValid
summary: Returns true if the cookie is valid.
description: |
This method checks if the cookie is valid. For a cookie to be valid the minimum
properties requiered are `name`, `value`, `path` and either `domain` or `originalUrl`
platforms: [iphone, ipad]
since: "3.3.0"
returns:
type: Boolean

properties:
- name: comment
Expand All @@ -25,7 +36,8 @@ properties:
- name: httponly
summary: The httponly attribute of the cookie.
description: |
When this property is set to `true`, the cookie will be used only when transmitting HTTP (or HTTPS) requests.
On iOS this property cannot be set. On Android, when this property is set to `true`, the cookie will
be used only when transmitting HTTP (or HTTPS) requests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to set platform specific permissions. If it is possible please do that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked to @bhatfield, the permission tag cannot platform specific.

type: Boolean
default: false

Expand All @@ -35,6 +47,12 @@ properties:
permission: read-only
availability: creation

- name: originalUrl
summary: The origual url attribute of the cookie.
type: String
platforms: [iphone, ipad]
since: "3.3.0"

- name: path
summary: The path attribute of the cookie.
description: |
Expand Down
63 changes: 50 additions & 13 deletions apidoc/Titanium/Network/Network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ methods:
summary: |
Adds a cookie to the HTTP client cookie store.
description: |
Any existing cookie with the same domain and name will be replaced with the new cookie. This is a bug
On iOS, the cookie will override an existing cookie with the same name, domain and path, if any. The cookie's
`expiryDate` property must be a date later than the creating date, otherwise the cookie will not persist in the
cookie storage.
On Android, any existing cookie with the same domain and name will be replaced with the new cookie. This is a bug
in [BasicCookieStore](http://developer.android.com/reference/org/apache/http/impl/cookie/BasicClientCookie.html)
because based on `RFC6265`, an existing cookie can be evicted and replaced only when it has the same cookie-name,
domain-value and path-value with the new cookie.
parameters:
- name: cookie
summary: The cookie to add
type: Titanium.Network.Cookie
platforms: [android]
since: "3.2.0"
platforms: [android, iphone, ipad]
since: {android: "3.2.0", iphone: "3.3.0", ipad: "3.3.0"}

- name: addSystemCookie
summary: |
Expand Down Expand Up @@ -176,8 +179,8 @@ methods:
type: String
returns:
type: Array<Titanium.Network.Cookie>
platforms: [android]
since: "3.2.0"
platforms: [android, iphone, ipad]
since: {android: "3.2.0", iphone: "3.3.0", ipad: "3.3.0"}

- name: getHTTPCookiesForDomain
summary: |
Expand All @@ -190,8 +193,8 @@ methods:
type: String
returns:
type: Array<Titanium.Network.Cookie>
platforms: [android]
since: "3.2.0"
platforms: [android, iphone, ipad]
since: {android: "3.2.0", iphone: "3.3.0", ipad: "3.3.0"}

- name: getSystemCookies
summary: |
Expand All @@ -218,8 +221,8 @@ methods:
- name: removeAllHTTPCookies
summary: |
Removes all the cookies from the HTTP client cookie store.
platforms: [android]
since: "3.2.0"
platforms: [android, iphone, ipad]
since: {android: "3.2.0", iphone: "3.3.0", ipad: "3.3.0"}

- name: removeAllSystemCookies
summary: |
Expand All @@ -242,8 +245,8 @@ methods:
- name: name
summary: The name of the cookie to remove. It is case-sensitive.
type: String
platforms: [android]
since: "3.2.0"
platforms: [android, iphone, ipad]
since: {android: "3.2.0", iphone: "3.3.0", ipad: "3.3.0"}

- name: removeHTTPCookiesForDomain
summary: |
Expand All @@ -254,8 +257,8 @@ methods:
- name: domain
summary: The domain of the cookie to remove. It is case-insensitive.
type: String
platforms: [android]
since: "3.2.0"
platforms: [android, iphone, ipad]
since: {android: "3.2.0", iphone: "3.3.0", ipad: "3.3.0"}

- name: removeSystemCookie
summary: |
Expand Down Expand Up @@ -337,6 +340,7 @@ properties:
platforms: [iphone, ipad]
deprecated:
since: "1.7.0"

- name: NETWORK_LAN
summary: |
A [networkType](Titanium.Network.networkType) value indicating that the device is
Expand All @@ -350,6 +354,7 @@ properties:
[change](Titanium.Network.change) event.
type: Number
permission: read-only

- name: NETWORK_MOBILE
summary: |
A [networkType](Titanium.Network.networkType) value indicating that the device is
Expand All @@ -360,6 +365,7 @@ properties:
[change](Titanium.Network.change) event.
type: Number
permission: read-only

- name: NETWORK_NONE
summary: |
A [networkType](Titanium.Network.networkType) value indicating that no
Expand All @@ -370,6 +376,7 @@ properties:
[change](Titanium.Network.change) event.
type: Number
permission: read-only

- name: NETWORK_UNKNOWN
summary: |
A [networkType](Titanium.Network.networkType) value indicating that the
Expand All @@ -380,6 +387,7 @@ properties:
[change](Titanium.Network.change) event.
type: Number
permission: read-only

- name: NETWORK_WIFI
summary: |
A [networkType](Titanium.Network.networkType) value indicating that the
Expand All @@ -390,26 +398,31 @@ properties:
[change](Titanium.Network.change) event.
type: Number
permission: read-only

- name: NOTIFICATION_TYPE_ALERT
summary: Constant value for an Alert style push notification.
platforms: [iphone, ipad]
permission: read-only
type: Number

- name: NOTIFICATION_TYPE_BADGE
summary: Constant value for a Badge style push notification.
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: NOTIFICATION_TYPE_SOUND
summary: Constant value for a Sound style push notification.
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: NOTIFICATION_TYPE_NEWSSTAND
summary: Constant value for a Newsstand style push notification. Only available on iOS5 and later
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: READ_MODE
deprecated:
since: "1.7.0"
Expand All @@ -422,6 +435,7 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: READ_WRITE_MODE
deprecated:
since: "1.7.0"
Expand All @@ -434,6 +448,7 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: SOCKET_CLOSED
deprecated:
since: "1.7.0"
Expand All @@ -446,6 +461,7 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: SOCKET_CONNECTED
deprecated:
since: "1.7.0"
Expand All @@ -458,6 +474,7 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: SOCKET_ERROR
deprecated:
since: "1.7.0"
Expand All @@ -470,6 +487,7 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: SOCKET_INITIALIZED
deprecated:
since: "1.7.0"
Expand All @@ -482,6 +500,7 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: SOCKET_LISTENING
deprecated:
since: "1.7.0"
Expand All @@ -494,6 +513,7 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: WRITE_MODE
deprecated:
since: "1.7.0"
Expand All @@ -506,60 +526,77 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: TLS_VERSION_1_0
summary: Constant value specifying TLS version 1.0 for SSL.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "1.8.0.1"

- name: TLS_VERSION_1_1
summary: Constant value specifying TLS version 1.1 for SSL.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "1.8.0.1"

- name: TLS_VERSION_1_2
summary: Constant value specifying TLS version 1.2 for SSL.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "1.8.0.1"

- name: allHTTPCookies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing

summary: A list of all cookies in the cookie storage.
type: Array<Titanium.Network.Cookie>
permission: read-only
platforms: [iphone, ipad]
since: "3.3.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing


- name: networkType
summary: Network type value as a constant.
description: |
One of the `NETWORK` constants defined in <Titanium.Network>.
type: Number
permission: read-only

- name: networkTypeName
summary: Network type as a String. Returns one of `NONE`, `WIFI`, `LAN`, `MOBILE`, or `UNKNOWN`.
type: String
permission: read-only

- name: online
summary: Boolean value indicating if the device can reach the Internet.
description: |
The `online` property is `true` if the device can currently reach the Internet
using either WiFi, mobile network or LAN.
type: Boolean
permission: read-only

- name: remoteDeviceUUID
summary: |
Remote device UUID if the device is registered with the Apple Push Notification
Service, or null if it is not registered.
platforms: [iphone, ipad]
type: String
permission: read-only

- name: remoteNotificationTypes
summary: Array of push notification type constants enabled for the application.
platforms: [iphone, ipad]
type: Array<Number>
permission: read-only

- name: remoteNotificationsEnabled
summary: |
Indicates whether push notifications have been enabled using
[registerForPushNotifications](Titanium.Network.registerForPushNotifications).
platforms: [iphone, ipad]
type: Boolean
permission: read-only

- name: httpURLFormatter
summary: User-defined function that is called everytime HTTPClient connects to a remote resource.
description: |
Expand Down