This commit is contained in:
Olivier Goguel 2015-05-19 21:23:20 +02:00
Родитель 05db89a306
Коммит c3e41c13ac
52 изменённых файлов: 4555 добавлений и 4547 удалений

Просмотреть файл

@ -1,58 +1,58 @@
## Getting Started with Cordova Plugin for AZME
#### App Creation
Create a Sample Cordova App
``````sh
cordova create <myAppName> <myAppBundleId> <myAppShortName>
```
Add the platform you'd like to support (iOS in this case)
``````sh
cordova platform add ios
```
Retrieve your credentials for the AZURE Portal to configure the AZME plugin
``````sh
cordova plugin add cordova-plugin-ms-azme --variable AZME_IOS_COLLECTION=<yourCollection> --variable AZME_IOS_SDKKEY=<yourSDKKey> --variable AZME_IOS_APPID=<yourAppId> --variable AZME_IOS_REACH_ICON=Icon
--variable AZME_REDIRECT_URL=myRedirect --variable AZME_ENABLE_LOG=true
```
#### Send a screen to the AZME portal
Edit `www/js/index.js`to add the call to AZME to declare a new activity once the ``deviceReady``event is received.
``````js
onDeviceReady: function() {
app.receivedEvent('deviceready');
AZME.startActivity("myPage",{});
},
```
Launch your application...
``````sh
cordova run ios
```
... a new session should appear in the AZME portal and you should see the following log in your iOS application
``````log
[Engagement] Agent: Session started
[Engagement] Agent: Activity 'myPage' started
[Engagement] Connection: Established
[Engagement] Connection: Sent: appInfo
[Engagement] Connection: Sent: startSession
[Engagement] Connection: Sent: activity name='myPage'
```
#### Extend your app to add Reach Support
Edit `www/js/index.js`to add the call to AZME to request push new notification, and declare an handler
``````js
onDeviceReady: function() {
app.receivedEvent('deviceready');
AZME.registerForPushNotification();
AZME.onOpenURL(function(_url) { alert(_url); });
AZME.startActivity("myPage",{});
},
```
Launch your application...
``````sh
cordova run ios
```
... a popup should appear to the user to allow notifications
You can then create a Reach campaign with an Action URL ``myRedirect://test``
Activating the campaign shoud trigger the webview, and when the action button is being pressed, the alert box in the handler should be triggered
## Getting Started with Cordova Plugin for AZME
#### App Creation
Create a Sample Cordova App
``````sh
cordova create <myAppName> <myAppBundleId> <myAppShortName>
```
Add the platform you'd like to support (iOS in this case)
``````sh
cordova platform add ios
```
Retrieve your credentials for the AZURE Portal to configure the AZME plugin
``````sh
cordova plugin add cordova-plugin-ms-azme --variable AZME_IOS_COLLECTION=<yourCollection> --variable AZME_IOS_SDKKEY=<yourSDKKey> --variable AZME_IOS_APPID=<yourAppId> --variable AZME_IOS_REACH_ICON=Icon
--variable AZME_REDIRECT_URL=myapp --variable AZME_ENABLE_LOG=true
```
#### Send a screen to the AZME portal
Edit `www/js/index.js`to add the call to AZME to declare a new activity once the ``deviceReady``event is received.
``````js
onDeviceReady: function() {
app.receivedEvent('deviceready');
AZME.startActivity("myPage",{});
},
```
Launch your application...
``````sh
cordova run ios
```
... a new session should appear in the AZME portal and you should see the following log in your iOS application
``````log
[Engagement] Agent: Session started
[Engagement] Agent: Activity 'myPage' started
[Engagement] Connection: Established
[Engagement] Connection: Sent: appInfo
[Engagement] Connection: Sent: startSession
[Engagement] Connection: Sent: activity name='myPage'
```
#### Extend your app to add Reach Support
Edit `www/js/index.js`to add the call to AZME to request push new notification, and declare an handler
``````js
onDeviceReady: function() {
app.receivedEvent('deviceready');
AZME.registerForPushNotification();
AZME.onOpenURL(function(_url) { alert(_url); });
AZME.startActivity("myPage",{});
},
```
Launch your application...
``````sh
cordova run ios
```
... a popup should appear to the user to allow notifications
You can then create a Reach campaign with an Action URL ``myapp://test``
Activating the campaign shoud trigger the webview, and when the action button is being pressed, the alert box in the handler should be triggered

334
README.md
Просмотреть файл

@ -1,167 +1,167 @@
#Cordova plugin for Azure Mobile Engagement
----
Introduction
--
This plugin integrates the Azure Mobile Engagement (AZME) SDK into your Cordova/PhoneGap Application. It supports both *reporting* and *push* features.
*Please refer to the Azure Mobile Engagement documentation for more information about the various AZME concepts*.
Supported Platforms
--
* iOS
* Android
Installation
--
To install the plugin, just add it to your Cordova project using your proper AZME credentials through Cordova variables.
```sh
cd <your project>
cordova plugin add cordova-plugin-ms-azme --variable KEY=<value>
```
#### Generic Variables
- `$AZME_ENABLE_LOG` : `true`|`false`, enable both plugin and AZME native logs
- `$AZME_REDIRECT_URL` : the url schemes of your application when using redirect actions in your campaign. Must be the url prefix without :// (ex: `myapp` to handle urls such as `myapp://shop`)
#### iOS Variables
- `$AZME_IOS_APPID` : the AZME application ID of your iOS application
- `$AZME_IOS_SDKKEY` : the sdk key
- `$AZME_IOS_COLLECTION` : the collection
- `$AZME_IOS_REACH_ICON` : the icon used for reach notification : must be the name of the resource with its extension (ex: `icon.png`)
#### Android Variables
- `$AZME_ANDROID_APPID` : the AZME application ID of your Android application
- `$AZME_ANDROID_SDKKEY` : the sdk key
- `$AZME_ANDROID_COLLECTION` : the collextion
- `$AZME_ANDROID_REACH_ICON` : the icon used for reach notification : must be the name of the resource without any extension, nor drawable prefix (ex: `icon`)
- `$AZME_GOOGLE_PROJECT_NUMBER` : the project number used as the GCM (Google Cloud Messaging) sender ID
*The AppId, SDKKey and Collection can easily be retrieved from the connection string `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_SDK_KEY};AppId={YOUR_APPID}`*
Example:
```sh
cordova plugin add cordova-plugin-ms-azme --variable AZME_IOS_COLLECTION=$AZME_IOS_COLLECTION \
--variable AZME_IOS_SDKKEY=$AZME_IOS_SDKKEY \
--variable AZME_IOS_APPID=$AZME_IOS_APPID \
--variable AZME_IOS_REACH_ICON=$AZME_IOS_REACH_ICON \
--variable AZME_ANDROID_GOOGLE_PROJECT_NUMBER=$AZME_ANDROID_GOOGLE_PROJECT_NUMBER \
--variable AZME_ANDROID_APPID=$AZME_ANDROID_APPID \
--variable AZME_ANDROID_COLLECTION=$AZME_ANDROID_COLLECTION \
--variable AZME_ANDROID_SDKKEY=$AZME_ANDROID_SDKKEY \
--variable AZME_ANDROID_REACH_ICON=$AZME_ANDROID_REACH_ICON \
--variable AZME_REDIRECT_URL=$AZME_REDIRECT_URL \
--variable AZME_ENABLE_LOG=$AZME_ENABLE_LOG
```
To remove the plugin,
```sh
cordova plugin rm cordova-plugin-ms-azme
```
Methods
--
Once the `deviceready` event has been triggered by the Cordova framework, a `AZME` object is available to interact with the native AZME SDK.
* AZME.startActivity
* AZME.endActivity
* AZME.sendAppInfo
* AZME.startJob
* AZME.endJob
* AZME.sendEvent
* AZME.onOpenURL
* AZME.registerForRemoteNotification
* AZME.getStatus
### AZME.startActivity
Start a new activty with the corresponding extra infos object.
```javascript
AZME.startActivity(_activityName, _extraInfos,[ _success], [_failure]);
```
##### Params
* `_activityName`: the name of the activity
* `_extraInfos`: a json object containing the extra infos attached to this activity
### AZME.endActivity
Ends the current Actvity. Would trigger a new session on the next startActivity
```javascript
AZME.endActivity([ _success], [_failure]);
```
### AZME.sendEvent
Send an event with the corresponding extra infos object.
```javascript
AZME.sendEvent(_eventName, _extraInfos,[ _success], [_failure]);
```
##### Params
* `_eventName`: the name of the event
* `_extraInfos`: a json object containing the extra infos attached to this event
### AZME.startJob
Start an new job with the corresponding extra infos object.
```javascript
AZME.startJob(_jobName, _extraInfos,[ _success], [_failure]);
```
##### Params
* `_jobName`: the name of the job
* `_extraInfos`: a json object containing the extra infos attached to this job
### AZME.endJob
End a job previously created by startJob
```javascript
AZME.endJob(_jobName,[ _success], [_failure]);
```
##### Params
* `_jobName`: the name of the job
### AZME.sendAppInfo
Send App Infos atttached to the currente device.
```javascript
AZME.sendAppInfo( _appInfos,[ _success], [_failure]);
```
##### Params
* `_appInfos`: the json object containing the app infos to be sent
### AZME.onOpenURL
Set an event handler when an application specific URL is triggered (from a push campaign for example). The URL scheme must match the one defined in the `$AZME_REDIRECT_URL` setting
```javascript
AZME.onOpenURL( _urlHandler,[ _success], [_failure]);
```
#####Params
* `_urlHandler`: the handler that is passed the url that has been triggerd
#####Example
```javascript
AZME.onOpenURL(function(_url) {
console.log("user triggered url/action "+_url);
});
```
### AZME.registerForPushNotification
Register the application to receive push notifications on iOS (this function does nothing on the other platforms)
```javascript
AZME.registerForPushNotification( [_success], [_failure]);
```
### AZME.getStatus
Returns information about the AZME library
```javascript
AZME.getStatus( _statusCallback, [_failure]);
```
##### Params
* `_statusCallback`: the handler that is passed a json object containing information about the AZME library
##### Example
```javascript
AZME.getStatus(function(_info) {
console.log("AZME SDK Version : "+_info.AZMEVersion);
console.log("AZME plugin Version : "+_info.pluginVersion);
});
```
History
----
1.0.0
* Initial Release
#Cordova plugin for Azure Mobile Engagement
----
Introduction
--
This plugin integrates the Azure Mobile Engagement (AZME) SDK into your Cordova/PhoneGap Application. It supports both *reporting* and *push* features.
*Please refer to the Azure Mobile Engagement documentation for more information about the various AZME concepts*.
Supported Platforms
--
* iOS
* Android
Installation
--
To install the plugin, just add it to your Cordova project using your proper AZME credentials through Cordova variables.
```sh
cd <your project>
cordova plugin add cordova-plugin-ms-azme --variable KEY=<value>
```
#### Generic Variables
- `AZME_ENABLE_LOG` : `true`|`false`, enable both plugin and AZME native logs
- `AZME_REDIRECT_URL` : the url schemes of your application when using redirect actions in your campaign. Must be the url prefix without :// (ex: `myapp` to handle urls such as `myapp://shop`)
#### iOS Variables
- `AZME_IOS_APPID` : the AZME application ID of your iOS application
- `AZME_IOS_SDKKEY` : the sdk key
- `AZME_IOS_COLLECTION` : the collection
- `AZME_IOS_REACH_ICON` : the icon used for reach notification : must be the name of the resource with its extension (ex: `icon.png`)
#### Android Variables
- `AZME_ANDROID_APPID` : the AZME application ID of your Android application
- `AZME_ANDROID_SDKKEY` : the sdk key
- `AZME_ANDROID_COLLECTION` : the collextion
- `AZME_ANDROID_REACH_ICON` : the icon used for reach notification : must be the name of the resource without any extension, nor drawable prefix (ex: `icon`)
- `AZME_GOOGLE_PROJECT_NUMBER` : the project number used as the GCM (Google Cloud Messaging) sender ID
*The AppId, SDKKey and Collection can easily be retrieved from the connection string `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_SDK_KEY};AppId={YOUR_APPID}`*
Example:
```sh
cordova plugin add cordova-plugin-ms-azme --variable AZME_IOS_COLLECTION=$AZME_IOS_COLLECTION \
--variable AZME_IOS_SDKKEY=$AZME_IOS_SDKKEY \
--variable AZME_IOS_APPID=$AZME_IOS_APPID \
--variable AZME_IOS_REACH_ICON=$AZME_IOS_REACH_ICON \
--variable AZME_ANDROID_GOOGLE_PROJECT_NUMBER=$AZME_ANDROID_GOOGLE_PROJECT_NUMBER \
--variable AZME_ANDROID_APPID=$AZME_ANDROID_APPID \
--variable AZME_ANDROID_COLLECTION=$AZME_ANDROID_COLLECTION \
--variable AZME_ANDROID_SDKKEY=$AZME_ANDROID_SDKKEY \
--variable AZME_ANDROID_REACH_ICON=$AZME_ANDROID_REACH_ICON \
--variable AZME_REDIRECT_URL=$AZME_REDIRECT_URL \
--variable AZME_ENABLE_LOG=$AZME_ENABLE_LOG
```
To remove the plugin,
```sh
cordova plugin rm cordova-plugin-ms-azme
```
Methods
--
Once the `deviceready` event has been triggered by the Cordova framework, a `AZME` object is available to interact with the native AZME SDK.
* AZME.startActivity
* AZME.endActivity
* AZME.sendAppInfo
* AZME.startJob
* AZME.endJob
* AZME.sendEvent
* AZME.onOpenURL
* AZME.registerForRemoteNotification
* AZME.getStatus
### AZME.startActivity
Start a new activty with the corresponding extra infos object.
```javascript
AZME.startActivity(_activityName, _extraInfos,[ _success], [_failure]);
```
##### Params
* `_activityName`: the name of the activity
* `_extraInfos`: a json object containing the extra infos attached to this activity
### AZME.endActivity
Ends the current Actvity. Would trigger a new session on the next startActivity
```javascript
AZME.endActivity([ _success], [_failure]);
```
### AZME.sendEvent
Send an event with the corresponding extra infos object.
```javascript
AZME.sendEvent(_eventName, _extraInfos,[ _success], [_failure]);
```
##### Params
* `_eventName`: the name of the event
* `_extraInfos`: a json object containing the extra infos attached to this event
### AZME.startJob
Start an new job with the corresponding extra infos object.
```javascript
AZME.startJob(_jobName, _extraInfos,[ _success], [_failure]);
```
##### Params
* `_jobName`: the name of the job
* `_extraInfos`: a json object containing the extra infos attached to this job
### AZME.endJob
End a job previously created by startJob
```javascript
AZME.endJob(_jobName,[ _success], [_failure]);
```
##### Params
* `_jobName`: the name of the job
### AZME.sendAppInfo
Send App Infos atttached to the currente device.
```javascript
AZME.sendAppInfo( _appInfos,[ _success], [_failure]);
```
##### Params
* `_appInfos`: the json object containing the app infos to be sent
### AZME.onOpenURL
Set an event handler when an application specific URL is triggered (from a push campaign for example). The URL scheme must match the one defined in the `$AZME_REDIRECT_URL` setting
```javascript
AZME.onOpenURL( _urlHandler,[ _success], [_failure]);
```
#####Params
* `_urlHandler`: the handler that is passed the url that has been triggerd
#####Example
```javascript
AZME.onOpenURL(function(_url) {
console.log("user triggered url/action "+_url);
});
```
### AZME.registerForPushNotification
Register the application to receive push notifications on iOS (this function does nothing on the other platforms)
```javascript
AZME.registerForPushNotification( [_success], [_failure]);
```
### AZME.getStatus
Returns information about the AZME library
```javascript
AZME.getStatus( _statusCallback, [_failure]);
```
##### Params
* `_statusCallback`: the handler that is passed a json object containing information about the AZME library
##### Example
```javascript
AZME.getStatus(function(_info) {
console.log("AZME SDK Version : "+_info.AZMEVersion);
console.log("AZME plugin Version : "+_info.pluginVersion);
});
```
History
----
1.0.0
* Initial Release

Просмотреть файл

@ -1,7 +1,21 @@
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
The MIT License (MIT)
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -1,25 +1,25 @@
{
"name": "cordova-plugin-ms-azme",
{
"name": "cordova-plugin-ms-azme",
"version": "1.0.0",
"description": "Cordova plugin for Azure Mobile Engagement",
"cordova": {
"id": "cordova-plugin-ms-azme",
"platforms": [
"android",
"ios"
]
},
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-mobile-engagement-capptain-cordova"
},
"keywords": [
"cordova",
"azme",
"ecosystem:cordova",
"cordova-android",
"cordova-ios"
],
"author": "Olivier Goguel",
"license": "Apache 2.0"
}
"description": "Cordova plugin for Azure Mobile Engagement",
"cordova": {
"id": "cordova-plugin-ms-azme",
"platforms": [
"android",
"ios"
]
},
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-mobile-engagement-capptain-cordova"
},
"keywords": [
"cordova",
"azme",
"ecosystem:cordova",
"cordova-android",
"cordova-ios"
],
"author": "Olivier Goguel",
"license": "Apache 2.0"
}

Просмотреть файл

@ -1,25 +1,25 @@
{
"name": "cordova-plugin-ms-azme",
"version": "1.0.4",
"description": "Cordova plugin for Azure Mobile Engagement",
"cordova": {
"id": "cordova-plugin-ms-azme",
"platforms": [
"android",
"ios"
]
},
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-mobile-engagement-capptain-cordova"
},
"keywords": [
"cordova",
"azme",
"ecosystem:cordova",
"cordova-android",
"cordova-ios"
],
"author": "Olivier Goguel",
"license": "Apache 2.0"
}
{
"name": "cordova-plugin-ms-azme",
"version": "1.0.0",
"description": "Cordova plugin for Azure Mobile Engagement",
"cordova": {
"id": "cordova-plugin-ms-azme",
"platforms": [
"android",
"ios"
]
},
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-mobile-engagement-capptain-cordova"
},
"keywords": [
"cordova",
"azme",
"ecosystem:cordova",
"cordova-android",
"cordova-ios"
],
"author": "Olivier Goguel",
"license": "Apache 2.0"
}

Просмотреть файл

@ -1,260 +1,262 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-ms-azme" version="1.0.0">
<name>Cordova plugin for AZME</name>
<description>Cordova plugin for Azure Mobile Engagement</description>
<keywords>cordova,azme</keywords>
<author>Olivier Goguel</author>
<license>Apache 2.0</license>
<js-module src="www/AZME.js" name="AZME">
<clobbers target="AZME" />
</js-module>
<!-- android -->
<platform name="android">
<preference name="AZME_ANDROID_GOOGLE_PROJECT_NUMBER" />
<preference name="AZME_ANDROID_APPID" />
<preference name="AZME_ANDROID_COLLECTION" />
<preference name="AZME_ANDROID_SDKKEY" />
<preference name="AZME_ANDROID_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="res/xml/config.xml" parent="plugins">
<feature name="AZME">
<param name="android-package" value="com.del7a.azme.AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="engagement:appId" android:value="$AZME_ANDROID_APPID"/>
<meta-data android:name="engagement:collection" android:value="$AZME_ANDROID_COLLECTION"/>
<meta-data android:name="engagement:sdkKey" android:value="$AZME_ANDROID_SDKKEY"/>
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<!-- If only 1 sender, don't forget the \n, otherwise it will be parsed as a negative number... -->
<meta-data android:name="engagement:gcm:sender" android:value="$AZME_ANDROID_GOOGLE_PROJECT_NUMBER\n" />
<service
android:name="com.microsoft.azure.engagement.service.EngagementService"
android:exported="false"
android:label="$PACKAGE_NAME-Service"
android:process=":Engagement"/>
<meta-data android:name="engagement:log:test" android:value="$AZME_ENABLE_LOG" />
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementTextAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementWebAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/html" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementPollActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.POLL"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.microsoft.azure.engagement.reach.EngagementReachReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.AGENT_CREATED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.MESSAGE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ACTION_NOTIFICATION"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.EXIT_NOTIFICATION"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.DOWNLOAD_TIMEOUT"/>
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMEnabler"
android:exported="false">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.intent.action.APPID_GOT" />
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</receiver>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="$AZME_REDIRECT_URL" />
</intent-filter>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" />
<permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
</config-file>
<source-file src="src/android/AZME.java" target-dir="src/com/del7a/azme" />
<source-file src="src/android/EngagementSDK/mobile-engagement-3.0.0.jar" target-dir="libs"/>
<source-file src="src/android/libs/android-support-v4.jar" target-dir="libs"/>
<source-file src="src/android/EngagementSDK/res/drawable/engagement_close.png" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/drawable/engagement_content_title.xml" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_button_bar.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_content_title.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_area.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_overlay.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_choice.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_question.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_text_announcement.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_web_announcement.xml" target-dir="res/layout" />
</platform>
<!-- ios -->
<platform name="ios">
<preference name="AZME_IOS_COLLECTION" />
<preference name="AZME_IOS_SDKKEY" />
<preference name="AZME_IOS_APPID" />
<preference name="AZME_IOS_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="config.xml" parent="/*">
<feature name="AZME">
<param name="ios-package" value="AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_COLLECTION">
<string>$AZME_IOS_COLLECTION</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_SDKKEY">
<string>$AZME_IOS_SDKKEY</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_APPID">
<string>$AZME_IOS_APPID</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_REACH_ICON">
<string>$AZME_IOS_REACH_ICON</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_ENABLE_LOG">
<string>$AZME_ENABLE_LOG</string>
</config-file>
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>$PACKAGE_NAME.redirect</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$AZME_REDIRECT_URL</string>
</array>
</dict>
</array>
</config-file >
<header-file src="src/ios/AZME.h" />
<source-file src="src/ios/AZME.m" />
<header-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.h" />
<source-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.m" />
<header-file src="src/ios/EngagementSDK/Headers/AEModule.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushMessage.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushDelegate.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEStorage.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementAgent.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementTableViewController.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementViewController.h" />
<source-file src="src/ios/EngagementSDK/libengagement.a" framework="true" />
<header-file src="src/ios/EngagementReach/Headers/AE_TBXML.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAutorotateView.h" />
<header-file src="src/ios/EngagementReach/Headers/AEContentViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultNotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEInteractiveContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotificationView.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAbstractAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPush.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPushDelegate.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachModule.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachNotifAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPoll.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPollQuestion.h" />
<header-file src="src/ios/EngagementReach/Headers/AEViewControllerUtil.h" />
<header-file src="src/ios/EngagementReach/Headers/AEWebAnnouncementJsBridge.h" />
<resource-file src="src/ios/EngagementReach/res/close.png" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultAnnouncementView.xib" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultPollView.xib" />
<resource-file src="src/ios/EngagementReach/res/AENotificationView.xib" />
<source-file src="src/ios/EngagementReach/libreach.a" framework="true" />
<framework src="SystemConfiguration.framework" />
<framework src="CoreTelephony.framework" />
<framework src="CFNetwork.framework" />
<framework src="CoreLocation.framework" />
<framework src="AdSupport.framework" />
<framework src="libxml2.dylib" />
</platform>
</plugin>
<name>Cordova plugin for AZME</name>
<description>Cordova plugin for Azure Mobile Engagement</description>
<keywords>cordova,azme</keywords>
<author>Olivier Goguel</author>
<license>MIT</license>
<js-module src="www/AZME.js" name="AZME">
<clobbers target="AZME" />
</js-module>
<!-- android -->
<platform name="android">
<preference name="AZME_ANDROID_GOOGLE_PROJECT_NUMBER" />
<preference name="AZME_ANDROID_APPID" />
<preference name="AZME_ANDROID_COLLECTION" />
<preference name="AZME_ANDROID_SDKKEY" />
<preference name="AZME_ANDROID_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="res/xml/config.xml" parent="plugins">
<feature name="AZME">
<param name="android-package" value="com.del7a.azme.AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="engagement:appId" android:value="$AZME_ANDROID_APPID"/>
<meta-data android:name="engagement:collection" android:value="$AZME_ANDROID_COLLECTION"/>
<meta-data android:name="engagement:sdkKey" android:value="$AZME_ANDROID_SDKKEY"/>
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<!-- If only 1 sender, don't forget the \n, otherwise it will be parsed as a negative number... -->
<meta-data android:name="engagement:gcm:sender" android:value="$AZME_ANDROID_GOOGLE_PROJECT_NUMBER\n" />
<service
android:name="com.microsoft.azure.engagement.service.EngagementService"
android:exported="false"
android:label="$PACKAGE_NAME-Service"
android:process=":Engagement"/>
<meta-data android:name="engagement:log:test" android:value="$AZME_ENABLE_LOG" />
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementTextAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementWebAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/html" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementPollActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.POLL"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.microsoft.azure.engagement.reach.EngagementReachReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.AGENT_CREATED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.MESSAGE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ACTION_NOTIFICATION"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.EXIT_NOTIFICATION"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.DOWNLOAD_TIMEOUT"/>
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMEnabler"
android:exported="false">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.intent.action.APPID_GOT" />
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</receiver>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="$AZME_REDIRECT_URL" />
</intent-filter>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" />
<permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
</config-file>
<source-file src="src/android/AZME.java" target-dir="src/com/del7a/azme" />
<source-file src="src/android/EngagementSDK/mobile-engagement-3.0.0.jar" target-dir="libs"/>
<source-file src="src/android/libs/android-support-v4.jar" target-dir="libs"/>
<source-file src="src/android/EngagementSDK/res/drawable/engagement_close.png" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/drawable/engagement_content_title.xml" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_button_bar.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_content_title.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_area.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_overlay.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_choice.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_question.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_text_announcement.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_web_announcement.xml" target-dir="res/layout" />
</platform>
<!-- ios -->
<platform name="ios">
<preference name="AZME_IOS_COLLECTION" />
<preference name="AZME_IOS_SDKKEY" />
<preference name="AZME_IOS_APPID" />
<preference name="AZME_IOS_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="config.xml" parent="/*">
<feature name="AZME">
<param name="ios-package" value="AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_COLLECTION">
<string>$AZME_IOS_COLLECTION</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_SDKKEY">
<string>$AZME_IOS_SDKKEY</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_APPID">
<string>$AZME_IOS_APPID</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_REACH_ICON">
<string>$AZME_IOS_REACH_ICON</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_ENABLE_LOG">
<string>$AZME_ENABLE_LOG</string>
</config-file>
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>$PACKAGE_NAME.redirect</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$AZME_REDIRECT_URL</string>
</array>
</dict>
</array>
</config-file >
<header-file src="src/ios/AZME.h" />
<source-file src="src/ios/AZME.m" />
<header-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.h" />
<source-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.m" />
<header-file src="src/ios/EngagementSDK/Headers/AEModule.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushMessage.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushDelegate.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEStorage.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementAgent.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementTableViewController.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementViewController.h" />
<source-file src="src/ios/EngagementSDK/libengagement.a" framework="true" />
<header-file src="src/ios/EngagementReach/Headers/AE_TBXML.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAutorotateView.h" />
<header-file src="src/ios/EngagementReach/Headers/AEContentViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultNotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEInteractiveContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotificationView.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAbstractAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPush.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPushDelegate.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachModule.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachNotifAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPoll.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPollQuestion.h" />
<header-file src="src/ios/EngagementReach/Headers/AEViewControllerUtil.h" />
<header-file src="src/ios/EngagementReach/Headers/AEWebAnnouncementJsBridge.h" />
<resource-file src="src/ios/EngagementReach/res/close.png" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultAnnouncementView.xib" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultPollView.xib" />
<resource-file src="src/ios/EngagementReach/res/AENotificationView.xib" />
<source-file src="src/ios/EngagementReach/libreach.a" framework="true" />
<framework src="SystemConfiguration.framework" />
<framework src="CoreTelephony.framework" />
<framework src="CFNetwork.framework" />
<framework src="CoreLocation.framework" />
<framework src="AdSupport.framework" />
<framework src="libxml2.dylib" />
</platform>
</plugin>

Просмотреть файл

@ -1,260 +1,262 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-ms-azme" version="1.0.4">
<name>Cordova plugin for AZME</name>
<description>Cordova plugin for Azure Mobile Engagement</description>
<keywords>cordova,azme</keywords>
<author>Olivier Goguel</author>
<license>Apache 2.0</license>
<js-module src="www/AZME.js" name="AZME">
<clobbers target="AZME" />
</js-module>
<!-- android -->
<platform name="android">
<preference name="AZME_ANDROID_GOOGLE_PROJECT_NUMBER" />
<preference name="AZME_ANDROID_APPID" />
<preference name="AZME_ANDROID_COLLECTION" />
<preference name="AZME_ANDROID_SDKKEY" />
<preference name="AZME_ANDROID_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="res/xml/config.xml" parent="plugins">
<feature name="AZME">
<param name="android-package" value="com.del7a.azme.AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="engagement:appId" android:value="$AZME_ANDROID_APPID"/>
<meta-data android:name="engagement:collection" android:value="$AZME_ANDROID_COLLECTION"/>
<meta-data android:name="engagement:sdkKey" android:value="$AZME_ANDROID_SDKKEY"/>
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<!-- If only 1 sender, don't forget the \n, otherwise it will be parsed as a negative number... -->
<meta-data android:name="engagement:gcm:sender" android:value="$AZME_ANDROID_GOOGLE_PROJECT_NUMBER\n" />
<service
android:name="com.microsoft.azure.engagement.service.EngagementService"
android:exported="false"
android:label="$PACKAGE_NAME-Service"
android:process=":Engagement"/>
<meta-data android:name="engagement:log:test" android:value="$AZME_ENABLE_LOG" />
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementTextAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementWebAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/html" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementPollActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.POLL"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.microsoft.azure.engagement.reach.EngagementReachReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.AGENT_CREATED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.MESSAGE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ACTION_NOTIFICATION"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.EXIT_NOTIFICATION"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.DOWNLOAD_TIMEOUT"/>
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMEnabler"
android:exported="false">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.intent.action.APPID_GOT" />
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</receiver>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="$AZME_REDIRECT_URL" />
</intent-filter>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" />
<permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
</config-file>
<source-file src="src/android/AZME.java" target-dir="src/com/del7a/azme" />
<source-file src="src/android/EngagementSDK/mobile-engagement-3.0.0.jar" target-dir="libs"/>
<source-file src="src/android/libs/android-support-v4.jar" target-dir="libs"/>
<source-file src="src/android/EngagementSDK/res/drawable/engagement_close.png" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/drawable/engagement_content_title.xml" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_button_bar.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_content_title.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_area.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_overlay.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_choice.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_question.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_text_announcement.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_web_announcement.xml" target-dir="res/layout" />
</platform>
<!-- ios -->
<platform name="ios">
<preference name="AZME_IOS_COLLECTION" />
<preference name="AZME_IOS_SDKKEY" />
<preference name="AZME_IOS_APPID" />
<preference name="AZME_IOS_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="config.xml" parent="/*">
<feature name="AZME">
<param name="ios-package" value="AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_COLLECTION">
<string>$AZME_IOS_COLLECTION</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_SDKKEY">
<string>$AZME_IOS_SDKKEY</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_APPID">
<string>$AZME_IOS_APPID</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_REACH_ICON">
<string>$AZME_IOS_REACH_ICON</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_ENABLE_LOG">
<string>$AZME_ENABLE_LOG</string>
</config-file>
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>$PACKAGE_NAME.redirect</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$AZME_REDIRECT_URL</string>
</array>
</dict>
</array>
</config-file >
<header-file src="src/ios/AZME.h" />
<source-file src="src/ios/AZME.m" />
<header-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.h" />
<source-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.m" />
<header-file src="src/ios/EngagementSDK/Headers/AEModule.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushMessage.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushDelegate.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEStorage.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementAgent.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementTableViewController.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementViewController.h" />
<source-file src="src/ios/EngagementSDK/libengagement.a" framework="true" />
<header-file src="src/ios/EngagementReach/Headers/AE_TBXML.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAutorotateView.h" />
<header-file src="src/ios/EngagementReach/Headers/AEContentViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultNotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEInteractiveContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotificationView.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAbstractAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPush.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPushDelegate.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachModule.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachNotifAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPoll.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPollQuestion.h" />
<header-file src="src/ios/EngagementReach/Headers/AEViewControllerUtil.h" />
<header-file src="src/ios/EngagementReach/Headers/AEWebAnnouncementJsBridge.h" />
<resource-file src="src/ios/EngagementReach/res/close.png" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultAnnouncementView.xib" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultPollView.xib" />
<resource-file src="src/ios/EngagementReach/res/AENotificationView.xib" />
<source-file src="src/ios/EngagementReach/libreach.a" framework="true" />
<framework src="SystemConfiguration.framework" />
<framework src="CoreTelephony.framework" />
<framework src="CFNetwork.framework" />
<framework src="CoreLocation.framework" />
<framework src="AdSupport.framework" />
<framework src="libxml2.dylib" />
</platform>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-ms-azme" version="1.0.0">
<name>Cordova plugin for AZME</name>
<description>Cordova plugin for Azure Mobile Engagement</description>
<keywords>cordova,azme</keywords>
<author>Olivier Goguel</author>
<license>MIT</license>
<js-module src="www/AZME.js" name="AZME">
<clobbers target="AZME" />
</js-module>
<!-- android -->
<platform name="android">
<preference name="AZME_ANDROID_GOOGLE_PROJECT_NUMBER" />
<preference name="AZME_ANDROID_APPID" />
<preference name="AZME_ANDROID_COLLECTION" />
<preference name="AZME_ANDROID_SDKKEY" />
<preference name="AZME_ANDROID_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="res/xml/config.xml" parent="plugins">
<feature name="AZME">
<param name="android-package" value="com.del7a.azme.AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="engagement:appId" android:value="$AZME_ANDROID_APPID"/>
<meta-data android:name="engagement:collection" android:value="$AZME_ANDROID_COLLECTION"/>
<meta-data android:name="engagement:sdkKey" android:value="$AZME_ANDROID_SDKKEY"/>
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<!-- If only 1 sender, don't forget the \n, otherwise it will be parsed as a negative number... -->
<meta-data android:name="engagement:gcm:sender" android:value="$AZME_ANDROID_GOOGLE_PROJECT_NUMBER\n" />
<service
android:name="com.microsoft.azure.engagement.service.EngagementService"
android:exported="false"
android:label="$PACKAGE_NAME-Service"
android:process=":Engagement"/>
<meta-data android:name="engagement:log:test" android:value="$AZME_ENABLE_LOG" />
<meta-data android:name="engagement:reach:notification:icon" android:value="$AZME_ANDROID_REACH_ICON" />
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementTextAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementWebAnnouncementActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ANNOUNCEMENT"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/html" />
</intent-filter>
</activity>
<activity android:name="com.microsoft.azure.engagement.reach.activity.EngagementPollActivity" android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.POLL"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.microsoft.azure.engagement.reach.EngagementReachReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.AGENT_CREATED"/>
<action android:name="com.microsoft.azure.engagement.intent.action.MESSAGE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.ACTION_NOTIFICATION"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.EXIT_NOTIFICATION"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
<action android:name="com.microsoft.azure.engagement.reach.intent.action.DOWNLOAD_TIMEOUT"/>
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMEnabler"
android:exported="false">
<intent-filter>
<action android:name="com.microsoft.azure.engagement.intent.action.APPID_GOT" />
</intent-filter>
</receiver>
<receiver android:name="com.microsoft.azure.engagement.gcm.EngagementGCMReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</receiver>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="$AZME_REDIRECT_URL" />
</intent-filter>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" />
<permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
</config-file>
<source-file src="src/android/AZME.java" target-dir="src/com/del7a/azme" />
<source-file src="src/android/EngagementSDK/mobile-engagement-3.0.0.jar" target-dir="libs"/>
<source-file src="src/android/libs/android-support-v4.jar" target-dir="libs"/>
<source-file src="src/android/EngagementSDK/res/drawable/engagement_close.png" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/drawable/engagement_content_title.xml" target-dir="res/drawable" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_button_bar.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_content_title.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_area.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_notification_overlay.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_choice.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll_question.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_poll.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_text_announcement.xml" target-dir="res/layout" />
<source-file src="src/android/EngagementSDK/res/layout/engagement_web_announcement.xml" target-dir="res/layout" />
</platform>
<!-- ios -->
<platform name="ios">
<preference name="AZME_IOS_COLLECTION" />
<preference name="AZME_IOS_SDKKEY" />
<preference name="AZME_IOS_APPID" />
<preference name="AZME_IOS_REACH_ICON" />
<preference name="AZME_REDIRECT_URL" />
<preference name="AZME_ENABLE_LOG" />
<config-file target="config.xml" parent="/*">
<feature name="AZME">
<param name="ios-package" value="AZME" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_COLLECTION">
<string>$AZME_IOS_COLLECTION</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_SDKKEY">
<string>$AZME_IOS_SDKKEY</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_APPID">
<string>$AZME_IOS_APPID</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_IOS_REACH_ICON">
<string>$AZME_IOS_REACH_ICON</string>
</config-file>
<config-file target="*-Info.plist" parent="AZME_ENABLE_LOG">
<string>$AZME_ENABLE_LOG</string>
</config-file>
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>$PACKAGE_NAME.redirect</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$AZME_REDIRECT_URL</string>
</array>
</dict>
</array>
</config-file >
<header-file src="src/ios/AZME.h" />
<source-file src="src/ios/AZME.m" />
<header-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.h" />
<source-file src="src/ios/EngagementSDK/Classes/AEIdfaProvider.m" />
<header-file src="src/ios/EngagementSDK/Headers/AEModule.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushMessage.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEPushDelegate.h" />
<header-file src="src/ios/EngagementSDK/Headers/AEStorage.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementAgent.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementTableViewController.h" />
<header-file src="src/ios/EngagementSDK/Headers/EngagementViewController.h" />
<source-file src="src/ios/EngagementSDK/libengagement.a" framework="true" />
<header-file src="src/ios/EngagementReach/Headers/AE_TBXML.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEAutorotateView.h" />
<header-file src="src/ios/EngagementReach/Headers/AEContentViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultAnnouncementViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultNotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEDefaultPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEInteractiveContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotificationView.h" />
<header-file src="src/ios/EngagementReach/Headers/AENotifier.h" />
<header-file src="src/ios/EngagementReach/Headers/AEPollViewController.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAbstractAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachContent.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPush.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachDataPushDelegate.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachModule.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachNotifAnnouncement.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPoll.h" />
<header-file src="src/ios/EngagementReach/Headers/AEReachPollQuestion.h" />
<header-file src="src/ios/EngagementReach/Headers/AEViewControllerUtil.h" />
<header-file src="src/ios/EngagementReach/Headers/AEWebAnnouncementJsBridge.h" />
<resource-file src="src/ios/EngagementReach/res/close.png" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultAnnouncementView.xib" />
<resource-file src="src/ios/EngagementReach/res/AEDefaultPollView.xib" />
<resource-file src="src/ios/EngagementReach/res/AENotificationView.xib" />
<source-file src="src/ios/EngagementReach/libreach.a" framework="true" />
<framework src="SystemConfiguration.framework" />
<framework src="CoreTelephony.framework" />
<framework src="CFNetwork.framework" />
<framework src="CoreLocation.framework" />
<framework src="AdSupport.framework" />
<framework src="libxml2.dylib" />
</platform>
</plugin>

Просмотреть файл

@ -1,255 +1,255 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
package com.del7a.azme;
import java.util.Iterator;
import android.content.Context;
import android.content.Intent;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaActivity;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import com.microsoft.azure.engagement.EngagementConfiguration;
import com.microsoft.azure.engagement.EngagementAgent;
import com.microsoft.azure.engagement.EngagementAgentUtils;
public class AZME extends CordovaPlugin {
private CordovaInterface cordova;
private String previousActivityName = null;
private String lastRedirect = null;
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
package com.del7a.azme;
import java.util.Iterator;
import android.content.Context;
import android.content.Intent;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaActivity;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import com.microsoft.azure.engagement.EngagementConfiguration;
import com.microsoft.azure.engagement.EngagementAgent;
import com.microsoft.azure.engagement.EngagementAgentUtils;
public class AZME extends CordovaPlugin {
private CordovaInterface cordova;
private String previousActivityName = null;
private String lastRedirect = null;
private final String pluginVersion = "1.0.0";
public void initialize(CordovaInterface _cordova, CordovaWebView webView) {
CordovaActivity activity = (CordovaActivity) _cordova.getActivity();
final String invokeString = activity.getIntent().getDataString();
if(invokeString != "" && invokeString != null)
{
lastRedirect = invokeString;
System.out.println("Preparing Redirect to "+lastRedirect);
}
super.initialize(_cordova, webView);
cordova = _cordova;
try {
ApplicationInfo ai = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String appId = bundle.getString("engagement:appId");
String sdkKey = bundle.getString("engagement:sdkKey");
String collection = bundle.getString("engagement:collection");
// EngagementAgent.getInstance(activity).setEnabled(true);
EngagementConfiguration engagementConfiguration = new EngagementConfiguration();
engagementConfiguration.setConnectionString("Endpoint="+collection+";AppId="+appId+";SdkKey="+sdkKey);
EngagementAgent.getInstance(activity).init(engagementConfiguration);
Bundle b = new Bundle();
b.putString("CDVAZMEVersion",pluginVersion);
EngagementAgent.getInstance(activity).sendAppInfo( b);
} catch (PackageManager.NameNotFoundException e) {
System.err.println("Failed to load meta-data, NameNotFound: " + e.getMessage());
} catch (NullPointerException e) {
System.err.println("Failed to load meta-data, NullPointer: " + e.getMessage());
}
}
private Bundle stringToBundle(String _param)
{
JSONObject jObj;
try {
jObj = new JSONObject(_param);
Bundle b = new Bundle();
@SuppressWarnings("unchecked")
Iterator<String> keys = jObj.keys();
while(keys.hasNext()){
String key = keys.next();
String val = jObj.getString(key);
b.putString(key, val);
}
return b;
} catch (JSONException e) {
return null;
}
}
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
if (action.equals("checkRedirect")) {
callbackContext.success(lastRedirect);
lastRedirect=null;
return true;
}
if (action.equals("getStatus")) {
final CallbackContext cb = callbackContext;
EngagementAgent.getInstance(cordova.getActivity()).getDeviceId(new EngagementAgent.Callback<String>()
{
@Override
public void onResult(String deviceId)
{
System.out.println("Got my device id:" + deviceId);
JSONObject j;
String response = "{";
response = "{"+
"\"pluginVersion\": \""+pluginVersion+"\","+
"\"AZMEVersion\": \"2.4.1\","+
"\"deviceId\": \""+deviceId+"\""+
"}";
try {
cb.success(new JSONObject(response));
} catch (JSONException e) {
e.printStackTrace();
cb.error("could not retrieve status");
}
}
});
return true;
}
else
if (action.equals("startActivity")) {
String activityName;
try {
activityName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for startActivity");
return true;
}
previousActivityName = activityName;
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), activityName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for startActivity");
}
return true;
}
else
if (action.equals("endActivity")) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
previousActivityName= null;
callbackContext.success();
return true;
}
else
if (action.equals("sendEvent")) {
String eventName;
try {
eventName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendEvent");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendEvent(eventName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendEvent");
}
return true;
}
else
if (action.equals("startJob")) {
String jobName;
try {
jobName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for start Job");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).startJob(jobName, b);
}
catch (JSONException e) {
callbackContext.error("invalid args for start Job");
}
return true;
}
else
if (action.equals("endJob")) {
String jobName;
try {
jobName = args.getString(0);
EngagementAgent.getInstance(cordova.getActivity()).endJob(jobName );
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for end Job");
}
return true;
}
else
if (action.equals("sendAppInfo")) {
String param;
try {
param = args.getString(0);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendAppInfo");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendAppInfo( b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendAppInfo");
}
return true;
}
else
if (action.equals("registerForPushNotification")) {
// does nothing on Android
callbackContext.success();
return true;
}
callbackContext.error("unrecognized command :"+action);
return false;
}
public void onPause(boolean multitasking) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
}
public void onResume(boolean multitasking) {
if (previousActivityName!=null)
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), previousActivityName, null);
}
}
public void initialize(CordovaInterface _cordova, CordovaWebView webView) {
CordovaActivity activity = (CordovaActivity) _cordova.getActivity();
final String invokeString = activity.getIntent().getDataString();
if(invokeString != "" && invokeString != null)
{
lastRedirect = invokeString;
System.out.println("Preparing Redirect to "+lastRedirect);
}
super.initialize(_cordova, webView);
cordova = _cordova;
try {
ApplicationInfo ai = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String appId = bundle.getString("engagement:appId");
String sdkKey = bundle.getString("engagement:sdkKey");
String collection = bundle.getString("engagement:collection");
// EngagementAgent.getInstance(activity).setEnabled(true);
EngagementConfiguration engagementConfiguration = new EngagementConfiguration();
engagementConfiguration.setConnectionString("Endpoint="+collection+";AppId="+appId+";SdkKey="+sdkKey);
EngagementAgent.getInstance(activity).init(engagementConfiguration);
Bundle b = new Bundle();
b.putString("CDVAZMEVersion",pluginVersion);
EngagementAgent.getInstance(activity).sendAppInfo( b);
} catch (PackageManager.NameNotFoundException e) {
System.err.println("Failed to load meta-data, NameNotFound: " + e.getMessage());
} catch (NullPointerException e) {
System.err.println("Failed to load meta-data, NullPointer: " + e.getMessage());
}
}
private Bundle stringToBundle(String _param)
{
JSONObject jObj;
try {
jObj = new JSONObject(_param);
Bundle b = new Bundle();
@SuppressWarnings("unchecked")
Iterator<String> keys = jObj.keys();
while(keys.hasNext()){
String key = keys.next();
String val = jObj.getString(key);
b.putString(key, val);
}
return b;
} catch (JSONException e) {
return null;
}
}
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
if (action.equals("checkRedirect")) {
callbackContext.success(lastRedirect);
lastRedirect=null;
return true;
}
if (action.equals("getStatus")) {
final CallbackContext cb = callbackContext;
EngagementAgent.getInstance(cordova.getActivity()).getDeviceId(new EngagementAgent.Callback<String>()
{
@Override
public void onResult(String deviceId)
{
System.out.println("Got my device id:" + deviceId);
JSONObject j;
String response = "{";
response = "{"+
"\"pluginVersion\": \""+pluginVersion+"\","+
"\"AZMEVersion\": \"3.0.0\","+
"\"deviceId\": \""+deviceId+"\""+
"}";
try {
cb.success(new JSONObject(response));
} catch (JSONException e) {
e.printStackTrace();
cb.error("could not retrieve status");
}
}
});
return true;
}
else
if (action.equals("startActivity")) {
String activityName;
try {
activityName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for startActivity");
return true;
}
previousActivityName = activityName;
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), activityName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for startActivity");
}
return true;
}
else
if (action.equals("endActivity")) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
previousActivityName= null;
callbackContext.success();
return true;
}
else
if (action.equals("sendEvent")) {
String eventName;
try {
eventName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendEvent");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendEvent(eventName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendEvent");
}
return true;
}
else
if (action.equals("startJob")) {
String jobName;
try {
jobName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for start Job");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).startJob(jobName, b);
}
catch (JSONException e) {
callbackContext.error("invalid args for start Job");
}
return true;
}
else
if (action.equals("endJob")) {
String jobName;
try {
jobName = args.getString(0);
EngagementAgent.getInstance(cordova.getActivity()).endJob(jobName );
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for end Job");
}
return true;
}
else
if (action.equals("sendAppInfo")) {
String param;
try {
param = args.getString(0);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendAppInfo");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendAppInfo( b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendAppInfo");
}
return true;
}
else
if (action.equals("registerForPushNotification")) {
// does nothing on Android
callbackContext.success();
return true;
}
callbackContext.error("unrecognized command :"+action);
return false;
}
public void onPause(boolean multitasking) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
}
public void onResume(boolean multitasking) {
if (previousActivityName!=null)
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), previousActivityName, null);
}
}

Просмотреть файл

@ -1,255 +1,255 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
package com.del7a.azme;
import java.util.Iterator;
import android.content.Context;
import android.content.Intent;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaActivity;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import com.microsoft.azure.engagement.EngagementConfiguration;
import com.microsoft.azure.engagement.EngagementAgent;
import com.microsoft.azure.engagement.EngagementAgentUtils;
public class AZME extends CordovaPlugin {
private CordovaInterface cordova;
private String previousActivityName = null;
private String lastRedirect = null;
private final String pluginVersion = "1.0.4";
public void initialize(CordovaInterface _cordova, CordovaWebView webView) {
CordovaActivity activity = (CordovaActivity) _cordova.getActivity();
final String invokeString = activity.getIntent().getDataString();
if(invokeString != "" && invokeString != null)
{
lastRedirect = invokeString;
System.out.println("Preparing Redirect to "+lastRedirect);
}
super.initialize(_cordova, webView);
cordova = _cordova;
try {
ApplicationInfo ai = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String appId = bundle.getString("engagement:appId");
String sdkKey = bundle.getString("engagement:sdkKey");
String collection = bundle.getString("engagement:collection");
// EngagementAgent.getInstance(activity).setEnabled(true);
EngagementConfiguration engagementConfiguration = new EngagementConfiguration();
engagementConfiguration.setConnectionString("Endpoint="+collection+";AppId="+appId+";SdkKey="+sdkKey);
EngagementAgent.getInstance(activity).init(engagementConfiguration);
Bundle b = new Bundle();
b.putString("CDVAZMEVersion",pluginVersion);
EngagementAgent.getInstance(activity).sendAppInfo( b);
} catch (PackageManager.NameNotFoundException e) {
System.err.println("Failed to load meta-data, NameNotFound: " + e.getMessage());
} catch (NullPointerException e) {
System.err.println("Failed to load meta-data, NullPointer: " + e.getMessage());
}
}
private Bundle stringToBundle(String _param)
{
JSONObject jObj;
try {
jObj = new JSONObject(_param);
Bundle b = new Bundle();
@SuppressWarnings("unchecked")
Iterator<String> keys = jObj.keys();
while(keys.hasNext()){
String key = keys.next();
String val = jObj.getString(key);
b.putString(key, val);
}
return b;
} catch (JSONException e) {
return null;
}
}
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
if (action.equals("checkRedirect")) {
callbackContext.success(lastRedirect);
lastRedirect=null;
return true;
}
if (action.equals("getStatus")) {
final CallbackContext cb = callbackContext;
EngagementAgent.getInstance(cordova.getActivity()).getDeviceId(new EngagementAgent.Callback<String>()
{
@Override
public void onResult(String deviceId)
{
System.out.println("Got my device id:" + deviceId);
JSONObject j;
String response = "{";
response = "{"+
"\"pluginVersion\": \""+pluginVersion+"\","+
"\"AZMEVersion\": \"2.4.1\","+
"\"deviceId\": \""+deviceId+"\""+
"}";
try {
cb.success(new JSONObject(response));
} catch (JSONException e) {
e.printStackTrace();
cb.error("could not retrieve status");
}
}
});
return true;
}
else
if (action.equals("startActivity")) {
String activityName;
try {
activityName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for startActivity");
return true;
}
previousActivityName = activityName;
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), activityName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for startActivity");
}
return true;
}
else
if (action.equals("endActivity")) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
previousActivityName= null;
callbackContext.success();
return true;
}
else
if (action.equals("sendEvent")) {
String eventName;
try {
eventName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendEvent");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendEvent(eventName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendEvent");
}
return true;
}
else
if (action.equals("startJob")) {
String jobName;
try {
jobName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for start Job");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).startJob(jobName, b);
}
catch (JSONException e) {
callbackContext.error("invalid args for start Job");
}
return true;
}
else
if (action.equals("endJob")) {
String jobName;
try {
jobName = args.getString(0);
EngagementAgent.getInstance(cordova.getActivity()).endJob(jobName );
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for end Job");
}
return true;
}
else
if (action.equals("sendAppInfo")) {
String param;
try {
param = args.getString(0);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendAppInfo");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendAppInfo( b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendAppInfo");
}
return true;
}
else
if (action.equals("registerForPushNotification")) {
// does nothing on Android
callbackContext.success();
return true;
}
callbackContext.error("unrecognized command :"+action);
return false;
}
public void onPause(boolean multitasking) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
}
public void onResume(boolean multitasking) {
if (previousActivityName!=null)
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), previousActivityName, null);
}
}
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
package com.del7a.azme;
import java.util.Iterator;
import android.content.Context;
import android.content.Intent;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaActivity;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import com.microsoft.azure.engagement.EngagementConfiguration;
import com.microsoft.azure.engagement.EngagementAgent;
import com.microsoft.azure.engagement.EngagementAgentUtils;
public class AZME extends CordovaPlugin {
private CordovaInterface cordova;
private String previousActivityName = null;
private String lastRedirect = null;
private final String pluginVersion = "1.0.0";
public void initialize(CordovaInterface _cordova, CordovaWebView webView) {
CordovaActivity activity = (CordovaActivity) _cordova.getActivity();
final String invokeString = activity.getIntent().getDataString();
if(invokeString != "" && invokeString != null)
{
lastRedirect = invokeString;
System.out.println("Preparing Redirect to "+lastRedirect);
}
super.initialize(_cordova, webView);
cordova = _cordova;
try {
ApplicationInfo ai = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String appId = bundle.getString("engagement:appId");
String sdkKey = bundle.getString("engagement:sdkKey");
String collection = bundle.getString("engagement:collection");
// EngagementAgent.getInstance(activity).setEnabled(true);
EngagementConfiguration engagementConfiguration = new EngagementConfiguration();
engagementConfiguration.setConnectionString("Endpoint="+collection+";AppId="+appId+";SdkKey="+sdkKey);
EngagementAgent.getInstance(activity).init(engagementConfiguration);
Bundle b = new Bundle();
b.putString("CDVAZMEVersion",pluginVersion);
EngagementAgent.getInstance(activity).sendAppInfo( b);
} catch (PackageManager.NameNotFoundException e) {
System.err.println("Failed to load meta-data, NameNotFound: " + e.getMessage());
} catch (NullPointerException e) {
System.err.println("Failed to load meta-data, NullPointer: " + e.getMessage());
}
}
private Bundle stringToBundle(String _param)
{
JSONObject jObj;
try {
jObj = new JSONObject(_param);
Bundle b = new Bundle();
@SuppressWarnings("unchecked")
Iterator<String> keys = jObj.keys();
while(keys.hasNext()){
String key = keys.next();
String val = jObj.getString(key);
b.putString(key, val);
}
return b;
} catch (JSONException e) {
return null;
}
}
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
if (action.equals("checkRedirect")) {
callbackContext.success(lastRedirect);
lastRedirect=null;
return true;
}
if (action.equals("getStatus")) {
final CallbackContext cb = callbackContext;
EngagementAgent.getInstance(cordova.getActivity()).getDeviceId(new EngagementAgent.Callback<String>()
{
@Override
public void onResult(String deviceId)
{
System.out.println("Got my device id:" + deviceId);
JSONObject j;
String response = "{";
response = "{"+
"\"pluginVersion\": \""+pluginVersion+"\","+
"\"AZMEVersion\": \"3.0.0\","+
"\"deviceId\": \""+deviceId+"\""+
"}";
try {
cb.success(new JSONObject(response));
} catch (JSONException e) {
e.printStackTrace();
cb.error("could not retrieve status");
}
}
});
return true;
}
else
if (action.equals("startActivity")) {
String activityName;
try {
activityName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for startActivity");
return true;
}
previousActivityName = activityName;
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), activityName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for startActivity");
}
return true;
}
else
if (action.equals("endActivity")) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
previousActivityName= null;
callbackContext.success();
return true;
}
else
if (action.equals("sendEvent")) {
String eventName;
try {
eventName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendEvent");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendEvent(eventName, b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendEvent");
}
return true;
}
else
if (action.equals("startJob")) {
String jobName;
try {
jobName = args.getString(0);
String param = args.getString(1);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for start Job");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).startJob(jobName, b);
}
catch (JSONException e) {
callbackContext.error("invalid args for start Job");
}
return true;
}
else
if (action.equals("endJob")) {
String jobName;
try {
jobName = args.getString(0);
EngagementAgent.getInstance(cordova.getActivity()).endJob(jobName );
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for end Job");
}
return true;
}
else
if (action.equals("sendAppInfo")) {
String param;
try {
param = args.getString(0);
Bundle b = stringToBundle(param);
if (b==null)
{
callbackContext.error("invalid param for sendAppInfo");
return true;
}
EngagementAgent.getInstance(cordova.getActivity()).sendAppInfo( b);
callbackContext.success();
} catch (JSONException e) {
callbackContext.error("invalid args for sendAppInfo");
}
return true;
}
else
if (action.equals("registerForPushNotification")) {
// does nothing on Android
callbackContext.success();
return true;
}
callbackContext.error("unrecognized command :"+action);
return false;
}
public void onPause(boolean multitasking) {
EngagementAgent.getInstance(cordova.getActivity()).endActivity();
}
public void onResume(boolean multitasking) {
if (previousActivityName!=null)
EngagementAgent.getInstance(cordova.getActivity()).startActivity(cordova.getActivity(), previousActivityName, null);
}
}

Просмотреть файл

@ -1,41 +1,41 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
#import <UIKit/UIKit.h>
#import <Cordova/CDVPlugin.h>
#import "AZME.h"
#import "EngagementAgent.h"
#import "AEPushDelegate.h"
#import "AppDelegate.h"
#import "AEReachModule.h"
@interface AppDelegate (AZME)
- (void)application:(UIApplication *)application customdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
- (void)application:(UIApplication *)application customdidFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
- (void)application:(UIApplication *)application customdidReceiveRemoteNotification:(NSDictionary *)userInfo;
@end
@interface AZME : CDVPlugin <AEPushDelegate>
{
NSString* AZME_IOS_SDKKEY ;
NSString* AZME_IOS_APPID ;
NSString* AZME_IOS_COLLECTION ;
NSString* AZME_IOS_REACH_ICON;
BOOL enableLog;
}
- (void)startActivity:(CDVInvokedUrlCommand*)command;
- (void)endActivity:(CDVInvokedUrlCommand*)command;
- (void)sendAppInfo:(CDVInvokedUrlCommand*)command;
- (void)sendEvent:(CDVInvokedUrlCommand*)command;
- (void)startJob:(CDVInvokedUrlCommand*)command;
- (void)endJob:(CDVInvokedUrlCommand*)command;
- (void)checkRedirect:(CDVInvokedUrlCommand*)command;
- (void)getStatus:(CDVInvokedUrlCommand*)command;
- (void)handleOpenURL:(NSNotification*)notification;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
#import <UIKit/UIKit.h>
#import <Cordova/CDVPlugin.h>
#import "AZME.h"
#import "EngagementAgent.h"
#import "AEPushDelegate.h"
#import "AppDelegate.h"
#import "AEReachModule.h"
@interface AppDelegate (AZME)
- (void)application:(UIApplication *)application customdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
- (void)application:(UIApplication *)application customdidFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
- (void)application:(UIApplication *)application customdidReceiveRemoteNotification:(NSDictionary *)userInfo;
@end
@interface AZME : CDVPlugin <AEPushDelegate>
{
NSString* AZME_IOS_SDKKEY ;
NSString* AZME_IOS_APPID ;
NSString* AZME_IOS_COLLECTION ;
NSString* AZME_IOS_REACH_ICON;
BOOL enableLog;
}
- (void)startActivity:(CDVInvokedUrlCommand*)command;
- (void)endActivity:(CDVInvokedUrlCommand*)command;
- (void)sendAppInfo:(CDVInvokedUrlCommand*)command;
- (void)sendEvent:(CDVInvokedUrlCommand*)command;
- (void)startJob:(CDVInvokedUrlCommand*)command;
- (void)endJob:(CDVInvokedUrlCommand*)command;
- (void)checkRedirect:(CDVInvokedUrlCommand*)command;
- (void)getStatus:(CDVInvokedUrlCommand*)command;
- (void)handleOpenURL:(NSNotification*)notification;
@end

Просмотреть файл

@ -1,259 +1,259 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
#include <sys/types.h>
#include <sys/sysctl.h>
#include "AZME.h"
#import <Cordova/CDV.h>
#import <objc/runtime.h>
#import <objc/message.h>
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
#include <sys/types.h>
#include <sys/sysctl.h>
#include "AZME.h"
#import <Cordova/CDV.h>
#import <objc/runtime.h>
#import <objc/message.h>
#define AZME_PLUGIN_VERSION "1.0.0"
@implementation AppDelegate(AZME)
- (void)application:(UIApplication *)application customdidFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"didFailToRegisterForRemoteNotificationsWithError %@",error);
}
- (void)application:(UIApplication *)application customdidReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSLog(@"customdidReceiveRemoteNotification");
[[EngagementAgent shared] applicationDidReceiveRemoteNotification:userInfo];
}
- (void)application:(UIApplication *)application customdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[[EngagementAgent shared] registerDeviceToken:deviceToken];
}
// Use swizzling
// http://stackoverflow.com/questions/1085479/override-a-method-via-objc-category-and-call-the-default-implementation
void MethodSwizzle(Class c, SEL orig, SEL new) {
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
else
method_exchangeImplementations(origMethod, newMethod);
}
+(void) load
{
MethodSwizzle(self,
@selector(application:customdidFailToRegisterForRemoteNotificationsWithError:),
@selector(application:didFailToRegisterForRemoteNotificationsWithError:) );
MethodSwizzle(self,
@selector(application:customdidReceiveRemoteNotification:),
@selector(application:didReceiveRemoteNotification:) );
MethodSwizzle(self,
@selector(application:customdidRegisterForRemoteNotificationsWithDeviceToken:),
@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:) );
}
@end
@implementation AZME
- (void)pluginInitialize
{
enableLog = false;
AZME_IOS_SDKKEY = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_SDKKEY"];
AZME_IOS_APPID = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_APPID"];
AZME_IOS_COLLECTION = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_COLLECTION"];
AZME_IOS_REACH_ICON = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_REACH_ICON"];
NSString* str = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_ENABLE_LOG"];
if ([str compare:@"1"] == NSOrderedSame || [str caseInsensitiveCompare:@"true"] == NSOrderedSame )
enableLog = true;
if (AZME_IOS_SDKKEY.length!=0 && AZME_IOS_APPID.length!=0 && AZME_IOS_COLLECTION.length!=0)
{
NSLog(@"Initializing AZME for AppId:%@",AZME_IOS_APPID);
@try {
AEReachModule* reach = nil;
if (AZME_IOS_REACH_ICON.length>0)
{
NSLog(@"Preparing Reach with Icon :%@",AZME_IOS_REACH_ICON);
reach = [AEReachModule moduleWithNotificationIcon:[UIImage imageNamed:AZME_IOS_REACH_ICON]];
[reach setAutoBadgeEnabled:YES];
}
NSString* endPoint = [NSString stringWithFormat:@"Endpoint=%@;SdkKey=%@;AppId=%@",AZME_IOS_COLLECTION,AZME_IOS_SDKKEY,AZME_IOS_APPID];
[EngagementAgent init:endPoint modules:reach, nil];
if (reach !=nil )
[[EngagementAgent shared] setPushDelegate:self];
if (enableLog)
[EngagementAgent setTestLogEnabled:YES];
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION], @"CDVAZMEVersion", nil];
[[EngagementAgent shared] sendAppInfo:dict];
}
@catch (NSException * e) {
NSLog(@"**** FAILED TO INITIALIZE AZME ***, Exception: %@", e);
}
}
else
NSLog(@"*** AZME_IOS_APPID, AZME_IOS_SDKKEY or AZME_IOS_COLLECTION not set");
}
- (void)startActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startActivity:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
[[EngagementAgent shared] endActivity];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendEvent:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendEvent:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)startJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startJob:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
[[EngagementAgent shared] endJob:name];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendAppInfo:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *param = [command.arguments objectAtIndex:0];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendAppInfo:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)getStatus:(CDVInvokedUrlCommand*)command
{
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION],@"pluginVersion",
@"2.1.0",@"AZMEVersion", // à récuperer du SDK!
[[EngagementAgent shared] deviceId],@"deviceId",
nil];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
// CheckRedirect does nothing on iOS
- (void)checkRedirect:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil ];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)handleOpenURL:(NSNotification*)notification
{
NSString* url = [notification object];
NSString* jsString = [NSString stringWithFormat:@"AZME.handleOpenURL(\"%@\");", url];
[self.commandDelegate evalJs:jsString];
}
- (void)registerForPushNotification:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
if (enableLog)
NSLog(@"registerForPushNotification");
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end
@implementation AppDelegate(AZME)
- (void)application:(UIApplication *)application customdidFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"didFailToRegisterForRemoteNotificationsWithError %@",error);
}
- (void)application:(UIApplication *)application customdidReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSLog(@"customdidReceiveRemoteNotification");
[[EngagementAgent shared] applicationDidReceiveRemoteNotification:userInfo];
}
- (void)application:(UIApplication *)application customdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[[EngagementAgent shared] registerDeviceToken:deviceToken];
}
// Use swizzling
// http://stackoverflow.com/questions/1085479/override-a-method-via-objc-category-and-call-the-default-implementation
void MethodSwizzle(Class c, SEL orig, SEL new) {
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
else
method_exchangeImplementations(origMethod, newMethod);
}
+(void) load
{
MethodSwizzle(self,
@selector(application:customdidFailToRegisterForRemoteNotificationsWithError:),
@selector(application:didFailToRegisterForRemoteNotificationsWithError:) );
MethodSwizzle(self,
@selector(application:customdidReceiveRemoteNotification:),
@selector(application:didReceiveRemoteNotification:) );
MethodSwizzle(self,
@selector(application:customdidRegisterForRemoteNotificationsWithDeviceToken:),
@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:) );
}
@end
@implementation AZME
- (void)pluginInitialize
{
enableLog = false;
AZME_IOS_SDKKEY = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_SDKKEY"];
AZME_IOS_APPID = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_APPID"];
AZME_IOS_COLLECTION = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_COLLECTION"];
AZME_IOS_REACH_ICON = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_REACH_ICON"];
NSString* str = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_ENABLE_LOG"];
if ([str compare:@"1"] == NSOrderedSame || [str caseInsensitiveCompare:@"true"] == NSOrderedSame )
enableLog = true;
if (AZME_IOS_SDKKEY.length!=0 && AZME_IOS_APPID.length!=0 && AZME_IOS_COLLECTION.length!=0)
{
NSLog(@"Initializing AZME for AppId:%@",AZME_IOS_APPID);
@try {
AEReachModule* reach = nil;
if (AZME_IOS_REACH_ICON.length>0)
{
NSLog(@"Preparing Reach with Icon :%@",AZME_IOS_REACH_ICON);
reach = [AEReachModule moduleWithNotificationIcon:[UIImage imageNamed:AZME_IOS_REACH_ICON]];
[reach setAutoBadgeEnabled:YES];
}
NSString* endPoint = [NSString stringWithFormat:@"Endpoint=%@;SdkKey=%@;AppId=%@",AZME_IOS_COLLECTION,AZME_IOS_SDKKEY,AZME_IOS_APPID];
[EngagementAgent init:endPoint modules:reach, nil];
if (reach !=nil )
[[EngagementAgent shared] setPushDelegate:self];
if (enableLog)
[EngagementAgent setTestLogEnabled:YES];
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION], @"CDVAZMEVersion", nil];
[[EngagementAgent shared] sendAppInfo:dict];
}
@catch (NSException * e) {
NSLog(@"**** FAILED TO INITIALIZE AZME ***, Exception: %@", e);
}
}
else
NSLog(@"*** AZME_IOS_APPID, AZME_IOS_SDKKEY or AZME_IOS_COLLECTION not set");
}
- (void)startActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startActivity:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
[[EngagementAgent shared] endActivity];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendEvent:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendEvent:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)startJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startJob:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
[[EngagementAgent shared] endJob:name];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendAppInfo:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *param = [command.arguments objectAtIndex:0];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendAppInfo:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)getStatus:(CDVInvokedUrlCommand*)command
{
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION],@"pluginVersion",
@"2.1.0",@"AZMEVersion", // à récuperer du SDK!
[[EngagementAgent shared] deviceId],@"deviceId",
nil];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
// CheckRedirect does nothing on iOS
- (void)checkRedirect:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil ];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)handleOpenURL:(NSNotification*)notification
{
NSString* url = [notification object];
NSString* jsString = [NSString stringWithFormat:@"AZME.handleOpenURL(\"%@\");", url];
[self.commandDelegate evalJs:jsString];
}
- (void)registerForPushNotification:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
if (enableLog)
NSLog(@"registerForPushNotification");
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end

Просмотреть файл

@ -1,259 +1,259 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
#include <sys/types.h>
#include <sys/sysctl.h>
#include "AZME.h"
#import <Cordova/CDV.h>
#import <objc/runtime.h>
#import <objc/message.h>
#define AZME_PLUGIN_VERSION "1.0.4"
@implementation AppDelegate(AZME)
- (void)application:(UIApplication *)application customdidFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"didFailToRegisterForRemoteNotificationsWithError %@",error);
}
- (void)application:(UIApplication *)application customdidReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSLog(@"customdidReceiveRemoteNotification");
[[EngagementAgent shared] applicationDidReceiveRemoteNotification:userInfo];
}
- (void)application:(UIApplication *)application customdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[[EngagementAgent shared] registerDeviceToken:deviceToken];
}
// Use swizzling
// http://stackoverflow.com/questions/1085479/override-a-method-via-objc-category-and-call-the-default-implementation
void MethodSwizzle(Class c, SEL orig, SEL new) {
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
else
method_exchangeImplementations(origMethod, newMethod);
}
+(void) load
{
MethodSwizzle(self,
@selector(application:customdidFailToRegisterForRemoteNotificationsWithError:),
@selector(application:didFailToRegisterForRemoteNotificationsWithError:) );
MethodSwizzle(self,
@selector(application:customdidReceiveRemoteNotification:),
@selector(application:didReceiveRemoteNotification:) );
MethodSwizzle(self,
@selector(application:customdidRegisterForRemoteNotificationsWithDeviceToken:),
@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:) );
}
@end
@implementation AZME
- (void)pluginInitialize
{
enableLog = false;
AZME_IOS_SDKKEY = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_SDKKEY"];
AZME_IOS_APPID = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_APPID"];
AZME_IOS_COLLECTION = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_COLLECTION"];
AZME_IOS_REACH_ICON = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_REACH_ICON"];
NSString* str = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_ENABLE_LOG"];
if ([str compare:@"1"] == NSOrderedSame || [str caseInsensitiveCompare:@"true"] == NSOrderedSame )
enableLog = true;
if (AZME_IOS_SDKKEY.length!=0 && AZME_IOS_APPID.length!=0 && AZME_IOS_COLLECTION.length!=0)
{
NSLog(@"Initializing AZME for AppId:%@",AZME_IOS_APPID);
@try {
AEReachModule* reach = nil;
if (AZME_IOS_REACH_ICON.length>0)
{
NSLog(@"Preparing Reach with Icon :%@",AZME_IOS_REACH_ICON);
reach = [AEReachModule moduleWithNotificationIcon:[UIImage imageNamed:AZME_IOS_REACH_ICON]];
[reach setAutoBadgeEnabled:YES];
}
NSString* endPoint = [NSString stringWithFormat:@"Endpoint=%@;SdkKey=%@;AppId=%@",AZME_IOS_COLLECTION,AZME_IOS_SDKKEY,AZME_IOS_APPID];
[EngagementAgent init:endPoint modules:reach, nil];
if (reach !=nil )
[[EngagementAgent shared] setPushDelegate:self];
if (enableLog)
[EngagementAgent setTestLogEnabled:YES];
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION], @"CDVAZMEVersion", nil];
[[EngagementAgent shared] sendAppInfo:dict];
}
@catch (NSException * e) {
NSLog(@"**** FAILED TO INITIALIZE AZME ***, Exception: %@", e);
}
}
else
NSLog(@"*** AZME_IOS_APPID, AZME_IOS_SDKKEY or AZME_IOS_COLLECTION not set");
}
- (void)startActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startActivity:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
[[EngagementAgent shared] endActivity];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendEvent:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendEvent:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)startJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startJob:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
[[EngagementAgent shared] endJob:name];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendAppInfo:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *param = [command.arguments objectAtIndex:0];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendAppInfo:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)getStatus:(CDVInvokedUrlCommand*)command
{
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION],@"pluginVersion",
@"2.1.0",@"AZMEVersion", // à récuperer du SDK!
[[EngagementAgent shared] deviceId],@"deviceId",
nil];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
// CheckRedirect does nothing on iOS
- (void)checkRedirect:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil ];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)handleOpenURL:(NSNotification*)notification
{
NSString* url = [notification object];
NSString* jsString = [NSString stringWithFormat:@"AZME.handleOpenURL(\"%@\");", url];
[self.commandDelegate evalJs:jsString];
}
- (void)registerForPushNotification:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
if (enableLog)
NSLog(@"registerForPushNotification");
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
#include <sys/types.h>
#include <sys/sysctl.h>
#include "AZME.h"
#import <Cordova/CDV.h>
#import <objc/runtime.h>
#import <objc/message.h>
#define AZME_PLUGIN_VERSION "1.0.0"
@implementation AppDelegate(AZME)
- (void)application:(UIApplication *)application customdidFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"didFailToRegisterForRemoteNotificationsWithError %@",error);
}
- (void)application:(UIApplication *)application customdidReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSLog(@"customdidReceiveRemoteNotification");
[[EngagementAgent shared] applicationDidReceiveRemoteNotification:userInfo];
}
- (void)application:(UIApplication *)application customdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[[EngagementAgent shared] registerDeviceToken:deviceToken];
}
// Use swizzling
// http://stackoverflow.com/questions/1085479/override-a-method-via-objc-category-and-call-the-default-implementation
void MethodSwizzle(Class c, SEL orig, SEL new) {
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
else
method_exchangeImplementations(origMethod, newMethod);
}
+(void) load
{
MethodSwizzle(self,
@selector(application:customdidFailToRegisterForRemoteNotificationsWithError:),
@selector(application:didFailToRegisterForRemoteNotificationsWithError:) );
MethodSwizzle(self,
@selector(application:customdidReceiveRemoteNotification:),
@selector(application:didReceiveRemoteNotification:) );
MethodSwizzle(self,
@selector(application:customdidRegisterForRemoteNotificationsWithDeviceToken:),
@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:) );
}
@end
@implementation AZME
- (void)pluginInitialize
{
enableLog = false;
AZME_IOS_SDKKEY = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_SDKKEY"];
AZME_IOS_APPID = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_APPID"];
AZME_IOS_COLLECTION = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_COLLECTION"];
AZME_IOS_REACH_ICON = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_IOS_REACH_ICON"];
NSString* str = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AZME_ENABLE_LOG"];
if ([str compare:@"1"] == NSOrderedSame || [str caseInsensitiveCompare:@"true"] == NSOrderedSame )
enableLog = true;
if (AZME_IOS_SDKKEY.length!=0 && AZME_IOS_APPID.length!=0 && AZME_IOS_COLLECTION.length!=0)
{
NSLog(@"Initializing AZME for AppId:%@",AZME_IOS_APPID);
@try {
AEReachModule* reach = nil;
if (AZME_IOS_REACH_ICON.length>0)
{
NSLog(@"Preparing Reach with Icon :%@",AZME_IOS_REACH_ICON);
reach = [AEReachModule moduleWithNotificationIcon:[UIImage imageNamed:AZME_IOS_REACH_ICON]];
[reach setAutoBadgeEnabled:YES];
}
NSString* endPoint = [NSString stringWithFormat:@"Endpoint=%@;SdkKey=%@;AppId=%@",AZME_IOS_COLLECTION,AZME_IOS_SDKKEY,AZME_IOS_APPID];
[EngagementAgent init:endPoint modules:reach, nil];
if (reach !=nil )
[[EngagementAgent shared] setPushDelegate:self];
if (enableLog)
[EngagementAgent setTestLogEnabled:YES];
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION], @"CDVAZMEVersion", nil];
[[EngagementAgent shared] sendAppInfo:dict];
}
@catch (NSException * e) {
NSLog(@"**** FAILED TO INITIALIZE AZME ***, Exception: %@", e);
}
}
else
NSLog(@"*** AZME_IOS_APPID, AZME_IOS_SDKKEY or AZME_IOS_COLLECTION not set");
}
- (void)startActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startActivity:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endActivity:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
[[EngagementAgent shared] endActivity];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendEvent:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendEvent:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)startJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
NSString *param = [command.arguments objectAtIndex:1];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] startJob:name extras:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)endJob:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *name = [command.arguments objectAtIndex:0];
[[EngagementAgent shared] endJob:name];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)sendAppInfo:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
NSString *param = [command.arguments objectAtIndex:0];
NSDictionary *JSON ;
JSON = [NSJSONSerialization JSONObjectWithData: [param dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: nil];
[[EngagementAgent shared] sendAppInfo:JSON];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)getStatus:(CDVInvokedUrlCommand*)command
{
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithUTF8String:AZME_PLUGIN_VERSION],@"pluginVersion",
@"2.1.0",@"AZMEVersion", // à récuperer du SDK!
[[EngagementAgent shared] deviceId],@"deviceId",
nil];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
// CheckRedirect does nothing on iOS
- (void)checkRedirect:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil ];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)handleOpenURL:(NSNotification*)notification
{
NSString* url = [notification object];
NSString* jsString = [NSString stringWithFormat:@"AZME.handleOpenURL(\"%@\");", url];
[self.commandDelegate evalJs:jsString];
}
- (void)registerForPushNotification:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK ];
if (enableLog)
NSLog(@"registerForPushNotification");
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end

Просмотреть файл

@ -1,43 +1,43 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AEContentViewController.h"
#import "AEReachAnnouncement.h"
@class AEReachAnnouncement;
/**
* Abstract view controller displaying a Engagement announcement.
*
* By inheriting from this class you can create your own view controller to display announcements.
* If you plan to display Web announcements using this controller, make sure to use an object of type
* AEWebAnnouncementJsBridge
* as a delegate to your `UIWebView`.
*/
@interface AEAnnouncementViewController : AEContentViewController
/**
* Init the view controller with the given announcement.
* Subclasses should re-implement this method.
* @param anAnnouncement Announcement to display
*/
- (instancetype)initWithAnnouncement:(AEReachAnnouncement*)anAnnouncement;
/**
* Report the announcement as actioned and dismiss this view controller.
* Should be called by subclasses when the user clicks on the 'action' button associated to
* the announcement.
*/
- (void)action;
/**
* Use this property to store announcement information when the <initWithAnnouncement:>
* method is called.
* Subclasses should also read this property to init their subviews.
*/
@property(nonatomic, retain) AEReachAnnouncement* announcement;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AEContentViewController.h"
#import "AEReachAnnouncement.h"
@class AEReachAnnouncement;
/**
* Abstract view controller displaying a Engagement announcement.
*
* By inheriting from this class you can create your own view controller to display announcements.
* If you plan to display Web announcements using this controller, make sure to use an object of type
* AEWebAnnouncementJsBridge
* as a delegate to your `UIWebView`.
*/
@interface AEAnnouncementViewController : AEContentViewController
/**
* Init the view controller with the given announcement.
* Subclasses should re-implement this method.
* @param anAnnouncement Announcement to display
*/
- (instancetype)initWithAnnouncement:(AEReachAnnouncement*)anAnnouncement;
/**
* Report the announcement as actioned and dismiss this view controller.
* Should be called by subclasses when the user clicks on the 'action' button associated to
* the announcement.
*/
- (void)action;
/**
* Use this property to store announcement information when the <initWithAnnouncement:>
* method is called.
* Subclasses should also read this property to init their subviews.
*/
@property(nonatomic, retain) AEReachAnnouncement* announcement;
@end

Просмотреть файл

@ -1,38 +1,38 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* A view intended to be presented on the current application window.
*
* Inside a window, only the first subview gets rotation events. To get around this problem,
* this view listen to device orientation changes and resize + apply the proper transform on the view.
*
* This view can be used as a container to another view by using the initialization method <initWithContent:>
* or it can be used as a replacement to the `UIView` class.
*/
@interface AEAutorotateView : UIView {
@private
UIView* _view;
UIInterfaceOrientation _orientation;
}
/**
* Initialize the view by using a child content.
* This view will just be used as a wrapper to the provided view.
* @param view The view to wrap.
*/
- (id)initWithContent:(UIView*)view;
/**
* Transform to apply on the view based on the current device orientation.
* The default implementation will return an affine transformation matrix constructed from the provided orientation.<br>
* @param orientation Orientation that will be applied.
* @result The new `CGAffineTransform` to apply on this view.
*/
- (CGAffineTransform)transformForOrientation:(UIInterfaceOrientation)orientation;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* A view intended to be presented on the current application window.
*
* Inside a window, only the first subview gets rotation events. To get around this problem,
* this view listen to device orientation changes and resize + apply the proper transform on the view.
*
* This view can be used as a container to another view by using the initialization method <initWithContent:>
* or it can be used as a replacement to the `UIView` class.
*/
@interface AEAutorotateView : UIView {
@private
UIView* _view;
UIInterfaceOrientation _orientation;
}
/**
* Initialize the view by using a child content.
* This view will just be used as a wrapper to the provided view.
* @param view The view to wrap.
*/
- (id)initWithContent:(UIView*)view;
/**
* Transform to apply on the view based on the current device orientation.
* The default implementation will return an affine transformation matrix constructed from the provided orientation.<br>
* @param orientation Orientation that will be applied.
* @result The new `CGAffineTransform` to apply on this view.
*/
- (CGAffineTransform)transformForOrientation:(UIInterfaceOrientation)orientation;
@end

Просмотреть файл

@ -1,62 +1,62 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class AEInteractiveContent;
/**
* Abstract view controller used to display an announcement or a poll.
*/
@interface AEContentViewController : UIViewController
/**
* Return the displayed content. Subclasses must override this method.
* @result The associated content.
*/
- (AEInteractiveContent*)content;
/**
* Report content as exited and dimiss this view controller.
* Should be called by subclasses when the user clicks on the _exit_ button associated to
* the announcement or poll.
*/
- (void)exit;
/**
* Load a button toolbar used by poll and announcement views.
* @param toolbar The native toolbar to load.
*/
- (void)loadToolbar:(UIToolbar*)toolbar;
/**
* Method called when action button from a loaded toolbar has been clicked.
* Sub-classes must re-implement this method.
* @param sender The object that sent the action message.
*/
- (void)actionButtonClicked:(id)sender;
/**
* Method called when exit button from a loaded toolbar has been clicked.
* By default, this method will just call the <exit> method.
* @param sender The object that sent the action message.
*/
- (void)exitButtonClicked:(id)sender;
/**
* Method called when the action bar button item has been loaded.
* Sub-classes can reimplement this method to customize the style of the action button.
* @param actionButton The button used to action the campaign.
*/
- (void)actionButtonLoaded:(UIBarButtonItem*)actionButton;
/**
* Method called when the exit bar button item has been loaded.
* Sub-classes can reimplement this method to customize the style of the exit button.
* @param exitButton The button used to exit the campaign.
*/
- (void)exitButtonLoaded:(UIBarButtonItem*)exitButton;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class AEInteractiveContent;
/**
* Abstract view controller used to display an announcement or a poll.
*/
@interface AEContentViewController : UIViewController
/**
* Return the displayed content. Subclasses must override this method.
* @result The associated content.
*/
- (AEInteractiveContent*)content;
/**
* Report content as exited and dimiss this view controller.
* Should be called by subclasses when the user clicks on the _exit_ button associated to
* the announcement or poll.
*/
- (void)exit;
/**
* Load a button toolbar used by poll and announcement views.
* @param toolbar The native toolbar to load.
*/
- (void)loadToolbar:(UIToolbar*)toolbar;
/**
* Method called when action button from a loaded toolbar has been clicked.
* Sub-classes must re-implement this method.
* @param sender The object that sent the action message.
*/
- (void)actionButtonClicked:(id)sender;
/**
* Method called when exit button from a loaded toolbar has been clicked.
* By default, this method will just call the <exit> method.
* @param sender The object that sent the action message.
*/
- (void)exitButtonClicked:(id)sender;
/**
* Method called when the action bar button item has been loaded.
* Sub-classes can reimplement this method to customize the style of the action button.
* @param actionButton The button used to action the campaign.
*/
- (void)actionButtonLoaded:(UIBarButtonItem*)actionButton;
/**
* Method called when the exit bar button item has been loaded.
* Sub-classes can reimplement this method to customize the style of the exit button.
* @param exitButton The button used to exit the campaign.
*/
- (void)exitButtonLoaded:(UIBarButtonItem*)exitButton;
@end

Просмотреть файл

@ -1,39 +1,39 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEAnnouncementViewController.h"
#import "AEWebAnnouncementJsBridge.h"
@class AEAnnouncementViewController;
/**
* Default implementation of AEAnnouncementViewController.
*
* This view controller display an announcement using layout view named `AEDefaultAnnouncementView.xib`.<br>
* You can change the xib file to your needs as long as you keep view identifier and types.
*
* This class is using the Javascript bridge AEWebAnnouncementJsBridge to perform actions when
* a recognized Javascript function is called inside a web announcement.
*/
@interface AEDefaultAnnouncementViewController : AEAnnouncementViewController<AEWebAnnouncementActionDelegate>
/** Navigation bar displaying announcement's title */
@property(nonatomic, retain) IBOutlet UINavigationBar* titleBar;
/** Text announcement's content goes in this view. */
@property(nonatomic, retain) IBOutlet UITextView* textView;
/** Web announcement's content goes in this view. */
@property(nonatomic, retain) IBOutlet UIWebView* webView;
/** Toolbar containing action and exit buttons */
@property(nonatomic, retain) IBOutlet UIToolbar* toolbar;
/**
* Javascript bridge
*/
@property(nonatomic, retain) AEWebAnnouncementJsBridge* jsBridge;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEAnnouncementViewController.h"
#import "AEWebAnnouncementJsBridge.h"
@class AEAnnouncementViewController;
/**
* Default implementation of AEAnnouncementViewController.
*
* This view controller display an announcement using layout view named `AEDefaultAnnouncementView.xib`.<br>
* You can change the xib file to your needs as long as you keep view identifier and types.
*
* This class is using the Javascript bridge AEWebAnnouncementJsBridge to perform actions when
* a recognized Javascript function is called inside a web announcement.
*/
@interface AEDefaultAnnouncementViewController : AEAnnouncementViewController<AEWebAnnouncementActionDelegate>
/** Navigation bar displaying announcement's title */
@property(nonatomic, retain) IBOutlet UINavigationBar* titleBar;
/** Text announcement's content goes in this view. */
@property(nonatomic, retain) IBOutlet UITextView* textView;
/** Web announcement's content goes in this view. */
@property(nonatomic, retain) IBOutlet UIWebView* webView;
/** Toolbar containing action and exit buttons */
@property(nonatomic, retain) IBOutlet UIToolbar* toolbar;
/**
* Javascript bridge
*/
@property(nonatomic, retain) AEWebAnnouncementJsBridge* jsBridge;
@end

Просмотреть файл

@ -1,178 +1,178 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AENotifier.h"
#define NOTIFICATION_AREA_VIEW_TAG 36822491
#define NOTIFICATION_ICON_TAG 1
#define NOTIFICATION_TITLE_TAG 2
#define NOTIFICATION_MESSAGE_TAG 3
#define NOTIFICATION_IMAGE_TAG 4
#define NOTIFICATION_BUTTON_TAG 5
#define NOTIFICATION_CLOSE_TAG 6
/**
*
* This is the default notifier used by <AEReachModule>.
*
* It will display a banner notification inside the current application window or in a dedicated view tag if it exists.
* By default the banner notification overlay will be presented at the bottom of the screen. If you prefer to display it
* at the top of screen,
* edit the provided _`AENotificationView.xib`_ and change the `AutoSizing` property of the main view so it can be kept
* at the top of its superview.
*
* # Some examples of custom notifiers based on this class #
*
* ** Using a different nib file: **
*
* #import "AEDefaultNotifier.h"
* @interface MyNotifier : AEDefaultNotifier
* @end
*
* @implementation MyNotifier
* -(NSString*)nibNameForCategory:(NSString*)category
* {
* return "MyNotificationView";
* }
* @end
*
* ** Creating the notification view programmatically: **
*
* #import "AEDefaultNotifier.h"
* @interface MyNotifier : AEDefaultNotifier
* @end
*
* @implementation MyNotifier
*
* -(UIView*)notificationViewForContent:(AEInteractiveContent*)content
* {
* UIView* notificationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 80)];
* notificationView.backgroundColor = [UIColor redColor];
*
* // Title
* UILabel* title = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 230, 30)];
* title.text = content.notificationTitle;
* [notificationView addSubview:title];
* [title release];
*
* // Notification button
* UIButton* button = [[UIButton alloc] initWithFrame:notificationView.frame];
* [button addTarget:self action:@selector(onNotificationActioned) forControlEvents:UIControlEventTouchDown];
* [notificationView addSubview:button];
* [button release];
*
* return [notificationView autorelease];
* }
* @end
*/
@interface AEDefaultNotifier : NSObject<AENotifier>
{
@private
UIImage* _notificationIcon;
AEInteractiveContent* _content;
UIView* _containerView;
}
/**
* Create a default notifier with a given notification icon.
* The default notification view AENotificationView will be used to display notifications.
* @param icon Notification icon.
*/
+ (id)notifierWithIcon:(UIImage*)icon;
/**
* This method is called when a view is requested to display notifications.<br>
* The default implementation of this class return `NotificationView`, the name of
* the xib file provided with the reach library.<br>
* Subclasses can reimplement this method to return another xib filename. The file must be inside the
* main application bundle and should only contain one view.
*
* @param category Associated category. Can be ignored if this notifier handles only one category.
* @result Nib name for the given category.
*/
- (NSString*)nibNameForCategory:(NSString*)category;
/**
* This method is called when a new notification view is requested for the given content.
* By default this method load the view from the nib returned by <nibNameForCategory:>,
* and prepare it by calling the method <prepareNotificationView:forContent:>.<br>
* Subclasses can override this method to create a custom view for the given content.
*
* @param content Content to be notified. You can use the methods <[AEInteractiveContent notificationTitle]>,
* <[AEInteractiveContent notificationMessage]>, <[AEInteractiveContent notificationIcon]>,
* <[AEInteractiveContent notificationCloseable]>, <[AEInteractiveContent notificationImage]> to prepare your view.
* @result View displaying the notification.
*/
- (UIView*)notificationViewForContent:(AEInteractiveContent*)content;
/**
* This function is called when the notification view must be prepared, e.g. change texts,
* icon etc... based on the specified content. This is the responsibility of this method to
* associate actions to the buttons. At this point the notification is not yet attached to the
* view hierarchy, so you can not have access to its superview.
*
* The provided custom view must contains the following subviews:
*
* - `UIImageView` with tag 1 to display the notification icon
* - `UILabel` with tag 2 to display the notification's title
* - `UILabel` with tag 3 to display the notification's message
* - `UIImageView` with tag 4 to display the additional notification image
* - `UIButton` with tag 5 used when the notification is 'actioned'
* - `UIButton` with tag 6 used when the notification is 'exited'
*
* @param content Content to be notified.
* @param view View used to display the notification.
*/
- (void)prepareNotificationView:(UIView*)view forContent:(AEInteractiveContent*)content;
/**
* This function is called when the notification view has been added to a window.
* By default, this method do nothing but subclasses can override this method to perform additional tasks
* associated with presenting the notification view.
* @param view View containing the notification.
*/
- (void)notificationViewDidAppear:(UIView*)view;
/**
* This function is called when the notification view has been removed from the view hierarchy.
* By default, this method do nothing but subclasses can override this method to perform additional tasks
* associated with hiding the notification view.
* @param view View containing the notification.
*/
- (void)notificationViewDidDisappear:(UIView*)view;
/**
* Animate the area notification view when it appears.
* Default implementation performs a fade-in animation.
* Subclasses can override this method to customize the animation.
* @param view View to animate.
*/
- (void)animateAreaNoticationView:(UIView*)view;
/**
* Animate the overlay notification view when it appears.
* Default implementation performs a vertical slide animation.
* Subclasses can override this method to customize the animation.
* @param view View to animate.
*/
- (void)animateOverlayNotificationView:(UIView*)view;
/**
* Called when the notification is actioned (example : when the user clicks on the notification).
* If you override the method <prepareNotificationView:forContent:>, be sure to map this method to one of your U.I.
* controls.
*/
- (void)onNotificationActioned;
/**
* Called when the notification is exited (example : when the close button is clicked).
* If you override the method <prepareNotificationView:forContent:>, be sure to map this method to one of your U.I.
* controls
*/
- (void)onNotificationExited;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AENotifier.h"
#define NOTIFICATION_AREA_VIEW_TAG 36822491
#define NOTIFICATION_ICON_TAG 1
#define NOTIFICATION_TITLE_TAG 2
#define NOTIFICATION_MESSAGE_TAG 3
#define NOTIFICATION_IMAGE_TAG 4
#define NOTIFICATION_BUTTON_TAG 5
#define NOTIFICATION_CLOSE_TAG 6
/**
*
* This is the default notifier used by <AEReachModule>.
*
* It will display a banner notification inside the current application window or in a dedicated view tag if it exists.
* By default the banner notification overlay will be presented at the bottom of the screen. If you prefer to display it
* at the top of screen,
* edit the provided _`AENotificationView.xib`_ and change the `AutoSizing` property of the main view so it can be kept
* at the top of its superview.
*
* # Some examples of custom notifiers based on this class #
*
* ** Using a different nib file: **
*
* #import "AEDefaultNotifier.h"
* @interface MyNotifier : AEDefaultNotifier
* @end
*
* @implementation MyNotifier
* -(NSString*)nibNameForCategory:(NSString*)category
* {
* return "MyNotificationView";
* }
* @end
*
* ** Creating the notification view programmatically: **
*
* #import "AEDefaultNotifier.h"
* @interface MyNotifier : AEDefaultNotifier
* @end
*
* @implementation MyNotifier
*
* -(UIView*)notificationViewForContent:(AEInteractiveContent*)content
* {
* UIView* notificationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 80)];
* notificationView.backgroundColor = [UIColor redColor];
*
* // Title
* UILabel* title = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 230, 30)];
* title.text = content.notificationTitle;
* [notificationView addSubview:title];
* [title release];
*
* // Notification button
* UIButton* button = [[UIButton alloc] initWithFrame:notificationView.frame];
* [button addTarget:self action:@selector(onNotificationActioned) forControlEvents:UIControlEventTouchDown];
* [notificationView addSubview:button];
* [button release];
*
* return [notificationView autorelease];
* }
* @end
*/
@interface AEDefaultNotifier : NSObject<AENotifier>
{
@private
UIImage* _notificationIcon;
AEInteractiveContent* _content;
UIView* _containerView;
}
/**
* Create a default notifier with a given notification icon.
* The default notification view AENotificationView will be used to display notifications.
* @param icon Notification icon.
*/
+ (id)notifierWithIcon:(UIImage*)icon;
/**
* This method is called when a view is requested to display notifications.<br>
* The default implementation of this class return `NotificationView`, the name of
* the xib file provided with the reach library.<br>
* Subclasses can reimplement this method to return another xib filename. The file must be inside the
* main application bundle and should only contain one view.
*
* @param category Associated category. Can be ignored if this notifier handles only one category.
* @result Nib name for the given category.
*/
- (NSString*)nibNameForCategory:(NSString*)category;
/**
* This method is called when a new notification view is requested for the given content.
* By default this method load the view from the nib returned by <nibNameForCategory:>,
* and prepare it by calling the method <prepareNotificationView:forContent:>.<br>
* Subclasses can override this method to create a custom view for the given content.
*
* @param content Content to be notified. You can use the methods <[AEInteractiveContent notificationTitle]>,
* <[AEInteractiveContent notificationMessage]>, <[AEInteractiveContent notificationIcon]>,
* <[AEInteractiveContent notificationCloseable]>, <[AEInteractiveContent notificationImage]> to prepare your view.
* @result View displaying the notification.
*/
- (UIView*)notificationViewForContent:(AEInteractiveContent*)content;
/**
* This function is called when the notification view must be prepared, e.g. change texts,
* icon etc... based on the specified content. This is the responsibility of this method to
* associate actions to the buttons. At this point the notification is not yet attached to the
* view hierarchy, so you can not have access to its superview.
*
* The provided custom view must contains the following subviews:
*
* - `UIImageView` with tag 1 to display the notification icon
* - `UILabel` with tag 2 to display the notification's title
* - `UILabel` with tag 3 to display the notification's message
* - `UIImageView` with tag 4 to display the additional notification image
* - `UIButton` with tag 5 used when the notification is 'actioned'
* - `UIButton` with tag 6 used when the notification is 'exited'
*
* @param content Content to be notified.
* @param view View used to display the notification.
*/
- (void)prepareNotificationView:(UIView*)view forContent:(AEInteractiveContent*)content;
/**
* This function is called when the notification view has been added to a window.
* By default, this method do nothing but subclasses can override this method to perform additional tasks
* associated with presenting the notification view.
* @param view View containing the notification.
*/
- (void)notificationViewDidAppear:(UIView*)view;
/**
* This function is called when the notification view has been removed from the view hierarchy.
* By default, this method do nothing but subclasses can override this method to perform additional tasks
* associated with hiding the notification view.
* @param view View containing the notification.
*/
- (void)notificationViewDidDisappear:(UIView*)view;
/**
* Animate the area notification view when it appears.
* Default implementation performs a fade-in animation.
* Subclasses can override this method to customize the animation.
* @param view View to animate.
*/
- (void)animateAreaNoticationView:(UIView*)view;
/**
* Animate the overlay notification view when it appears.
* Default implementation performs a vertical slide animation.
* Subclasses can override this method to customize the animation.
* @param view View to animate.
*/
- (void)animateOverlayNotificationView:(UIView*)view;
/**
* Called when the notification is actioned (example : when the user clicks on the notification).
* If you override the method <prepareNotificationView:forContent:>, be sure to map this method to one of your U.I.
* controls.
*/
- (void)onNotificationActioned;
/**
* Called when the notification is exited (example : when the close button is clicked).
* If you override the method <prepareNotificationView:forContent:>, be sure to map this method to one of your U.I.
* controls
*/
- (void)onNotificationExited;
@end

Просмотреть файл

@ -1,36 +1,36 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AEPollViewController.h"
@class AEReachPoll;
/**
* Default implementation of <AEPollViewController>.
*
* This view controller display a poll using layout view named `AEDefaultPollView.xib`.<br>
* You can change the xib file to your needs as long as you keep view identifier and types.
*/
@interface AEDefaultPollViewController : AEPollViewController {
@private
BOOL _hasBody;
NSMutableDictionary* _selectedChoices;
}
/** Submit's button */
@property(nonatomic, retain) UIBarButtonItem* submitButton;
/** Navigation bar displaying poll's title */
@property(nonatomic, retain) IBOutlet UINavigationBar* titleBar;
/** Table view responsible for displaying questions and choices */
@property(nonatomic, retain) IBOutlet UITableView* tableView;
/** Toolbar containing action and exit buttons */
@property(nonatomic, retain) IBOutlet UIToolbar* toolbar;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AEPollViewController.h"
@class AEReachPoll;
/**
* Default implementation of <AEPollViewController>.
*
* This view controller display a poll using layout view named `AEDefaultPollView.xib`.<br>
* You can change the xib file to your needs as long as you keep view identifier and types.
*/
@interface AEDefaultPollViewController : AEPollViewController {
@private
BOOL _hasBody;
NSMutableDictionary* _selectedChoices;
}
/** Submit's button */
@property(nonatomic, retain) UIBarButtonItem* submitButton;
/** Navigation bar displaying poll's title */
@property(nonatomic, retain) IBOutlet UINavigationBar* titleBar;
/** Table view responsible for displaying questions and choices */
@property(nonatomic, retain) IBOutlet UITableView* tableView;
/** Toolbar containing action and exit buttons */
@property(nonatomic, retain) IBOutlet UIToolbar* toolbar;
@end

Просмотреть файл

@ -1,109 +1,109 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <UIKit/UIKit.h>
#import "AEReachContent.h"
#import "AE_TBXML.h"
/**
* Reach content behavior.
*/
typedef NS_ENUM (NSInteger, AEContentBehavior)
{
/** A reach content that can be displayed at any time. */
AEContentBehaviorAnyTime = 1,
/** A reach content that can be displayed only when the application is in background. */
AEContentBehaviorBackground = 2,
/** A reach content that can be displayed during application session time. */
AEContentBehaviorSession = 3,
/** A reach content that can be displayed only during some activities. */
AEContentBehaviorActivity = 4
};
/**
* Abstract class for reach contents that can be displayed to the end-user.
*/
@interface AEInteractiveContent : AEReachContent
{
@private
NSString* _title;
NSString* _actionLabel;
NSString* _exitLabel;
NSMutableArray* _allowedActivities;
AEContentBehavior _behavior;
NSString* _notificationTitle;
NSString* _notificationMessage;
BOOL _notificationIcon;
BOOL _notificationCloseable;
NSString* _notificationImageString;
UIImage* _notificationImage;
BOOL _notificationDisplayed;
BOOL _notificationActioned;
BOOL _contentDisplayed;
BOOL _notifiedFromNativePush;
}
/**
* Test if this content can be notified in the current UI context.
* @param activity Current activity name, null if no current activity.
* @result YES if this content can be notified in the current UI context.
*/
- (BOOL)canNotify:(NSString*)activity;
/** Report notification has been displayed */
- (void)displayNotification;
/**
* Action the notification: this will display the announcement or poll, or will
* launch the action URL associated to the notification, depending of the content kind.
*/
- (void)actionNotification;
/**
* Action the notification: this will display the announcement or poll, or will
* launch the action URL associated to the notification, depending of the content kind.
* @param launchAction YES to launch associated action, NO to just report the notification action.
*/
- (void)actionNotification:(BOOL)launchAction;
/** Exit this notification. */
- (void)exitNotification;
/** Report content has been displayed */
- (void)displayContent;
/** Reach content's title */
@property(nonatomic, readonly) NSString* title;
/** The text label of the action button */
@property(nonatomic, readonly) NSString* actionLabel;
/** The text label of the exit button */
@property(nonatomic, readonly) NSString* exitLabel;
/** Reach content behavior (when to display the notification?) */
@property(readonly) AEContentBehavior behavior;
/** Notification's title */
@property(readonly) NSString* notificationTitle;
/** Notification's message */
@property(readonly) NSString* notificationMessage;
/** @result YES if the notification has a resource icon in notification content, NO otherwise */
@property(readonly) BOOL notificationIcon;
/** @result YES if the notification can be closed without looking at the content, NO otherwise */
@property(readonly) BOOL notificationCloseable;
/** @result notification image */
@property(readonly) UIImage* notificationImage;
/** @result YES if the content was notified from a native Apple Push Notification. */
@property BOOL notifiedFromNativePush;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <UIKit/UIKit.h>
#import "AEReachContent.h"
#import "AE_TBXML.h"
/**
* Reach content behavior.
*/
typedef NS_ENUM (NSInteger, AEContentBehavior)
{
/** A reach content that can be displayed at any time. */
AEContentBehaviorAnyTime = 1,
/** A reach content that can be displayed only when the application is in background. */
AEContentBehaviorBackground = 2,
/** A reach content that can be displayed during application session time. */
AEContentBehaviorSession = 3,
/** A reach content that can be displayed only during some activities. */
AEContentBehaviorActivity = 4
};
/**
* Abstract class for reach contents that can be displayed to the end-user.
*/
@interface AEInteractiveContent : AEReachContent
{
@private
NSString* _title;
NSString* _actionLabel;
NSString* _exitLabel;
NSMutableArray* _allowedActivities;
AEContentBehavior _behavior;
NSString* _notificationTitle;
NSString* _notificationMessage;
BOOL _notificationIcon;
BOOL _notificationCloseable;
NSString* _notificationImageString;
UIImage* _notificationImage;
BOOL _notificationDisplayed;
BOOL _notificationActioned;
BOOL _contentDisplayed;
BOOL _notifiedFromNativePush;
}
/**
* Test if this content can be notified in the current UI context.
* @param activity Current activity name, null if no current activity.
* @result YES if this content can be notified in the current UI context.
*/
- (BOOL)canNotify:(NSString*)activity;
/** Report notification has been displayed */
- (void)displayNotification;
/**
* Action the notification: this will display the announcement or poll, or will
* launch the action URL associated to the notification, depending of the content kind.
*/
- (void)actionNotification;
/**
* Action the notification: this will display the announcement or poll, or will
* launch the action URL associated to the notification, depending of the content kind.
* @param launchAction YES to launch associated action, NO to just report the notification action.
*/
- (void)actionNotification:(BOOL)launchAction;
/** Exit this notification. */
- (void)exitNotification;
/** Report content has been displayed */
- (void)displayContent;
/** Reach content's title */
@property(nonatomic, readonly) NSString* title;
/** The text label of the action button */
@property(nonatomic, readonly) NSString* actionLabel;
/** The text label of the exit button */
@property(nonatomic, readonly) NSString* exitLabel;
/** Reach content behavior (when to display the notification?) */
@property(readonly) AEContentBehavior behavior;
/** Notification's title */
@property(readonly) NSString* notificationTitle;
/** Notification's message */
@property(readonly) NSString* notificationMessage;
/** @result YES if the notification has a resource icon in notification content, NO otherwise */
@property(readonly) BOOL notificationIcon;
/** @result YES if the notification can be closed without looking at the content, NO otherwise */
@property(readonly) BOOL notificationCloseable;
/** @result notification image */
@property(readonly) UIImage* notificationImage;
/** @result YES if the content was notified from a native Apple Push Notification. */
@property BOOL notifiedFromNativePush;
@end

Просмотреть файл

@ -1,45 +1,45 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* A `AENotificationView` object represnts a view that is responsible for displaying reach notifications used by the
* default notifier <AEDefaultNotifier>.
*
* This view is using the layout named `AEDefaultNotificationView.xib`.
* You can change the xib file to your needs as long as you keep view identifier and types.<br>
* This class overrides the method `layoutSubviews` to move and resize subviews when some of them are hidden.
*/
@interface AENotificationView : UIView
{
@private
UILabel* _titleView;
UILabel* _messageView;
UIImageView* _iconView;
UIImageView* _imageView;
UIButton* _notificationButton;
UIButton* _closeButton;
}
/** Returns the title view of the notification. */
@property(nonatomic, readonly) UILabel* titleView;
/** Returns the message view of the notification. */
@property(nonatomic, readonly) UILabel* messageView;
/** Returns the icon view of the notification. */
@property(nonatomic, readonly) UIImageView* iconView;
/** Returns the image view of the notification. */
@property(nonatomic, readonly) UIImageView* imageView;
/** Returns the main button of the notification. */
@property(nonatomic, readonly) UIButton* notificationButton;
/** Returns the close button of the notification. */
@property(nonatomic, readonly) UIButton* closeButton;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* A `AENotificationView` object represnts a view that is responsible for displaying reach notifications used by the
* default notifier <AEDefaultNotifier>.
*
* This view is using the layout named `AEDefaultNotificationView.xib`.
* You can change the xib file to your needs as long as you keep view identifier and types.<br>
* This class overrides the method `layoutSubviews` to move and resize subviews when some of them are hidden.
*/
@interface AENotificationView : UIView
{
@private
UILabel* _titleView;
UILabel* _messageView;
UIImageView* _iconView;
UIImageView* _imageView;
UIButton* _notificationButton;
UIButton* _closeButton;
}
/** Returns the title view of the notification. */
@property(nonatomic, readonly) UILabel* titleView;
/** Returns the message view of the notification. */
@property(nonatomic, readonly) UILabel* messageView;
/** Returns the icon view of the notification. */
@property(nonatomic, readonly) UIImageView* iconView;
/** Returns the image view of the notification. */
@property(nonatomic, readonly) UIImageView* imageView;
/** Returns the main button of the notification. */
@property(nonatomic, readonly) UIButton* notificationButton;
/** Returns the close button of the notification. */
@property(nonatomic, readonly) UIButton* closeButton;
@end

Просмотреть файл

@ -1,36 +1,36 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEInteractiveContent.h"
/**
* Custom notifier specification.
*
* You can define how a content notification is done for a set of categories by implementing this
* protocol and registering your instances by calling <[AEReachModule registerNotifier:forCategory:]><br/>
* It is recommended to extend the default implementation: <AEDefaultNotifier> which
* performs most of the work and has convenient callbacks.
*/
@protocol AENotifier <NSObject>
@required
/**
* Handle a notification for a content.
* @param content content to be notified.
* @result YES to accept the content, NO to postpone the content (like overlay disabled in a
* specific context).
*/
- (BOOL)handleNotification:(AEInteractiveContent*)content;
/**
* Reach module needs to control notification appearance.
* When this method is called the notifier should clear any displayed notification for the given category.
* @param category the category to clear. This parameter can be ignored if the notifier handles only one kind of
* category.
*/
- (void)clearNotification:(NSString*)category;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEInteractiveContent.h"
/**
* Custom notifier specification.
*
* You can define how a content notification is done for a set of categories by implementing this
* protocol and registering your instances by calling <[AEReachModule registerNotifier:forCategory:]><br/>
* It is recommended to extend the default implementation: <AEDefaultNotifier> which
* performs most of the work and has convenient callbacks.
*/
@protocol AENotifier <NSObject>
@required
/**
* Handle a notification for a content.
* @param content content to be notified.
* @result YES to accept the content, NO to postpone the content (like overlay disabled in a
* specific context).
*/
- (BOOL)handleNotification:(AEInteractiveContent*)content;
/**
* Reach module needs to control notification appearance.
* When this method is called the notifier should clear any displayed notification for the given category.
* @param category the category to clear. This parameter can be ignored if the notifier handles only one kind of
* category.
*/
- (void)clearNotification:(NSString*)category;
@end

Просмотреть файл

@ -1,39 +1,39 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "AEContentViewController.h"
@class AEReachPoll;
/**
* Abstract view controller displaying a Engagement poll.
*
* By inheriting from this class you can create your own view controller to display polls.
*/
@interface AEPollViewController : AEContentViewController
/**
* Init the view controller with the given poll.
* Subclasses should re-implement this method.
* @param poll Poll to display
*/
- (instancetype)initWithPoll:(AEReachPoll*)poll;
/**
* Submit answers for the associated poll and dismiss this view controller.<br>
* Dictionary keys must be the question ids and values must be the associated choice ids.
* Should be called by subclasses when the user clicks on the 'action' button associated to
* the poll.
* @param answers The poll answers to submit.
*/
- (void)submitAnswers:(NSDictionary*)answers;
/**
* Use this property to store poll information when the initWithPoll:
* method is called.
* Subclasses should also read this property to init their subviews.
*/
@property(nonatomic, retain) AEReachPoll* poll;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "AEContentViewController.h"
@class AEReachPoll;
/**
* Abstract view controller displaying a Engagement poll.
*
* By inheriting from this class you can create your own view controller to display polls.
*/
@interface AEPollViewController : AEContentViewController
/**
* Init the view controller with the given poll.
* Subclasses should re-implement this method.
* @param poll Poll to display
*/
- (instancetype)initWithPoll:(AEReachPoll*)poll;
/**
* Submit answers for the associated poll and dismiss this view controller.<br>
* Dictionary keys must be the question ids and values must be the associated choice ids.
* Should be called by subclasses when the user clicks on the 'action' button associated to
* the poll.
* @param answers The poll answers to submit.
*/
- (void)submitAnswers:(NSDictionary*)answers;
/**
* Use this property to store poll information when the initWithPoll:
* method is called.
* Subclasses should also read this property to init their subviews.
*/
@property(nonatomic, retain) AEReachPoll* poll;
@end

Просмотреть файл

@ -1,28 +1,28 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEInteractiveContent.h"
/**
* The `AEReachAbstractAnnouncement` is a base class for all kind of announcements.
*/
@interface AEReachAbstractAnnouncement : AEInteractiveContent
{
@private
NSString* _actionURL;
}
/**
* Initialize an abstract announcement. Should only be called by subclasses.
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the action URL.
* @result An initialized abstract announcement or nil if it couldn't be parsed.
*/
- (id)initWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
/** URL to launch as an action */
@property (nonatomic, retain) NSString* actionURL;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEInteractiveContent.h"
/**
* The `AEReachAbstractAnnouncement` is a base class for all kind of announcements.
*/
@interface AEReachAbstractAnnouncement : AEInteractiveContent
{
@private
NSString* _actionURL;
}
/**
* Initialize an abstract announcement. Should only be called by subclasses.
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the action URL.
* @result An initialized abstract announcement or nil if it couldn't be parsed.
*/
- (id)initWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
/** URL to launch as an action */
@property (nonatomic, retain) NSString* actionURL;
@end

Просмотреть файл

@ -1,56 +1,56 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEReachAbstractAnnouncement.h"
/**
* Announcement's type.
*/
typedef NS_ENUM (NSInteger, AEAnnouncementType)
{
/** Unknwon announcement type */
AEAnnouncementTypeUnknown = -1,
/** Announcement with a text plain content */
AEAnnouncementTypeText = 1,
/** Announcement with an HTML content */
AEAnnouncementTypeHtml = 2
};
/**
* The `AEReachAnnouncement` class defines objects that represent generic Engagement announcements.
*
* You usually have to use this class when you implement your own
* announcement view controller.<br> The Engagement Reach SDK will instantiate your view controller using
* method <[AEAnnouncementViewController initWithAnnouncement:]>.
*/
@interface AEReachAnnouncement : AEReachAbstractAnnouncement {
@private
AEAnnouncementType _type;
}
/**
* Parse an announcement
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the action URL and body of the announcement.
* @result A new announcement or nil if it couldn't be parsed.
*/
+ (id)announcementWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
/**
* Get the mime type for this announcement. This is useful to interpret the text returned by
* #body.
*
* Possible values are:
*
* - `AEAnnouncementTypeUnknown`: Unknown announcement type
* - `AEAnnouncementTypeText`: A text announcement (associated mimetype is text/plain)
* - `AEAnnouncementTypeHtml`: An HTML announcement (associated mimetype is text/html)
*/
@property(readonly) AEAnnouncementType type;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEReachAbstractAnnouncement.h"
/**
* Announcement's type.
*/
typedef NS_ENUM (NSInteger, AEAnnouncementType)
{
/** Unknwon announcement type */
AEAnnouncementTypeUnknown = -1,
/** Announcement with a text plain content */
AEAnnouncementTypeText = 1,
/** Announcement with an HTML content */
AEAnnouncementTypeHtml = 2
};
/**
* The `AEReachAnnouncement` class defines objects that represent generic Engagement announcements.
*
* You usually have to use this class when you implement your own
* announcement view controller.<br> The Engagement Reach SDK will instantiate your view controller using
* method <[AEAnnouncementViewController initWithAnnouncement:]>.
*/
@interface AEReachAnnouncement : AEReachAbstractAnnouncement {
@private
AEAnnouncementType _type;
}
/**
* Parse an announcement
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the action URL and body of the announcement.
* @result A new announcement or nil if it couldn't be parsed.
*/
+ (id)announcementWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
/**
* Get the mime type for this announcement. This is useful to interpret the text returned by
* #body.
*
* Possible values are:
*
* - `AEAnnouncementTypeUnknown`: Unknown announcement type
* - `AEAnnouncementTypeText`: A text announcement (associated mimetype is text/plain)
* - `AEAnnouncementTypeHtml`: An HTML announcement (associated mimetype is text/html)
*/
@property(readonly) AEAnnouncementType type;
@end

Просмотреть файл

@ -1,82 +1,82 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AE_TBXML.h"
/**
* Abstract class for reach contents such as announcements and polls.
*/
@interface AEReachContent : NSObject
{
@private
NSUInteger _localId;
NSString* _category;
NSString* _body;
BOOL _processed;
BOOL _feedback;
NSDate* _expiryDate;
BOOL _expiryLocaltz;
}
/**
* Parse a reach content from a given xml element
* @param root Parsed XML root DOM element
* @result The parsed reach content or nil if content couldn't be parsed.
*/
- (id)initWithElement:(AE_TBXMLElt*)root;
/** The unique reach content identifier setter method. */
@property (nonatomic, copy) NSString *contentId;
/** Local storage identifier */
@property(assign) NSUInteger localId;
/**
* Category of this content. You usually don't need to read this value by yourself.
* Instead, you should use the method <[AEReachModule registerAnnouncementController:forCategory:]>
* or <[AEReachModule registerPollController:forCategory:]> to tell the reach module
* which controller to display for a given category.
*/
@property (nonatomic, copy) NSString* category;
/** Reach content's body */
@property(nonatomic, copy) NSString* body;
/** Feedback required ? */
@property BOOL feedback;
/** Drop content. */
- (void)drop;
/** Report content has been actioned. */
- (void)actionContent;
/** Report content has been exited. */
- (void)exitContent;
/** @result YES if content is expired and should be dropped, NO otherwise */
- (BOOL)isExpired;
/**
* Utility method to decode base64 data.
* @param str The string to decode.
*/
- (NSData*)decodeBase64:(NSString*)str;
/**
* Send feedback to reach about this content.
* @param status The feedback status.
* @param extras Extra information like poll answers.
*/
- (void)sendFeedback:(NSString*)status extras:(NSDictionary*)extras;
/**
* Send content reply to the service that sent it, after that new contents can be notified.
* @param status The feedback status.
* @param extras Extra information like poll answers.
*/
- (void)process:(NSString*)status extras:(NSDictionary*)extras;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AE_TBXML.h"
/**
* Abstract class for reach contents such as announcements and polls.
*/
@interface AEReachContent : NSObject
{
@private
NSUInteger _localId;
NSString* _category;
NSString* _body;
BOOL _processed;
BOOL _feedback;
NSDate* _expiryDate;
BOOL _expiryLocaltz;
}
/**
* Parse a reach content from a given xml element
* @param root Parsed XML root DOM element
* @result The parsed reach content or nil if content couldn't be parsed.
*/
- (id)initWithElement:(AE_TBXMLElt*)root;
/** The unique reach content identifier setter method. */
@property (nonatomic, copy) NSString *contentId;
/** Local storage identifier */
@property(assign) NSUInteger localId;
/**
* Category of this content. You usually don't need to read this value by yourself.
* Instead, you should use the method <[AEReachModule registerAnnouncementController:forCategory:]>
* or <[AEReachModule registerPollController:forCategory:]> to tell the reach module
* which controller to display for a given category.
*/
@property (nonatomic, copy) NSString* category;
/** Reach content's body */
@property(nonatomic, copy) NSString* body;
/** Feedback required ? */
@property BOOL feedback;
/** Drop content. */
- (void)drop;
/** Report content has been actioned. */
- (void)actionContent;
/** Report content has been exited. */
- (void)exitContent;
/** @result YES if content is expired and should be dropped, NO otherwise */
- (BOOL)isExpired;
/**
* Utility method to decode base64 data.
* @param str The string to decode.
*/
- (NSData*)decodeBase64:(NSString*)str;
/**
* Send feedback to reach about this content.
* @param status The feedback status.
* @param extras Extra information like poll answers.
*/
- (void)sendFeedback:(NSString*)status extras:(NSDictionary*)extras;
/**
* Send content reply to the service that sent it, after that new contents can be notified.
* @param status The feedback status.
* @param extras Extra information like poll answers.
*/
- (void)process:(NSString*)status extras:(NSDictionary*)extras;
@end

Просмотреть файл

@ -1,54 +1,54 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "AEReachContent.h"
/**
* Data push's type.
*/
typedef NS_ENUM (NSInteger, AEDatapushType)
{
/** Unknwon data-push type */
AEDatapushTypeUnknown = -1,
/** Data-push with a text content */
AEDatapushTypeText = 1,
/** Data-push with a base 64 encoded content */
AEDatapushTypeBase64 = 2
};
/**
* The `AEReachDataPush` class defines objects that represent a generic reach content.
*/
@interface AEReachDataPush : AEReachContent
{
@private
AEDatapushType _type;
}
/**
* Parse an announcement
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the body of the datapush.
* @result A new announcement or nil if it couldn't be parsed.
*/
+ (id)datapushWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
/**
* Get the type for this data push.
*
* Possible values are:
*
* - `AEDatapushTypeUnknown`: Unknown data push type
* - `AEDatapushTypeText`: A text data push
* - `AEDatapushTypeBase64`: A base 64 data push
*/
@property(readonly) AEDatapushType type;
/** Get decoded body. Only apply on base 64 data pushes (return `nil` for other types). */
@property(readonly) NSData* decodedBody;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "AEReachContent.h"
/**
* Data push's type.
*/
typedef NS_ENUM (NSInteger, AEDatapushType)
{
/** Unknwon data-push type */
AEDatapushTypeUnknown = -1,
/** Data-push with a text content */
AEDatapushTypeText = 1,
/** Data-push with a base 64 encoded content */
AEDatapushTypeBase64 = 2
};
/**
* The `AEReachDataPush` class defines objects that represent a generic reach content.
*/
@interface AEReachDataPush : AEReachContent
{
@private
AEDatapushType _type;
}
/**
* Parse an announcement
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the body of the datapush.
* @result A new announcement or nil if it couldn't be parsed.
*/
+ (id)datapushWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
/**
* Get the type for this data push.
*
* Possible values are:
*
* - `AEDatapushTypeUnknown`: Unknown data push type
* - `AEDatapushTypeText`: A text data push
* - `AEDatapushTypeBase64`: A base 64 data push
*/
@property(readonly) AEDatapushType type;
/** Get decoded body. Only apply on base 64 data pushes (return `nil` for other types). */
@property(readonly) NSData* decodedBody;
@end

Просмотреть файл

@ -1,38 +1,38 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* The `AEReachDataPushDelegate` protocol defines methods a delegate of <AEReachModule> should implement to receive data
* pushes.
*
* To process data push, you must implement method <onDataPushBase64ReceivedWithDecodedBody:andEncodedBody:>
* if it's a file upload or a base64 data, otherwise you implement <onDataPushStringReceived:>.<br>
* To use it in your application just call the method <[AEReachModule dataPushDelegate]> after module
* initialization.
*/
@protocol AEReachDataPushDelegate <UIAlertViewDelegate>
@optional
/**
* This function is called when a datapush of type text has been received.
* @param category short string describing your data to push
* @param body Your content.
* @result YES to acknowledge the content, NO to cancel.
**/
- (BOOL)didReceiveStringDataPushWithCategory:(NSString*)category body:(NSString*)body;
/**
* This function is called when a datapush of type base64 has been received.
* @param category short string describing your data to push
* @param decodedBody Your base64 content decoded.
* @param encodedBody Your base64 content encoded.
* @result YES to acknowledge the content, NO to cancel.
**/
- (BOOL)didReceiveBase64DataPushWithCategory:(NSString*)category decodedBody:(NSData*)decodedBody encodedBody:(NSString*)
encodedBody;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* The `AEReachDataPushDelegate` protocol defines methods a delegate of <AEReachModule> should implement to receive data
* pushes.
*
* To process data push, you must implement method <onDataPushBase64ReceivedWithDecodedBody:andEncodedBody:>
* if it's a file upload or a base64 data, otherwise you implement <onDataPushStringReceived:>.<br>
* To use it in your application just call the method <[AEReachModule dataPushDelegate]> after module
* initialization.
*/
@protocol AEReachDataPushDelegate <UIAlertViewDelegate>
@optional
/**
* This function is called when a datapush of type text has been received.
* @param category short string describing your data to push
* @param body Your content.
* @result YES to acknowledge the content, NO to cancel.
**/
- (BOOL)didReceiveStringDataPushWithCategory:(NSString*)category body:(NSString*)body;
/**
* This function is called when a datapush of type base64 has been received.
* @param category short string describing your data to push
* @param decodedBody Your base64 content decoded.
* @param encodedBody Your base64 content encoded.
* @result YES to acknowledge the content, NO to cancel.
**/
- (BOOL)didReceiveBase64DataPushWithCategory:(NSString*)category decodedBody:(NSData*)decodedBody encodedBody:(NSString*)
encodedBody;
@end

Просмотреть файл

@ -1,167 +1,167 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AEModule.h"
#import "AEReachDataPushDelegate.h"
#import "AENotifier.h"
@class AEStorage;
@class AEContentViewController;
/* Export module name */
extern NSString* const kAEReachModuleName;
/* Export reach xml namespace */
extern NSString* const kAEReachNamespace;
/* Export reach default category */
extern NSString* const kAEReachDefaultCategory;
/* Reach module state */
typedef enum _AEReachModuleState
{
AEReachModuleStateIdle = 1,
AEReachModuleStateNotifying = 2,
AEReachModuleStateShowing = 3
} AEReachModuleState;
/**
* The Reach Engagement module
*
* This is the module that manage reach functionalities. It listens push messages thanks to
* <[AEModule pushMessagesReceived:]> and <[AEModule displayPushMessageNotification:]> and notify the user
* about announcements and polls.<br>
* You usually create the module using the method moduleWithNotificationIcon: and pass it when you initialize Engagement
* (using method <[EngagementAgent init:modules:]>)
*
* *Example of a basic integration:*
*
* - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
* AEReachModule* reach = [AEReachModule moduleWithNotificationIcon:[UIImage imageNamed:@"icon.png"]];
* [EngagementAgent init:@"Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}" modules:reach, nil];
*
* ...
*
* return YES;
* }
*
*/
@interface AEReachModule : NSObject<AEModule>
{
@private
/* Storage */
AEStorage* _db;
/* Processed messages storage */
AEStorage* _processedMessages;
/* Remote Notification Info */
NSDictionary* _remoteNotificationInfo;
/* Entries scheduled to be removed */
NSMutableIndexSet* _trash;
/* Scanning db storage context */
BOOL _scanning;
/* Current state */
AEReachModuleState _state;
/** The message identifier being processed */
NSUInteger _processingId;
/* Current activity */
NSString* _currentActivity;
/* Announcement controller classes by category */
NSMutableDictionary* _announcementControllers;
/* Poll controller classes by category */
NSMutableDictionary* _pollControllers;
/* Notification handlers by category */
NSMutableDictionary* _notifiers;
/* Special parameters to inject in announcement's action url and body */
NSDictionary* _params;
/* Remember if the agent has been started or not */
BOOL _isStarted;
/* Data push delegate */
id<AEReachDataPushDelegate> _dataPushDelegate;
/* Current displayed controller */
AEContentViewController* _displayedController;
/* Auto badge */
BOOL _autoBadgeEnabled;
BOOL _badgeNotificationReceived;
/* Maximum number of contents */
NSUInteger _maxContents;
}
/**
* Instantiate a new reach Engagement module.
* @param icon The image to use as the notification icon
*/
+ (id)moduleWithNotificationIcon:(UIImage*)icon;
/**
* Enable or disable automatic control of the badge value. If enabled, the Reach module will automatically
* clear the application badge and also reset the value stored by Engagement every time the application
* is started or foregrounded.
* @param enabled YES to enable auto badge, NO otherwise (Disabled by default).
*/
- (void)setAutoBadgeEnabled:(BOOL)enabled;
/**
* Set the maximum number of in-app campaigns that can be displayed.
* @param maxCampaigns The maximum number of in-app campaigns that can be displayed (0 to disable in-app campaigns).
*/
- (void)setMaxInAppCampaigns:(NSUInteger)maxCampaigns;
/**
* Register an announcement category.
* @param category The name of the category to map.
* @param clazz The associated view controller class to instantiate when an announcement of the given
* category is received. The controller class should inherit from <AEAnnouncementViewController>.
*/
- (void)registerAnnouncementController:(Class)clazz forCategory:(NSString*)category;
/**
* Register a poll category.
* @param category The name of the category to map.
* @param clazz The associated view controller class to instantiate when an poll of the given
* category is received. The controller class should inherit from <AEPollViewController>.
*/
- (void)registerPollController:(Class)clazz forCategory:(NSString*)category;
/**
* Register a notifier for a given category.
* @param notifier Notifier to register for a category.
* @param category The name of the category.
*/
- (void)registerNotifier:(id<AENotifier>)notifier forCategory:(NSString*)category;
/**
* Mark given content processed. It will be removed from cache,
* and any other waiting contents will be displayed to the user.
* @param content The content to mark as processed.
*/
- (void)markContentProcessed:(AEReachContent*)content;
/**
* Called when a notification is actioned.
* @param content The content associated to the notification.
*/
- (void)onNotificationActioned:(AEReachContent*)content;
/** The delegate that will handle data pushes. */
@property(nonatomic, retain) id<AEReachDataPushDelegate> dataPushDelegate;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "AEModule.h"
#import "AEReachDataPushDelegate.h"
#import "AENotifier.h"
@class AEStorage;
@class AEContentViewController;
/* Export module name */
extern NSString* const kAEReachModuleName;
/* Export reach xml namespace */
extern NSString* const kAEReachNamespace;
/* Export reach default category */
extern NSString* const kAEReachDefaultCategory;
/* Reach module state */
typedef enum _AEReachModuleState
{
AEReachModuleStateIdle = 1,
AEReachModuleStateNotifying = 2,
AEReachModuleStateShowing = 3
} AEReachModuleState;
/**
* The Reach Engagement module
*
* This is the module that manage reach functionalities. It listens push messages thanks to
* <[AEModule pushMessagesReceived:]> and <[AEModule displayPushMessageNotification:]> and notify the user
* about announcements and polls.<br>
* You usually create the module using the method moduleWithNotificationIcon: and pass it when you initialize Engagement
* (using method <[EngagementAgent init:modules:]>)
*
* *Example of a basic integration:*
*
* - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
* AEReachModule* reach = [AEReachModule moduleWithNotificationIcon:[UIImage imageNamed:@"icon.png"]];
* [EngagementAgent init:@"Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}" modules:reach, nil];
*
* ...
*
* return YES;
* }
*
*/
@interface AEReachModule : NSObject<AEModule>
{
@private
/* Storage */
AEStorage* _db;
/* Processed messages storage */
AEStorage* _processedMessages;
/* Remote Notification Info */
NSDictionary* _remoteNotificationInfo;
/* Entries scheduled to be removed */
NSMutableIndexSet* _trash;
/* Scanning db storage context */
BOOL _scanning;
/* Current state */
AEReachModuleState _state;
/** The message identifier being processed */
NSUInteger _processingId;
/* Current activity */
NSString* _currentActivity;
/* Announcement controller classes by category */
NSMutableDictionary* _announcementControllers;
/* Poll controller classes by category */
NSMutableDictionary* _pollControllers;
/* Notification handlers by category */
NSMutableDictionary* _notifiers;
/* Special parameters to inject in announcement's action url and body */
NSDictionary* _params;
/* Remember if the agent has been started or not */
BOOL _isStarted;
/* Data push delegate */
id<AEReachDataPushDelegate> _dataPushDelegate;
/* Current displayed controller */
AEContentViewController* _displayedController;
/* Auto badge */
BOOL _autoBadgeEnabled;
BOOL _badgeNotificationReceived;
/* Maximum number of contents */
NSUInteger _maxContents;
}
/**
* Instantiate a new reach Engagement module.
* @param icon The image to use as the notification icon
*/
+ (id)moduleWithNotificationIcon:(UIImage*)icon;
/**
* Enable or disable automatic control of the badge value. If enabled, the Reach module will automatically
* clear the application badge and also reset the value stored by Engagement every time the application
* is started or foregrounded.
* @param enabled YES to enable auto badge, NO otherwise (Disabled by default).
*/
- (void)setAutoBadgeEnabled:(BOOL)enabled;
/**
* Set the maximum number of in-app campaigns that can be displayed.
* @param maxCampaigns The maximum number of in-app campaigns that can be displayed (0 to disable in-app campaigns).
*/
- (void)setMaxInAppCampaigns:(NSUInteger)maxCampaigns;
/**
* Register an announcement category.
* @param category The name of the category to map.
* @param clazz The associated view controller class to instantiate when an announcement of the given
* category is received. The controller class should inherit from <AEAnnouncementViewController>.
*/
- (void)registerAnnouncementController:(Class)clazz forCategory:(NSString*)category;
/**
* Register a poll category.
* @param category The name of the category to map.
* @param clazz The associated view controller class to instantiate when an poll of the given
* category is received. The controller class should inherit from <AEPollViewController>.
*/
- (void)registerPollController:(Class)clazz forCategory:(NSString*)category;
/**
* Register a notifier for a given category.
* @param notifier Notifier to register for a category.
* @param category The name of the category.
*/
- (void)registerNotifier:(id<AENotifier>)notifier forCategory:(NSString*)category;
/**
* Mark given content processed. It will be removed from cache,
* and any other waiting contents will be displayed to the user.
* @param content The content to mark as processed.
*/
- (void)markContentProcessed:(AEReachContent*)content;
/**
* Called when a notification is actioned.
* @param content The content associated to the notification.
*/
- (void)onNotificationActioned:(AEReachContent*)content;
/** The delegate that will handle data pushes. */
@property(nonatomic, retain) id<AEReachDataPushDelegate> dataPushDelegate;
@end

Просмотреть файл

@ -1,26 +1,26 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEReachAbstractAnnouncement.h"
/**
* The `AEReachNotifAnnouncement` class defines objects that represent a Engagement _notification only_ announcement.
*
* This is a special announcement used when you just want to display the notification (application banner or apple
* push).
* When the user clicks on the notification, the action url is launched, and the announcement is acknownledged.
*/
@interface AEReachNotifAnnouncement : AEReachAbstractAnnouncement
/**
* Parse a notif announcement
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the action URL.
* @result A new notif announcement or nil if it couldn't be parsed.
*/
+ (id)notifAnnouncementWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEReachAbstractAnnouncement.h"
/**
* The `AEReachNotifAnnouncement` class defines objects that represent a Engagement _notification only_ announcement.
*
* This is a special announcement used when you just want to display the notification (application banner or apple
* push).
* When the user clicks on the notification, the action url is launched, and the announcement is acknownledged.
*/
@interface AEReachNotifAnnouncement : AEReachAbstractAnnouncement
/**
* Parse a notif announcement
* @param element Parsed XML root DOM element.
* @param params special parameters to replace in the action URL.
* @result A new notif announcement or nil if it couldn't be parsed.
*/
+ (id)notifAnnouncementWithElement:(AE_TBXMLElt*)element params:(NSDictionary*)params;
@end

Просмотреть файл

@ -1,45 +1,45 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEInteractiveContent.h"
/**
* The `AEReachPoll` class defines objects that represent generic Engagement poll.
*
* You usually have to use this class when you implement your own poll
* view controller.
*
* **See also**
*
* - <AEPollViewController>
*/
@interface AEReachPoll : AEInteractiveContent {
@private
NSArray* _questions;
NSMutableDictionary* _answers;
}
/**
* Poll questions.<br>
* Contains <AEReachPollQuestion> objects.
*/
@property(readonly) NSArray* questions;
/**
* Parse a poll
* @param element Parsed XML root DOM element.
* @result A new poll or nil if it couldn't be parsed.
*/
+ (id)pollWithElement:(AE_TBXMLElt*)element;
/**
* Fill answer for a given question. Answers are sent when calling <[AEReachContent actionContent]>.
* @param qid Question id as specified in <[AEReachPollQuestion questionId]>.
* @param cid Choice id as specified in <[AEReachPollChoice choiceId]>.
* @see questions
*/
- (void)fillAnswerWithQuestionId:(NSString*)qid choiceId:(NSString*)cid;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AEInteractiveContent.h"
/**
* The `AEReachPoll` class defines objects that represent generic Engagement poll.
*
* You usually have to use this class when you implement your own poll
* view controller.
*
* **See also**
*
* - <AEPollViewController>
*/
@interface AEReachPoll : AEInteractiveContent {
@private
NSArray* _questions;
NSMutableDictionary* _answers;
}
/**
* Poll questions.<br>
* Contains <AEReachPollQuestion> objects.
*/
@property(readonly) NSArray* questions;
/**
* Parse a poll
* @param element Parsed XML root DOM element.
* @result A new poll or nil if it couldn't be parsed.
*/
+ (id)pollWithElement:(AE_TBXMLElt*)element;
/**
* Fill answer for a given question. Answers are sent when calling <[AEReachContent actionContent]>.
* @param qid Question id as specified in <[AEReachPollQuestion questionId]>.
* @param cid Choice id as specified in <[AEReachPollChoice choiceId]>.
* @see questions
*/
- (void)fillAnswerWithQuestionId:(NSString*)qid choiceId:(NSString*)cid;
@end

Просмотреть файл

@ -1,66 +1,66 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AE_TBXML.h"
/**
* The `AEReachPollQuestion` class defines objects that represent poll's questions
*/
@interface AEReachPollQuestion : NSObject {
@private
NSString* _questionId;
NSString* _title;
NSArray* _choices;
}
/**
* Create and return a poll's question.
* @param qId The unique identifier for the quetion.
* @param title The question's title.
* @param choices The question's choices.
*/
- (id)initWithId:(NSString*)qId title:(NSString*)title choices:(NSArray*)choices;
/** The unique question identifier */
@property(readonly) NSString* questionId;
/** Localized question text */
@property(readonly) NSString* title;
/**
* Choices.<br>
* Contains <AEReachPollChoice> objects
*/
@property(readonly) NSArray* choices;
@end
/**
* The `AEReachPollQuestion` class defines objects that represent poll's choices
*/
@interface AEReachPollChoice : NSObject {
@private
NSString* _choiceId;
NSString* _title;
BOOL _isDefault;
}
/**
* Create and return a question's choice.
* @param cId The unique identifier for the choice.
* @param title The choice's title.
* @param isDefault Is this the default choice for the associated question.
*/
- (id)initWithId:(NSString*)cId title:(NSString*)title isDefault:(BOOL)isDefault;
/** The unique choice identifier */
@property(readonly) NSString* choiceId;
/** The localized choice text */
@property(readonly) NSString* title;
/** YES if this choice is the default one for the associated question. */
@property(readonly) BOOL isDefault;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AE_TBXML.h"
/**
* The `AEReachPollQuestion` class defines objects that represent poll's questions
*/
@interface AEReachPollQuestion : NSObject {
@private
NSString* _questionId;
NSString* _title;
NSArray* _choices;
}
/**
* Create and return a poll's question.
* @param qId The unique identifier for the quetion.
* @param title The question's title.
* @param choices The question's choices.
*/
- (id)initWithId:(NSString*)qId title:(NSString*)title choices:(NSArray*)choices;
/** The unique question identifier */
@property(readonly) NSString* questionId;
/** Localized question text */
@property(readonly) NSString* title;
/**
* Choices.<br>
* Contains <AEReachPollChoice> objects
*/
@property(readonly) NSArray* choices;
@end
/**
* The `AEReachPollQuestion` class defines objects that represent poll's choices
*/
@interface AEReachPollChoice : NSObject {
@private
NSString* _choiceId;
NSString* _title;
BOOL _isDefault;
}
/**
* Create and return a question's choice.
* @param cId The unique identifier for the choice.
* @param title The choice's title.
* @param isDefault Is this the default choice for the associated question.
*/
- (id)initWithId:(NSString*)cId title:(NSString*)title isDefault:(BOOL)isDefault;
/** The unique choice identifier */
@property(readonly) NSString* choiceId;
/** The localized choice text */
@property(readonly) NSString* title;
/** YES if this choice is the default one for the associated question. */
@property(readonly) BOOL isDefault;
@end

Просмотреть файл

@ -1,43 +1,43 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* The `AEViewControllerUtil` provides utility methods to present and dismiss view controllers on screen.
*/
@interface AEViewControllerUtil : NSObject
/**
* Present the controller's view inside the key window using a vetical cover animation:
* The view slides up from the bottom of the screen.
* The given controller will be retained until method <dismissViewController:> is called.
* @param controller The view controller to present.
*/
+ (void)presentViewController:(UIViewController*)controller;
/**
* Dismiss the given view controller. Remove the view from it's parent using a vertical slide animation.
* The controller is released.
* @param controller The view controller to dismiss.
* @see dismissViewController:animated:
*/
+ (void)dismissViewController:(UIViewController*)controller;
/**
* Dismiss the given view controller.
* The controller is released.
* @param controller The view controller to dismiss
* @param animated If YES, animates the view; otherwise, does not.
* @see dismissViewController:
*/
+ (void)dismissViewController:(UIViewController*)controller animated:(BOOL)animated;
/**
* Get an available window for this application.
*/
+ (UIWindow*)availableWindow;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* The `AEViewControllerUtil` provides utility methods to present and dismiss view controllers on screen.
*/
@interface AEViewControllerUtil : NSObject
/**
* Present the controller's view inside the key window using a vetical cover animation:
* The view slides up from the bottom of the screen.
* The given controller will be retained until method <dismissViewController:> is called.
* @param controller The view controller to present.
*/
+ (void)presentViewController:(UIViewController*)controller;
/**
* Dismiss the given view controller. Remove the view from it's parent using a vertical slide animation.
* The controller is released.
* @param controller The view controller to dismiss.
* @see dismissViewController:animated:
*/
+ (void)dismissViewController:(UIViewController*)controller;
/**
* Dismiss the given view controller.
* The controller is released.
* @param controller The view controller to dismiss
* @param animated If YES, animates the view; otherwise, does not.
* @see dismissViewController:
*/
+ (void)dismissViewController:(UIViewController*)controller animated:(BOOL)animated;
/**
* Get an available window for this application.
*/
+ (UIWindow*)availableWindow;
@end

Просмотреть файл

@ -1,61 +1,61 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@protocol AEWebAnnouncementActionDelegate;
/**
*
* Javascript bridge used by web announcements.
*
* Create a bridge between javascript methods embed inside a web announcement and objective c methods
* defined in <AEWebAnnouncementActionDelegate>.<br>
* The mapping is as follow:
* - *engagementReachContent.actionContent()* is mapped to <[AEWebAnnouncementActionDelegate action]>
* - *engagementReachContent.exitContent()* is mapped to <[AEWebAnnouncementActionDelegate exit]>
*
* This class must be used in association with a `UIWebView`:
*
* [webView setDelegate:[AEWebAnnouncementJsBridge jsBridgeWithDelegate:self]];
*
*/
@interface AEWebAnnouncementJsBridge : NSObject<UIWebViewDelegate>
{
@private
id<AEWebAnnouncementActionDelegate> _delegate;
}
/**
* Create a bridge between Javascript functions and Objective C methods.<br>
* Used the returned object as a delegate to an existing `UIWebView`.
* @param delegate The delegate that will receive reach actions each time a recognized Javascript function is called.
*/
+ (id)jsBridgeWithDelegate:(id<AEWebAnnouncementActionDelegate>)delegate;
@end
/**
* The `AEWebAnnouncementActionDelegate` protocol defines the methods a delegate of a <AEWebAnnouncementJsBridge> object
* should implement.
*
* Each time a recognized Javascript method is called, the corresponding delegate method will be called.
* See methods definition for the list of recognized actions.
*/
@protocol AEWebAnnouncementActionDelegate <NSObject>
/**
* Mapped to the javascript function *engagementReachContent.actionContent()*<br>
* The announcement has been actioned.
*/
- (void)action;
/**
* Mapped to the javascript function *engagementReachContent.exitContent()*<br>
* The announcement has been exited.
*/
- (void)exit;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@protocol AEWebAnnouncementActionDelegate;
/**
*
* Javascript bridge used by web announcements.
*
* Create a bridge between javascript methods embed inside a web announcement and objective c methods
* defined in <AEWebAnnouncementActionDelegate>.<br>
* The mapping is as follow:
* - *engagementReachContent.actionContent()* is mapped to <[AEWebAnnouncementActionDelegate action]>
* - *engagementReachContent.exitContent()* is mapped to <[AEWebAnnouncementActionDelegate exit]>
*
* This class must be used in association with a `UIWebView`:
*
* [webView setDelegate:[AEWebAnnouncementJsBridge jsBridgeWithDelegate:self]];
*
*/
@interface AEWebAnnouncementJsBridge : NSObject<UIWebViewDelegate>
{
@private
id<AEWebAnnouncementActionDelegate> _delegate;
}
/**
* Create a bridge between Javascript functions and Objective C methods.<br>
* Used the returned object as a delegate to an existing `UIWebView`.
* @param delegate The delegate that will receive reach actions each time a recognized Javascript function is called.
*/
+ (id)jsBridgeWithDelegate:(id<AEWebAnnouncementActionDelegate>)delegate;
@end
/**
* The `AEWebAnnouncementActionDelegate` protocol defines the methods a delegate of a <AEWebAnnouncementJsBridge> object
* should implement.
*
* Each time a recognized Javascript method is called, the corresponding delegate method will be called.
* See methods definition for the list of recognized actions.
*/
@protocol AEWebAnnouncementActionDelegate <NSObject>
/**
* Mapped to the javascript function *engagementReachContent.actionContent()*<br>
* The announcement has been actioned.
*/
- (void)action;
/**
* Mapped to the javascript function *engagementReachContent.exitContent()*<br>
* The announcement has been exited.
*/
- (void)exit;
@end

Просмотреть файл

@ -1,129 +1,129 @@
// ================================================================================================
// AE_TBXML.h
// Fast processing of XML files
//
// ================================================================================================
// Created by Tom Bradley on 21/10/2009.
// Version 1.4
//
// Copyright (c) 2009 Tom Bradley
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ================================================================================================
#import <Foundation/Foundation.h>
// ================================================================================================
// Defines
// ================================================================================================
#define MAX_ELEMENTS 100
#define MAX_ATTRIBUTES 100
#define AE_TBXML_ATTRIBUTE_NAME_START 0
#define AE_TBXML_ATTRIBUTE_NAME_END 1
#define AE_TBXML_ATTRIBUTE_VALUE_START 2
#define AE_TBXML_ATTRIBUTE_VALUE_END 3
#define AE_TBXML_ATTRIBUTE_CDATA_END 4
// ================================================================================================
// Structures
// ================================================================================================
typedef struct _AE_TBXMLAttribute {
char * name;
char * value;
struct _AE_TBXMLAttribute * next;
} AE_TBXMLAttribute;
typedef struct _AE_TBXMLElt {
char * name;
char * text;
AE_TBXMLAttribute * firstAttribute;
struct _AE_TBXMLElt * parentElement;
struct _AE_TBXMLElt * firstChild;
struct _AE_TBXMLElt * currentChild;
struct _AE_TBXMLElt * nextSibling;
struct _AE_TBXMLElt * previousSibling;
} AE_TBXMLElt;
typedef struct _AE_TBXMLEltBuffer {
AE_TBXMLElt * elements;
struct _AE_TBXMLEltBuffer * next;
struct _AE_TBXMLEltBuffer * previous;
} AE_TBXMLEltBuffer;
typedef struct _AE_TBXMLAttributeBuffer {
AE_TBXMLAttribute * attributes;
struct _AE_TBXMLAttributeBuffer * next;
struct _AE_TBXMLAttributeBuffer * previous;
} AE_TBXMLAttributeBuffer;
// ================================================================================================
// AE_TBXML Public Interface
// ================================================================================================
@interface AE_TBXML : NSObject {
@private
AE_TBXMLElt * rootXMLElement;
AE_TBXMLEltBuffer * currentElementBuffer;
AE_TBXMLAttributeBuffer * currentAttributeBuffer;
long currentElement;
long currentAttribute;
char * bytes;
long bytesLength;
}
@property (nonatomic, readonly) AE_TBXMLElt * rootXMLElement;
+ (id)tbxmlWithURL:(NSURL*)aURL;
+ (id)tbxmlWithXMLString:(NSString*)aXMLString;
+ (id)tbxmlWithXMLData:(NSData*)aData;
- (id)initWithURL:(NSURL*)aURL;
- (id)initWithXMLString:(NSString*)aXMLString;
- (id)initWithXMLData:(NSData*)aData;
@end
// ================================================================================================
// AE_TBXML Static Functions Interface
// ================================================================================================
@interface AE_TBXML (StaticFunctions)
+ (NSString*) elementName:(AE_TBXMLElt*)aXMLElement;
+ (NSString*) textForElement:(AE_TBXMLElt*)aXMLElement;
+ (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(AE_TBXMLElt*)aXMLElement;
+ (NSString*) attributeName:(AE_TBXMLAttribute*)aXMLAttribute;
+ (NSString*) attributeValue:(AE_TBXMLAttribute*)aXMLAttribute;
+ (AE_TBXMLElt*) nextSiblingNamed:(NSString*)aName searchFromElement:(AE_TBXMLElt*)aXMLElement;
+ (AE_TBXMLElt*) childElementNamed:(NSString*)aName parentElement:(AE_TBXMLElt*)aParentXMLElement;
+ (NSString*) unescapeXML:(NSString*)source;
@end
// ================================================================================================
// AE_TBXML.h
// Fast processing of XML files
//
// ================================================================================================
// Created by Tom Bradley on 21/10/2009.
// Version 1.4
//
// Copyright (c) 2009 Tom Bradley
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ================================================================================================
#import <Foundation/Foundation.h>
// ================================================================================================
// Defines
// ================================================================================================
#define MAX_ELEMENTS 100
#define MAX_ATTRIBUTES 100
#define AE_TBXML_ATTRIBUTE_NAME_START 0
#define AE_TBXML_ATTRIBUTE_NAME_END 1
#define AE_TBXML_ATTRIBUTE_VALUE_START 2
#define AE_TBXML_ATTRIBUTE_VALUE_END 3
#define AE_TBXML_ATTRIBUTE_CDATA_END 4
// ================================================================================================
// Structures
// ================================================================================================
typedef struct _AE_TBXMLAttribute {
char * name;
char * value;
struct _AE_TBXMLAttribute * next;
} AE_TBXMLAttribute;
typedef struct _AE_TBXMLElt {
char * name;
char * text;
AE_TBXMLAttribute * firstAttribute;
struct _AE_TBXMLElt * parentElement;
struct _AE_TBXMLElt * firstChild;
struct _AE_TBXMLElt * currentChild;
struct _AE_TBXMLElt * nextSibling;
struct _AE_TBXMLElt * previousSibling;
} AE_TBXMLElt;
typedef struct _AE_TBXMLEltBuffer {
AE_TBXMLElt * elements;
struct _AE_TBXMLEltBuffer * next;
struct _AE_TBXMLEltBuffer * previous;
} AE_TBXMLEltBuffer;
typedef struct _AE_TBXMLAttributeBuffer {
AE_TBXMLAttribute * attributes;
struct _AE_TBXMLAttributeBuffer * next;
struct _AE_TBXMLAttributeBuffer * previous;
} AE_TBXMLAttributeBuffer;
// ================================================================================================
// AE_TBXML Public Interface
// ================================================================================================
@interface AE_TBXML : NSObject {
@private
AE_TBXMLElt * rootXMLElement;
AE_TBXMLEltBuffer * currentElementBuffer;
AE_TBXMLAttributeBuffer * currentAttributeBuffer;
long currentElement;
long currentAttribute;
char * bytes;
long bytesLength;
}
@property (nonatomic, readonly) AE_TBXMLElt * rootXMLElement;
+ (id)tbxmlWithURL:(NSURL*)aURL;
+ (id)tbxmlWithXMLString:(NSString*)aXMLString;
+ (id)tbxmlWithXMLData:(NSData*)aData;
- (id)initWithURL:(NSURL*)aURL;
- (id)initWithXMLString:(NSString*)aXMLString;
- (id)initWithXMLData:(NSData*)aData;
@end
// ================================================================================================
// AE_TBXML Static Functions Interface
// ================================================================================================
@interface AE_TBXML (StaticFunctions)
+ (NSString*) elementName:(AE_TBXMLElt*)aXMLElement;
+ (NSString*) textForElement:(AE_TBXMLElt*)aXMLElement;
+ (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(AE_TBXMLElt*)aXMLElement;
+ (NSString*) attributeName:(AE_TBXMLAttribute*)aXMLAttribute;
+ (NSString*) attributeValue:(AE_TBXMLAttribute*)aXMLAttribute;
+ (AE_TBXMLElt*) nextSiblingNamed:(NSString*)aName searchFromElement:(AE_TBXMLElt*)aXMLElement;
+ (AE_TBXMLElt*) childElementNamed:(NSString*)aName parentElement:(AE_TBXMLElt*)aParentXMLElement;
+ (NSString*) unescapeXML:(NSString*)source;
@end

Просмотреть файл

@ -1,60 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AEDefaultAnnouncementViewController">
<connections>
<outlet property="textView" destination="11" id="30"/>
<outlet property="titleBar" destination="3" id="31"/>
<outlet property="toolbar" destination="22" id="32"/>
<outlet property="view" destination="1" id="16"/>
<outlet property="webView" destination="20" id="33"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="1">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar opaque="NO" tag="1" contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<items>
<navigationItem title="Title" id="4"/>
</items>
</navigationBar>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" tag="2" contentMode="scaleToFill" bounces="NO" showsHorizontalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" bouncesZoom="NO" editable="NO" id="11">
<rect key="frame" x="0.0" y="44" width="320" height="393"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="18"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES"/>
</textView>
<webView tag="3" contentMode="scaleToFill" id="20">
<rect key="frame" x="0.0" y="44" width="320" height="392"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</webView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" tag="4" contentMode="scaleToFill" id="22">
<rect key="frame" x="0.0" y="436" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items>
<barButtonItem tag="5" title="Item" width="148" id="24"/>
</items>
</toolbar>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AEDefaultAnnouncementViewController">
<connections>
<outlet property="textView" destination="11" id="30"/>
<outlet property="titleBar" destination="3" id="31"/>
<outlet property="toolbar" destination="22" id="32"/>
<outlet property="view" destination="1" id="16"/>
<outlet property="webView" destination="20" id="33"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="1">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar opaque="NO" tag="1" contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<items>
<navigationItem title="Title" id="4"/>
</items>
</navigationBar>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" tag="2" contentMode="scaleToFill" bounces="NO" showsHorizontalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" bouncesZoom="NO" editable="NO" id="11">
<rect key="frame" x="0.0" y="44" width="320" height="393"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="18"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES"/>
</textView>
<webView tag="3" contentMode="scaleToFill" id="20">
<rect key="frame" x="0.0" y="44" width="320" height="392"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</webView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" tag="4" contentMode="scaleToFill" id="22">
<rect key="frame" x="0.0" y="436" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items>
<barButtonItem tag="5" title="Item" width="148" id="24"/>
</items>
</toolbar>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

Просмотреть файл

@ -1,52 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AEDefaultPollViewController">
<connections>
<outlet property="tableView" destination="17" id="18"/>
<outlet property="titleBar" destination="7" id="15"/>
<outlet property="toolbar" destination="27" id="48"/>
<outlet property="view" destination="3" id="16"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<subviews>
<navigationBar opaque="NO" contentMode="scaleToFill" id="7">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<items>
<navigationItem title="Title" id="36"/>
</items>
</navigationBar>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="10" id="17">
<rect key="frame" x="0.0" y="44" width="320" height="392"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="21"/>
<outlet property="delegate" destination="-1" id="22"/>
</connections>
</tableView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="27">
<rect key="frame" x="0.0" y="436" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items/>
</toolbar>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AEDefaultPollViewController">
<connections>
<outlet property="tableView" destination="17" id="18"/>
<outlet property="titleBar" destination="7" id="15"/>
<outlet property="toolbar" destination="27" id="48"/>
<outlet property="view" destination="3" id="16"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<subviews>
<navigationBar opaque="NO" contentMode="scaleToFill" id="7">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<items>
<navigationItem title="Title" id="36"/>
</items>
</navigationBar>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="10" id="17">
<rect key="frame" x="0.0" y="44" width="320" height="392"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="21"/>
<outlet property="delegate" destination="-1" id="22"/>
</connections>
</tableView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="27">
<rect key="frame" x="0.0" y="436" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items/>
</toolbar>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

Просмотреть файл

@ -1,74 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view alpha="0.80000001192092896" contentMode="scaleToFill" id="5" userLabel="Default Notification View" customClass="AENotificationView">
<rect key="frame" x="0.0" y="0.0" width="328" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="1" contentMode="scaleToFill" id="6">
<rect key="frame" x="0.0" y="5" width="50" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="Label" lineBreakMode="tailTruncation" minimumFontSize="10" adjustsFontSizeToFit="NO" id="7" userLabel="Title label">
<rect key="frame" x="55" y="9" width="220" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="3" contentMode="top" text="Test of a long notification description. See what happens there. Bla bla bla bla." lineBreakMode="tailTruncation" numberOfLines="2" minimumFontSize="10" adjustsFontSizeToFit="NO" id="8" userLabel="Description label">
<rect key="frame" x="55" y="25" width="220" height="32"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="12"/>
<color key="textColor" red="0.81478029819999997" green="0.81478029819999997" blue="0.81478029819999997" alpha="1" colorSpace="calibratedRGB"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<imageView userInteractionEnabled="NO" tag="4" contentMode="scaleAspectFit" id="19">
<rect key="frame" x="264" y="0.0" width="64" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" tag="5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="10" userLabel="Notif button">
<rect key="frame" x="0.0" y="0.0" width="290" height="55"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
<state key="normal">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<button opaque="NO" tag="6" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="9" userLabel="Close button">
<rect key="frame" x="289" y="15" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
<state key="normal" image="close.png">
<color key="titleColor" red="0.1960784314" green="0.30980392159999998" blue="0.52156862749999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
<image name="close.png" width="35" height="34"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view alpha="0.80000001192092896" contentMode="scaleToFill" id="5" userLabel="Default Notification View" customClass="AENotificationView">
<rect key="frame" x="0.0" y="0.0" width="328" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="1" contentMode="scaleToFill" id="6">
<rect key="frame" x="0.0" y="5" width="50" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="Label" lineBreakMode="tailTruncation" minimumFontSize="10" adjustsFontSizeToFit="NO" id="7" userLabel="Title label">
<rect key="frame" x="55" y="9" width="220" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="3" contentMode="top" text="Test of a long notification description. See what happens there. Bla bla bla bla." lineBreakMode="tailTruncation" numberOfLines="2" minimumFontSize="10" adjustsFontSizeToFit="NO" id="8" userLabel="Description label">
<rect key="frame" x="55" y="25" width="220" height="32"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="12"/>
<color key="textColor" red="0.81478029819999997" green="0.81478029819999997" blue="0.81478029819999997" alpha="1" colorSpace="calibratedRGB"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<imageView userInteractionEnabled="NO" tag="4" contentMode="scaleAspectFit" id="19">
<rect key="frame" x="264" y="0.0" width="64" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" tag="5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="10" userLabel="Notif button">
<rect key="frame" x="0.0" y="0.0" width="290" height="55"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
<state key="normal">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<button opaque="NO" tag="6" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="9" userLabel="Close button">
<rect key="frame" x="289" y="15" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
<state key="normal" image="close.png">
<color key="titleColor" red="0.1960784314" green="0.30980392159999998" blue="0.52156862749999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
<image name="close.png" width="35" height="34"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

Просмотреть файл

@ -1,43 +1,43 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* Provider for the Apple IDFA.
*
* This class must be integrated into your project whether you want Engagement to collect the IDFA or not. By default,
* this class will return the actual
* advertising identifier (on iOS 6+) using the AdSupport framework. This can be disabled by adding the preprocessor
* macro named `ENGAGEMENT_DISABLE_IDFA`.
*
*/
@interface AEIdfaProvider : NSObject
/**
* The singleton instance of the IDFA provider.
*
* @return a shared instance of `AEIdfaProvider`.
*/
+ (id)shared;
/**
* Check if IDFA reporting is enabled and ad tracking is enabled or not.
*
* @return A Boolean NSNumber that indicates whether the user has limited ad tracking or nil
* if IDFA reporting is not enabled.
*/
- (NSNumber*)isIdfaEnabled;
/* Return the identifier for advertisers or nil if not enabled/available. */
/**
* Get the advertising identifier UUID value.
*
* @return the value of the advertising identifier or nil if ad tracking is disabled
* or IDFA collection is disabled.
*/
- (NSString*)idfa;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* Provider for the Apple IDFA.
*
* This class must be integrated into your project whether you want Engagement to collect the IDFA or not. By default,
* this class will return the actual
* advertising identifier (on iOS 6+) using the AdSupport framework. This can be disabled by adding the preprocessor
* macro named `ENGAGEMENT_DISABLE_IDFA`.
*
*/
@interface AEIdfaProvider : NSObject
/**
* The singleton instance of the IDFA provider.
*
* @return a shared instance of `AEIdfaProvider`.
*/
+ (id)shared;
/**
* Check if IDFA reporting is enabled and ad tracking is enabled or not.
*
* @return A Boolean NSNumber that indicates whether the user has limited ad tracking or nil
* if IDFA reporting is not enabled.
*/
- (NSNumber*)isIdfaEnabled;
/* Return the identifier for advertisers or nil if not enabled/available. */
/**
* Get the advertising identifier UUID value.
*
* @return the value of the advertising identifier or nil if ad tracking is disabled
* or IDFA collection is disabled.
*/
- (NSString*)idfa;
@end

Просмотреть файл

@ -1,72 +1,72 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "AEIdfaProvider.h"
#import <AdSupport/AdSupport.h>
@implementation AEIdfaProvider
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Singleton method
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)shared
{
static dispatch_once_t once;
static id sharedInstance;
dispatch_once(&once, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Public methods
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (NSNumber*)isIdfaEnabled
{
#ifndef ENGAGEMENT_DISABLE_IDFA
ASIdentifierManager* sharedManager = [self ASIdentifierManager];
if (sharedManager)
{
return [NSNumber numberWithBool:[sharedManager isAdvertisingTrackingEnabled]];
}
#endif
return nil;
}
- (NSString*)idfa
{
#ifndef ENGAGEMENT_DISABLE_IDFA
ASIdentifierManager* sharedManager = [self ASIdentifierManager];
if (sharedManager)
{
if ([sharedManager isAdvertisingTrackingEnabled])
{
return [[sharedManager advertisingIdentifier] UUIDString];
}
}
#endif
return nil;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Private methods
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef ENGAGEMENT_DISABLE_IDFA
- (ASIdentifierManager*)ASIdentifierManager
{
Class ASIdentifierManagerClass = NSClassFromString(@"ASIdentifierManager");
if (ASIdentifierManagerClass)
{
return [ASIdentifierManagerClass sharedManager];
}
return nil;
}
#endif
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "AEIdfaProvider.h"
#import <AdSupport/AdSupport.h>
@implementation AEIdfaProvider
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Singleton method
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)shared
{
static dispatch_once_t once;
static id sharedInstance;
dispatch_once(&once, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Public methods
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (NSNumber*)isIdfaEnabled
{
#ifndef ENGAGEMENT_DISABLE_IDFA
ASIdentifierManager* sharedManager = [self ASIdentifierManager];
if (sharedManager)
{
return [NSNumber numberWithBool:[sharedManager isAdvertisingTrackingEnabled]];
}
#endif
return nil;
}
- (NSString*)idfa
{
#ifndef ENGAGEMENT_DISABLE_IDFA
ASIdentifierManager* sharedManager = [self ASIdentifierManager];
if (sharedManager)
{
if ([sharedManager isAdvertisingTrackingEnabled])
{
return [[sharedManager advertisingIdentifier] UUIDString];
}
}
#endif
return nil;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Private methods
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef ENGAGEMENT_DISABLE_IDFA
- (ASIdentifierManager*)ASIdentifierManager
{
Class ASIdentifierManagerClass = NSClassFromString(@"ASIdentifierManager");
if (ASIdentifierManagerClass)
{
return [ASIdentifierManagerClass sharedManager];
}
return nil;
}
#endif
@end

Просмотреть файл

@ -1,102 +1,102 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class AEPushMessage;
/**
* The `AEModule` protocol defines an interface for Engagement modules
*
* You can pass a module in the Engagement initialization method.
*
* **Related methods**
*
* - <[EngagementAgent init:modules:]>
* - <[EngagementAgent getModule:]>
*/
@protocol AEModule<NSObject>
/**
* Start module.
* This method is called by the <EngagementAgent> when Engagement has been initialized.<br>
* You can start using Engagement agent methods at this point.
*/
- (void)start;
/**
* Stop module.
* This method is called by the <EngagementAgent> when Engagement is going to be released.<br>
* You should release uneeded resources in this method. You won't be able to call any methods from the <EngagementAgent>
* after this point.
*/
- (void)stop;
/**
* The unique name of the module
*/
- (NSString*)name;
@optional
/**
* Called when one or several push messages are received by Engagement.
* This does not include the push message if it has been received following application launch
* (typically when the user clicks on the Apple Push notification of the notification center).
* This message will be passed to the method <displayPushMessageNotification:> instead.
*
* @param msgs A list of <AEPushMessage> objects.
* @see AEPushMessage
*/
- (void)pushMessagesReceived:(NSArray*)msgs;
/**
* Called after the user clicks on an Apple notification handled by Engagement.
* The module receive the Engagement push message associated to the Apple
* notification in order to display it to the end-user.
* @param msg The Engagement push message to display.
* @result YES if given message has been processed and displayed, NO otherwise.
* @see AEPushMessage
*/
- (BOOL)displayPushMessageNotification:(AEPushMessage*)msg;
/**
* Called after the user clicks on an Apple notification that contains an action url.
* The module receive the Engagement push message associated to the Apple
* notification in order to display it to the end-user.
* @param userInfo The notification object.
* @result YES if given message has been processed and displayed, NO otherwise.
* @see AEPushMessage
*/
- (BOOL)displayPushMessageNotificationWithActionUrl:(NSDictionary*)userInfo;
/**
* Called when remote notification is received.
* @param userInfo The notification object.
* @result YES if given message has been processed and displayed, NO otherwise.
*/
- (BOOL)processRemoteNotification:(NSDictionary*)userInfo;
/**
* Called when Engagement has detected that the current activity has changed.
* @param activityName The name of the new activity.
*/
- (void)activityChanged:(NSString*)activityName;
/**
* Called when an Apple push notification is received.
* @param notification The notification payload.
*/
- (void)pushNotificationReceived:(NSDictionary*)notification;
/**
* Called when the deviceid or the appid has changed.
* You should use this method to clear the storage, for example.
* Careful : The module is not started yet.
*/
- (void)configurationChanged;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class AEPushMessage;
/**
* The `AEModule` protocol defines an interface for Engagement modules
*
* You can pass a module in the Engagement initialization method.
*
* **Related methods**
*
* - <[EngagementAgent init:modules:]>
* - <[EngagementAgent getModule:]>
*/
@protocol AEModule<NSObject>
/**
* Start module.
* This method is called by the <EngagementAgent> when Engagement has been initialized.<br>
* You can start using Engagement agent methods at this point.
*/
- (void)start;
/**
* Stop module.
* This method is called by the <EngagementAgent> when Engagement is going to be released.<br>
* You should release uneeded resources in this method. You won't be able to call any methods from the <EngagementAgent>
* after this point.
*/
- (void)stop;
/**
* The unique name of the module
*/
- (NSString*)name;
@optional
/**
* Called when one or several push messages are received by Engagement.
* This does not include the push message if it has been received following application launch
* (typically when the user clicks on the Apple Push notification of the notification center).
* This message will be passed to the method <displayPushMessageNotification:> instead.
*
* @param msgs A list of <AEPushMessage> objects.
* @see AEPushMessage
*/
- (void)pushMessagesReceived:(NSArray*)msgs;
/**
* Called after the user clicks on an Apple notification handled by Engagement.
* The module receive the Engagement push message associated to the Apple
* notification in order to display it to the end-user.
* @param msg The Engagement push message to display.
* @result YES if given message has been processed and displayed, NO otherwise.
* @see AEPushMessage
*/
- (BOOL)displayPushMessageNotification:(AEPushMessage*)msg;
/**
* Called after the user clicks on an Apple notification that contains an action url.
* The module receive the Engagement push message associated to the Apple
* notification in order to display it to the end-user.
* @param userInfo The notification object.
* @result YES if given message has been processed and displayed, NO otherwise.
* @see AEPushMessage
*/
- (BOOL)displayPushMessageNotificationWithActionUrl:(NSDictionary*)userInfo;
/**
* Called when remote notification is received.
* @param userInfo The notification object.
* @result YES if given message has been processed and displayed, NO otherwise.
*/
- (BOOL)processRemoteNotification:(NSDictionary*)userInfo;
/**
* Called when Engagement has detected that the current activity has changed.
* @param activityName The name of the new activity.
*/
- (void)activityChanged:(NSString*)activityName;
/**
* Called when an Apple push notification is received.
* @param notification The notification payload.
*/
- (void)pushNotificationReceived:(NSDictionary*)notification;
/**
* Called when the deviceid or the appid has changed.
* You should use this method to clear the storage, for example.
* Careful : The module is not started yet.
*/
- (void)configurationChanged;
@end

Просмотреть файл

@ -1,56 +1,56 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class AEPushMessage;
/**
* The `AEPushDelegate` protocol defines the messages sent to a delegate when a push message is received.
*
* This delegate can be given to the Engagement agent
* if you want to be notified of push messages coming from the Engagement Push Service.
*
* **Related method**
*
* - <[EngagementAgent setPushDelegate:]>
*/
@protocol AEPushDelegate<NSObject>
@optional
/**
* ----------------------------------------------------
* @name Messages coming from the Engagement Push Service
* ----------------------------------------------------
*/
/**
* Sent when a push message is received by the Engagement Push Service.
* @param message An object representing the Engagement message.
*/
- (void)didReceiveMessage:(AEPushMessage*)message;
/**
* Sent when Engagement is about to retrieve the push message that launched the application (from an Apple push
* notification).
* It is a good opportunity to start displaying a message to the end user indicating that data is being loaded.
*/
- (void)willRetrieveLaunchMessage;
/**
* Sent when Engagement failed to retrieve the push message that launched the application.
* Use this opportunity to hide any loading message and to display a dialog to the end user
* indicating that the message could not be fetched.
*/
- (void)didFailToRetrieveLaunchMessage;
/**
* Sent when Engagement received the push message that launched the application.
* Use this opportunity to to hide any loading message and display appropriate content to the end user.
* @param launchMessage An object representing the Engagement message that launched the application.
*/
- (void)didReceiveLaunchMessage:(AEPushMessage*)launchMessage;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class AEPushMessage;
/**
* The `AEPushDelegate` protocol defines the messages sent to a delegate when a push message is received.
*
* This delegate can be given to the Engagement agent
* if you want to be notified of push messages coming from the Engagement Push Service.
*
* **Related method**
*
* - <[EngagementAgent setPushDelegate:]>
*/
@protocol AEPushDelegate<NSObject>
@optional
/**
* ----------------------------------------------------
* @name Messages coming from the Engagement Push Service
* ----------------------------------------------------
*/
/**
* Sent when a push message is received by the Engagement Push Service.
* @param message An object representing the Engagement message.
*/
- (void)didReceiveMessage:(AEPushMessage*)message;
/**
* Sent when Engagement is about to retrieve the push message that launched the application (from an Apple push
* notification).
* It is a good opportunity to start displaying a message to the end user indicating that data is being loaded.
*/
- (void)willRetrieveLaunchMessage;
/**
* Sent when Engagement failed to retrieve the push message that launched the application.
* Use this opportunity to hide any loading message and to display a dialog to the end user
* indicating that the message could not be fetched.
*/
- (void)didFailToRetrieveLaunchMessage;
/**
* Sent when Engagement received the push message that launched the application.
* Use this opportunity to to hide any loading message and display appropriate content to the end user.
* @param launchMessage An object representing the Engagement message that launched the application.
*/
- (void)didReceiveLaunchMessage:(AEPushMessage*)launchMessage;
@end

Просмотреть файл

@ -1,32 +1,32 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* A `AEPushMessage` object represents a Engagement push message.
*
* Engagement push messages are passed through Engagement agent to modules and Engagement push delegate.
*
* **See also**
*
* - <[EngagementAgent setPushDelegate:]>
* - <AEPushDelegate>
* - <AEModule>
*/
@interface AEPushMessage : NSObject<NSCoding>
/** Message's identifier */
@property(nonatomic, copy) NSString* messageId;
/** Message's payload */
@property(nonatomic, copy) NSString* payload;
/** optional XMPP address to reply to (can be `nil`). */
@property(nonatomic, copy) NSString* replyTo;
/** YES if this message was retrieved from the cache, NO otherwise */
@property(nonatomic, assign) BOOL cached;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* A `AEPushMessage` object represents a Engagement push message.
*
* Engagement push messages are passed through Engagement agent to modules and Engagement push delegate.
*
* **See also**
*
* - <[EngagementAgent setPushDelegate:]>
* - <AEPushDelegate>
* - <AEModule>
*/
@interface AEPushMessage : NSObject<NSCoding>
/** Message's identifier */
@property(nonatomic, copy) NSString* messageId;
/** Message's payload */
@property(nonatomic, copy) NSString* payload;
/** optional XMPP address to reply to (can be `nil`). */
@property(nonatomic, copy) NSString* replyTo;
/** YES if this message was retrieved from the cache, NO otherwise */
@property(nonatomic, assign) BOOL cached;
@end

Просмотреть файл

@ -1,106 +1,106 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* Data storage used by Engagement.
*/
@interface AEStorage : NSObject<NSFastEnumeration>
/**
* Create a new storage.
* @param name The name of the store
* @param version The version of the store
* @param autoSync If `true` every operation on the store will be automatically written to the persistent storage.
* Otherwise, the synchronize method should be called manually. You should consider synchronizing the store manually
*/
+ (instancetype)storageWithName:(NSString*)name version:(double)version autoSync:(BOOL)autoSync;
/**
* Create a new storage.
* @param name The name of the store
* @param autoSync If `true` every operation on the store will be automatically written to the persistent storage.
* Otherwise, the synchronize method should be called manually. You should consider synchronizing the store manually
* @param capacity max number of enteries of the storage
*/
+ (instancetype)userDefaultstorageWithName:(NSString*)name autoSync:(BOOL)autoSync capacity:(NSUInteger)capacity;
/**
* Set the maximum capacity of the store.
* @param capacity Maximum number of entries to keep.
*/
- (void)setCapacity:(NSUInteger)capacity;
/**
* Put a new entry in the store.
* @param value Object to store. Should conform to `NSCoding`.
* @result A unique identifier associated to the new entry.
*/
- (NSUInteger)put:(id)value;
/**
* Put all entries in the store.
* @param values Objects to store.
* @result Unique identifiers associated to entries.
*/
- (NSIndexSet*)putAll:(NSArray*)values;
/**
* Remove an existing value from the store based on its unique identifier
* @param key Key's value to remove
*/
- (void)remove:(NSUInteger)key;
/** Clear any data from the store. Clear in memory data and remove persistant storage. */
- (void)clear;
/** Causes all in-memory data to be written to the persistent storage. */
- (void)synchronize;
/**
* Makes the given object the caches delegate.
* @param del The object to be registered as the delegate.
*/
- (void)setDelegate:(id)del;
@end
/**
* A `AEStorageEntry` object represents an entry in the <AEStorage>
*
* An object of this type is returned while enumerating through a <AEStorage> collection.
*/
@interface AEStorageEntry : NSObject<NSCoding>
/** Unique identifier of the associated data */
@property(nonatomic, assign) NSUInteger uid;
/** Underlying data */
@property(nonatomic, retain) NSObject<NSCoding>* data;
/**
* Create a new storage entry.
* @param uid Unique identifier of the entry.
* @param data The underlying data object.
*/
+ (instancetype)dataWithId:(NSUInteger)uid data:(NSObject<NSCoding>*)data;
@end
/**
* The delegate of an NSCache object implements this protocol to perform specialized actions
* when an object is about to be evicted from the cache.
*/
@protocol AEStorageDelegate<NSObject>
/**
* Called when an object is evicted from the cache.
* @param storage The storage with which the object of interest is associated.
* @param entry The entry of interest in the storage.
*/
+ (void)storage:(AEStorage*)storage didEvictEntry:(AEStorageEntry*)entry;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
/**
* Data storage used by Engagement.
*/
@interface AEStorage : NSObject<NSFastEnumeration>
/**
* Create a new storage.
* @param name The name of the store
* @param version The version of the store
* @param autoSync If `true` every operation on the store will be automatically written to the persistent storage.
* Otherwise, the synchronize method should be called manually. You should consider synchronizing the store manually
*/
+ (instancetype)storageWithName:(NSString*)name version:(double)version autoSync:(BOOL)autoSync;
/**
* Create a new storage.
* @param name The name of the store
* @param autoSync If `true` every operation on the store will be automatically written to the persistent storage.
* Otherwise, the synchronize method should be called manually. You should consider synchronizing the store manually
* @param capacity max number of enteries of the storage
*/
+ (instancetype)userDefaultstorageWithName:(NSString*)name autoSync:(BOOL)autoSync capacity:(NSUInteger)capacity;
/**
* Set the maximum capacity of the store.
* @param capacity Maximum number of entries to keep.
*/
- (void)setCapacity:(NSUInteger)capacity;
/**
* Put a new entry in the store.
* @param value Object to store. Should conform to `NSCoding`.
* @result A unique identifier associated to the new entry.
*/
- (NSUInteger)put:(id)value;
/**
* Put all entries in the store.
* @param values Objects to store.
* @result Unique identifiers associated to entries.
*/
- (NSIndexSet*)putAll:(NSArray*)values;
/**
* Remove an existing value from the store based on its unique identifier
* @param key Key's value to remove
*/
- (void)remove:(NSUInteger)key;
/** Clear any data from the store. Clear in memory data and remove persistant storage. */
- (void)clear;
/** Causes all in-memory data to be written to the persistent storage. */
- (void)synchronize;
/**
* Makes the given object the caches delegate.
* @param del The object to be registered as the delegate.
*/
- (void)setDelegate:(id)del;
@end
/**
* A `AEStorageEntry` object represents an entry in the <AEStorage>
*
* An object of this type is returned while enumerating through a <AEStorage> collection.
*/
@interface AEStorageEntry : NSObject<NSCoding>
/** Unique identifier of the associated data */
@property(nonatomic, assign) NSUInteger uid;
/** Underlying data */
@property(nonatomic, retain) NSObject<NSCoding>* data;
/**
* Create a new storage entry.
* @param uid Unique identifier of the entry.
* @param data The underlying data object.
*/
+ (instancetype)dataWithId:(NSUInteger)uid data:(NSObject<NSCoding>*)data;
@end
/**
* The delegate of an NSCache object implements this protocol to perform specialized actions
* when an object is about to be evicted from the cache.
*/
@protocol AEStorageDelegate<NSObject>
/**
* Called when an object is evicted from the cache.
* @param storage The storage with which the object of interest is associated.
* @param entry The entry of interest in the storage.
*/
+ (void)storage:(AEStorage*)storage didEvictEntry:(AEStorageEntry*)entry;
@end

Просмотреть файл

@ -1,381 +1,381 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
extern NSString* const kEngagementAgentEnabled;
@protocol AEPushDelegate;
@protocol AEModule;
/**
* # The main Engagement class #
*
* Initialize the agent when your application starts:
*
* - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
* {
* [...]
* [EngagementAgent init:@"Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}"];
* [...]
* }
*/
@interface EngagementAgent : NSObject
/**
* ---------------------------
* @name Initializing Engagement
* ---------------------------
*/
/**
* This information is used so that the backend can recognized your application.
* Call this method when the application starts.
* @param connectionString The Engagement connection URL must match the following format:
* `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}`
*/
+ (void)init:(NSString*)connectionString;
/**
* Register application with the given connection string associated to the
* application.
* Also register optional Engagement modules (See module documentation for more
* information).
* @param connectionString The Engagement connection URL must match the following format:
* `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}`
* @param firstModule Optional Engagement module.
* @param ... A comma-separated list of Engagement modules.
*/
+ (void)init:(NSString*)connectionString modules:(id<AEModule>)firstModule, ...;
/**
* Register application with the given connection string associated to the
* application.
* Also register optional Engagement modules (See module documentation for more
* information).
* This is a convenient method for Swift compatibility purpose.
* @param connectionString The Engagement connection URL must match the following format:
* `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}`
* @param modules Array of optional Engagement modules.
*/
+ (void)init:(NSString*)connectionString modulesArray:(NSArray *)modules;
/**
* ---------------------
* @name General options
* ---------------------
*/
/**
* Engagement agent can be configured to produce test logs.
* @param value Set to YES to enable test logs, NO otherwise.
*/
+ (void)setTestLogEnabled:(BOOL)value;
/**
* Enable or disable the agent. The change is persistent. As an example you
* don't need to call
* this function every time the application is launched to disable the agent.
*
* You can also integrate this setting in your `Settings.bundle` file using the
* key 'engagement_agent_enabled'
* (also available as a constant string: `kEngagementAgentEnabled`).
*
* @param enabled Set to YES to enable the agent, NO otherwise.
* @see enabled
*/
- (void)setEnabled:(BOOL)enabled;
/**
* Set the delay between each burst of analytics reported to the backend.
* Passing a value equal to
* or below 0 means that analytics are reported in real time. Default value is
* 0.
* @param threshold Delay in seconds between each analytic burst.
*/
- (void)setBurstThreshold:(double)threshold;
/**
* By default, Engagement Agent will report your application crashes. If you want to
* disable crash reports, you can
* use this function.
* @attention If you disable crash reports, the Engagement session will not be
* closed when the application gets killed
* abruptly.
* @param enabled Set to NO to disable crash reports, YES otherwise (default
* value).
*/
- (void)setCrashReport:(BOOL)enabled;
/**
* ----------------------
* @name Location options
* ----------------------
*/
/**
* Enable lazy area reports. This will only reports the geographic location at a
* city level.
* @param enabled YES to enable location reporting, NO to disable (default
* value).
*/
- (void)setLazyAreaLocationReport:(BOOL)enabled;
/**
* Set real-time location reports. This will report location using a low level
* of accuracy to avoid
* draining the battery.
* @param enabled YES to enable real-time location reporting, NO to disable
*(default value).
*/
- (void)setRealtimeLocationReport:(BOOL)enabled;
/**
* Enable location reports using the highest-level of accuracy.
* Real-time location reporting is mandatory to enable this option.
* @param enabled YES to enable fine location reporting, NO to disable (default
* value).
* @see setRealtimeLocationReport:
*/
- (void)setFineRealtimeLocationReport:(BOOL)enabled;
/**
* Enable location reports even when the application is in background. Enabling
* this option will also enable fine
* location reports.
* Real-time location reporting is mandatory to enable this option.
* @warning If you enable this option, the system will automatically relaunch
* the application into the background if a
* new location arrives.
* @param enabled YES to enable background location reporting, NO to disable
*(default value).
* @param launchOptions options received when application is launched
* (from `- (BOOL)application:(UIApplication *)application
* didFinishLaunchingWithOptions:(NSDictionary
*******************************)launchOptions`). Just pass `nil` if you want to disable this feature.
* @see setRealtimeLocationReport:
*/
- (void)setBackgroundRealtimeLocationReport:(BOOL)enabled withLaunchOptions:(NSDictionary*)launchOptions;
/**
* -----------------------------------------------
* @name Accessing Engagement agent once initialized
* -----------------------------------------------
*/
/**
* Returns the singleton instance of the Engagement agent.
*/
+ (EngagementAgent*)shared;
/**
* -------------------------------------------
* @name Reporting your application statistics
* -------------------------------------------
*/
/**
* Report the current activity. A session is broken down into a sequence of
* activities, this call attach the current
* activity to the current session. If there is currently no session, this call
* also starts a new session and the activity will be attached to the newly
* created session.
* @param activityName The name of the current activity within the session, can
* be nil for
* default name (but not empty). Name is limited to 64 characters.
* @param extras The extra details associated with the activity. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)startActivity:(NSString*)activityName extras:(NSDictionary*)extras;
/**
* Report that the current activity ended. This will close the session.
*/
- (void)endActivity;
/**
* Start a job.
* @param name Job name, this should be unique, e.g. two jobs with the same
* name can't run at the same time, subsequent requests with the same
* name will end the previous job before starting the new one.
* Name is limited to 64 characters and cannot be empty.
* @param extras The extra details associated with this job. Keys must match the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)startJob:(NSString*)name extras:(NSDictionary*)extras;
/**
* End a job.
* @param name The name of job that has been started with
* startJob:extras:
*/
- (void)endJob:(NSString*)name;
/**
* Send an event to the backend.
* @param name Event name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this event. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendEvent:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an event related to the current session. This has no effect if the
* session has not been started.
* @param name Event name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this event. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendSessionEvent:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an event related to a running job. This has no effect if no job is
* running for the specified name.
* @param name Event name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param jobName Job name.
* @param extras The extra details associated with this event. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendJobEvent:(NSString*)name jobName:(NSString*)jobName extras:(NSDictionary*)extras;
/**
* Send an error to the backend.
* @param name Error name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this error. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendError:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an error related to the current session. This has no effect if the
* session has not been started.
* @param name Error name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this error. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendSessionError:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an error related to a running job. This has no effect if no job is
* running for the specified name.
* @param name Error name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param jobName Job name.
* @param extras The extra details associated with this error. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendJobError:(NSString*)name jobName:(NSString*)jobName extras:(NSDictionary*)extras;
/**
* ------------------------------------------------
* @name Reporting specific application information
* ------------------------------------------------
*/
/**
* Send application specific information.
* @param info Application information as a dictionary. Keys must match the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendAppInfo:(NSDictionary*)info;
/**
* ----------------------
* @name Sending messages
* ----------------------
*/
/**
* Send a feedback to reach. You don't need to call this function directly, it's
* used only by the optional reach module
* to report feedback from announcements, polls and data pushes.
* @param feedback A dictionary containing the feedback payload to send.
*/
- (void)sendReachFeedback:(NSDictionary*)feedback;
/**
* ------------------------------------
* @name Listening to incoming messages
* ------------------------------------
*/
/**
* Register a push delegate.
* The given delegate will be notified when Engagement agent receive push messages.
* @param delegate The delegate that will handle push messages.
*/
- (void)setPushDelegate:(id<AEPushDelegate>)delegate;
/**
* ---------------------------------
* @name Getting Engagement agent data
* ---------------------------------
*/
/**
* Get the identifier used by Engagement agent to identify this device.
* @result The identifier used by Engagement agent to identify this device.
*/
- (NSString*)deviceId;
/**
* Get a previously registered module.
* @param moduleName the name of the module to retrieve.
* @result A Engagement agent module or nil if there is no module with that name.
*/
- (id<AEModule>)getModule:(NSString*)moduleName;
/**
* Check if the agent is enabled.
* @result YES if the agent is enabled, NO otherwise.
* @see setEnabled:
*/
- (BOOL)enabled;
/**
* --------------------------------
* @name Apple push related methods
* --------------------------------
*/
/**
* Register the device token returned by Apple servers.
* This method is necessary to receive Apple push notifications from Engagement agent
* Push Service.
* @param token Data as returned by the application delegate callback:
* - application:didRegisterForRemoteNotificationsWithDeviceToken:
*/
- (void)registerDeviceToken:(NSData*)token;
/**
* If you are using the Engagement agent Push Service or Reach module,
* you should call this function from the application delegate:
* - application:didReceiveRemoteNotification:
* @param userInfo A dictionary that contains information related to the remote
* notification
*/
- (void)applicationDidReceiveRemoteNotification:(NSDictionary*)userInfo;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
extern NSString* const kEngagementAgentEnabled;
@protocol AEPushDelegate;
@protocol AEModule;
/**
* # The main Engagement class #
*
* Initialize the agent when your application starts:
*
* - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
* {
* [...]
* [EngagementAgent init:@"Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}"];
* [...]
* }
*/
@interface EngagementAgent : NSObject
/**
* ---------------------------
* @name Initializing Engagement
* ---------------------------
*/
/**
* This information is used so that the backend can recognized your application.
* Call this method when the application starts.
* @param connectionString The Engagement connection URL must match the following format:
* `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}`
*/
+ (void)init:(NSString*)connectionString;
/**
* Register application with the given connection string associated to the
* application.
* Also register optional Engagement modules (See module documentation for more
* information).
* @param connectionString The Engagement connection URL must match the following format:
* `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}`
* @param firstModule Optional Engagement module.
* @param ... A comma-separated list of Engagement modules.
*/
+ (void)init:(NSString*)connectionString modules:(id<AEModule>)firstModule, ...;
/**
* Register application with the given connection string associated to the
* application.
* Also register optional Engagement modules (See module documentation for more
* information).
* This is a convenient method for Swift compatibility purpose.
* @param connectionString The Engagement connection URL must match the following format:
* `Endpoint={YOUR_APP_COLLECTION.DOMAIN};SdkKey={YOUR_APPID};AppId={YOUR_APPID}`
* @param modules Array of optional Engagement modules.
*/
+ (void)init:(NSString*)connectionString modulesArray:(NSArray *)modules;
/**
* ---------------------
* @name General options
* ---------------------
*/
/**
* Engagement agent can be configured to produce test logs.
* @param value Set to YES to enable test logs, NO otherwise.
*/
+ (void)setTestLogEnabled:(BOOL)value;
/**
* Enable or disable the agent. The change is persistent. As an example you
* don't need to call
* this function every time the application is launched to disable the agent.
*
* You can also integrate this setting in your `Settings.bundle` file using the
* key 'engagement_agent_enabled'
* (also available as a constant string: `kEngagementAgentEnabled`).
*
* @param enabled Set to YES to enable the agent, NO otherwise.
* @see enabled
*/
- (void)setEnabled:(BOOL)enabled;
/**
* Set the delay between each burst of analytics reported to the backend.
* Passing a value equal to
* or below 0 means that analytics are reported in real time. Default value is
* 0.
* @param threshold Delay in seconds between each analytic burst.
*/
- (void)setBurstThreshold:(double)threshold;
/**
* By default, Engagement Agent will report your application crashes. If you want to
* disable crash reports, you can
* use this function.
* @attention If you disable crash reports, the Engagement session will not be
* closed when the application gets killed
* abruptly.
* @param enabled Set to NO to disable crash reports, YES otherwise (default
* value).
*/
- (void)setCrashReport:(BOOL)enabled;
/**
* ----------------------
* @name Location options
* ----------------------
*/
/**
* Enable lazy area reports. This will only reports the geographic location at a
* city level.
* @param enabled YES to enable location reporting, NO to disable (default
* value).
*/
- (void)setLazyAreaLocationReport:(BOOL)enabled;
/**
* Set real-time location reports. This will report location using a low level
* of accuracy to avoid
* draining the battery.
* @param enabled YES to enable real-time location reporting, NO to disable
*(default value).
*/
- (void)setRealtimeLocationReport:(BOOL)enabled;
/**
* Enable location reports using the highest-level of accuracy.
* Real-time location reporting is mandatory to enable this option.
* @param enabled YES to enable fine location reporting, NO to disable (default
* value).
* @see setRealtimeLocationReport:
*/
- (void)setFineRealtimeLocationReport:(BOOL)enabled;
/**
* Enable location reports even when the application is in background. Enabling
* this option will also enable fine
* location reports.
* Real-time location reporting is mandatory to enable this option.
* @warning If you enable this option, the system will automatically relaunch
* the application into the background if a
* new location arrives.
* @param enabled YES to enable background location reporting, NO to disable
*(default value).
* @param launchOptions options received when application is launched
* (from `- (BOOL)application:(UIApplication *)application
* didFinishLaunchingWithOptions:(NSDictionary
*******************************)launchOptions`). Just pass `nil` if you want to disable this feature.
* @see setRealtimeLocationReport:
*/
- (void)setBackgroundRealtimeLocationReport:(BOOL)enabled withLaunchOptions:(NSDictionary*)launchOptions;
/**
* -----------------------------------------------
* @name Accessing Engagement agent once initialized
* -----------------------------------------------
*/
/**
* Returns the singleton instance of the Engagement agent.
*/
+ (EngagementAgent*)shared;
/**
* -------------------------------------------
* @name Reporting your application statistics
* -------------------------------------------
*/
/**
* Report the current activity. A session is broken down into a sequence of
* activities, this call attach the current
* activity to the current session. If there is currently no session, this call
* also starts a new session and the activity will be attached to the newly
* created session.
* @param activityName The name of the current activity within the session, can
* be nil for
* default name (but not empty). Name is limited to 64 characters.
* @param extras The extra details associated with the activity. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)startActivity:(NSString*)activityName extras:(NSDictionary*)extras;
/**
* Report that the current activity ended. This will close the session.
*/
- (void)endActivity;
/**
* Start a job.
* @param name Job name, this should be unique, e.g. two jobs with the same
* name can't run at the same time, subsequent requests with the same
* name will end the previous job before starting the new one.
* Name is limited to 64 characters and cannot be empty.
* @param extras The extra details associated with this job. Keys must match the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)startJob:(NSString*)name extras:(NSDictionary*)extras;
/**
* End a job.
* @param name The name of job that has been started with
* startJob:extras:
*/
- (void)endJob:(NSString*)name;
/**
* Send an event to the backend.
* @param name Event name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this event. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendEvent:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an event related to the current session. This has no effect if the
* session has not been started.
* @param name Event name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this event. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendSessionEvent:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an event related to a running job. This has no effect if no job is
* running for the specified name.
* @param name Event name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param jobName Job name.
* @param extras The extra details associated with this event. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendJobEvent:(NSString*)name jobName:(NSString*)jobName extras:(NSDictionary*)extras;
/**
* Send an error to the backend.
* @param name Error name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this error. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendError:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an error related to the current session. This has no effect if the
* session has not been started.
* @param name Error name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param extras The extra details associated with this error. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendSessionError:(NSString*)name extras:(NSDictionary*)extras;
/**
* Send an error related to a running job. This has no effect if no job is
* running for the specified name.
* @param name Error name/tag. Name is limited to 64 characters and cannot be
* empty.
* @param jobName Job name.
* @param extras The extra details associated with this error. Keys must match
* the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendJobError:(NSString*)name jobName:(NSString*)jobName extras:(NSDictionary*)extras;
/**
* ------------------------------------------------
* @name Reporting specific application information
* ------------------------------------------------
*/
/**
* Send application specific information.
* @param info Application information as a dictionary. Keys must match the
* `^[a-zA-Z][a-zA-Z_0-9]*` regular expression. Extras are encoded into JSON
* before being sent to the server, the encoded limit is 1024 characters.
*/
- (void)sendAppInfo:(NSDictionary*)info;
/**
* ----------------------
* @name Sending messages
* ----------------------
*/
/**
* Send a feedback to reach. You don't need to call this function directly, it's
* used only by the optional reach module
* to report feedback from announcements, polls and data pushes.
* @param feedback A dictionary containing the feedback payload to send.
*/
- (void)sendReachFeedback:(NSDictionary*)feedback;
/**
* ------------------------------------
* @name Listening to incoming messages
* ------------------------------------
*/
/**
* Register a push delegate.
* The given delegate will be notified when Engagement agent receive push messages.
* @param delegate The delegate that will handle push messages.
*/
- (void)setPushDelegate:(id<AEPushDelegate>)delegate;
/**
* ---------------------------------
* @name Getting Engagement agent data
* ---------------------------------
*/
/**
* Get the identifier used by Engagement agent to identify this device.
* @result The identifier used by Engagement agent to identify this device.
*/
- (NSString*)deviceId;
/**
* Get a previously registered module.
* @param moduleName the name of the module to retrieve.
* @result A Engagement agent module or nil if there is no module with that name.
*/
- (id<AEModule>)getModule:(NSString*)moduleName;
/**
* Check if the agent is enabled.
* @result YES if the agent is enabled, NO otherwise.
* @see setEnabled:
*/
- (BOOL)enabled;
/**
* --------------------------------
* @name Apple push related methods
* --------------------------------
*/
/**
* Register the device token returned by Apple servers.
* This method is necessary to receive Apple push notifications from Engagement agent
* Push Service.
* @param token Data as returned by the application delegate callback:
* - application:didRegisterForRemoteNotificationsWithDeviceToken:
*/
- (void)registerDeviceToken:(NSData*)token;
/**
* If you are using the Engagement agent Push Service or Reach module,
* you should call this function from the application delegate:
* - application:didReceiveRemoteNotification:
* @param userInfo A dictionary that contains information related to the remote
* notification
*/
- (void)applicationDidReceiveRemoteNotification:(NSDictionary*)userInfo;
@end

Просмотреть файл

@ -1,30 +1,30 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* Helper class used to replace iOS's `UITableViewController` class.
*/
@interface EngagementTableViewController : UITableViewController {
}
/**
* Override this to specify the name reported by your activity. The default implementation returns
* the simple name of the class and removes the "ViewController" suffix if any (e.g.
* "Tab1ViewController" -> "Tab1").
* @result the activity name reported by the Engagement service.
*/
- (NSString*)engagementActivityName;
/**
* Override this to attach extra information to your activity. The default implementation attaches
* no extra information (i.e. return nil).
* @result activity extra information, nil if no extra.
*/
- (NSDictionary*)engagementActivityExtra;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* Helper class used to replace iOS's `UITableViewController` class.
*/
@interface EngagementTableViewController : UITableViewController {
}
/**
* Override this to specify the name reported by your activity. The default implementation returns
* the simple name of the class and removes the "ViewController" suffix if any (e.g.
* "Tab1ViewController" -> "Tab1").
* @result the activity name reported by the Engagement service.
*/
- (NSString*)engagementActivityName;
/**
* Override this to attach extra information to your activity. The default implementation attaches
* no extra information (i.e. return nil).
* @result activity extra information, nil if no extra.
*/
- (NSDictionary*)engagementActivityExtra;
@end

Просмотреть файл

@ -1,30 +1,30 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* Helper class used to replace iOS's `UIViewController` class.
*/
@interface EngagementViewController : UIViewController {
}
/**
* Override this to specify the name reported by your activity. The default implementation returns
* the simple name of the class and removes the "ViewController" suffix if any (e.g.
* "Tab1ViewController" -> "Tab1").
* @result the activity name reported by the Engagement service.
*/
- (NSString*)engagementActivityName;
/**
* Override this to attach extra information to your activity. The default implementation attaches
* no extra information (i.e. return nil).
* @result activity extra information, nil if no extra.
*/
- (NSDictionary*)engagementActivityExtra;
@end
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* Helper class used to replace iOS's `UIViewController` class.
*/
@interface EngagementViewController : UIViewController {
}
/**
* Override this to specify the name reported by your activity. The default implementation returns
* the simple name of the class and removes the "ViewController" suffix if any (e.g.
* "Tab1ViewController" -> "Tab1").
* @result the activity name reported by the Engagement service.
*/
- (NSString*)engagementActivityName;
/**
* Override this to attach extra information to your activity. The default implementation attaches
* no extra information (i.e. return nil).
* @result activity extra information, nil if no extra.
*/
- (NSDictionary*)engagementActivityExtra;
@end

Просмотреть файл

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-ms-azme-tests" version="1.0.0">
<name>Cordova plugin for AZME Tests</name>
<js-module src="tests.js" >
</js-module>
</plugin>
<name>Cordova plugin for AZME Tests</name>
<js-module src="tests.js" >
</js-module>
</plugin>

Просмотреть файл

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-ms-azme-tests" version="1.0.4">
<name>Cordova plugin for AZME Tests</name>
<js-module src="tests.js" >
</js-module>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-ms-azme-tests" version="1.0.0">
<name>Cordova plugin for AZME Tests</name>
<js-module src="tests.js" >
</js-module>
</plugin>

Просмотреть файл

@ -1,71 +1,71 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
exports.defineAutoTests = function () {
describe('AZME Object', function () {
it("AZME should exist", function () {
expect(AZME).toBeDefined();
});
it("AZME should contain a startActivity function", function () {
expect(AZME.startActivity).toBeDefined();
expect(typeof AZME.startActivity == 'function').toBe(true);
});
it("AZME should contain a endActivity function", function () {
expect(AZME.endActivity).toBeDefined();
expect(typeof AZME.endActivity == 'function').toBe(true);
});
it("AZME should contain a sendAppInfo function", function () {
expect(AZME.sendAppInfo).toBeDefined();
expect(typeof AZME.sendAppInfo == 'function').toBe(true);
});
it("AZME should contain a startJob function", function () {
expect(AZME.startJob).toBeDefined();
expect(typeof AZME.startJob == 'function').toBe(true);
});
it("AZME should contain a endJob function", function () {
expect(AZME.endJob).toBeDefined();
expect(typeof AZME.endJob == 'function').toBe(true);
});
it("AZME should contain a onOpenURL function", function () {
expect(AZME.onOpenURL).toBeDefined();
expect(typeof AZME.onOpenURL == 'function').toBe(true);
});
it("AZME should contain a handleOpenURL function", function () {
expect(AZME.handleOpenURL).toBeDefined();
expect(typeof AZME.handleOpenURL == 'function').toBe(true);
});
it("AZME should contain a getStatus function", function () {
expect(AZME.getStatus).toBeDefined();
expect(typeof AZME.getStatus == 'function').toBe(true);
});
});
describe('Plugin Methods', function() {
var info;
beforeEach(function(done) {
AZME.getStatus(function(_info) {
info = _info;
done();
});
});
it("AZME plugin version should be the same as the js plugin version", function () {
expect(info.pluginVersion).toBeDefined();
expect(info.pluginVersion == AZME.pluginVersion).toBe(true);
});
});
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
exports.defineAutoTests = function () {
describe('AZME Object', function () {
it("AZME should exist", function () {
expect(AZME).toBeDefined();
});
it("AZME should contain a startActivity function", function () {
expect(AZME.startActivity).toBeDefined();
expect(typeof AZME.startActivity == 'function').toBe(true);
});
it("AZME should contain a endActivity function", function () {
expect(AZME.endActivity).toBeDefined();
expect(typeof AZME.endActivity == 'function').toBe(true);
});
it("AZME should contain a sendAppInfo function", function () {
expect(AZME.sendAppInfo).toBeDefined();
expect(typeof AZME.sendAppInfo == 'function').toBe(true);
});
it("AZME should contain a startJob function", function () {
expect(AZME.startJob).toBeDefined();
expect(typeof AZME.startJob == 'function').toBe(true);
});
it("AZME should contain a endJob function", function () {
expect(AZME.endJob).toBeDefined();
expect(typeof AZME.endJob == 'function').toBe(true);
});
it("AZME should contain a onOpenURL function", function () {
expect(AZME.onOpenURL).toBeDefined();
expect(typeof AZME.onOpenURL == 'function').toBe(true);
});
it("AZME should contain a handleOpenURL function", function () {
expect(AZME.handleOpenURL).toBeDefined();
expect(typeof AZME.handleOpenURL == 'function').toBe(true);
});
it("AZME should contain a getStatus function", function () {
expect(AZME.getStatus).toBeDefined();
expect(typeof AZME.getStatus == 'function').toBe(true);
});
});
describe('Plugin Methods', function() {
var info;
beforeEach(function(done) {
AZME.getStatus(function(_info) {
info = _info;
done();
});
});
it("AZME plugin version should be the same as the js plugin version", function () {
expect(info.pluginVersion).toBeDefined();
expect(info.pluginVersion == AZME.pluginVersion).toBe(true);
});
});
};

Просмотреть файл

@ -1,10 +0,0 @@
export PLUGIN_VERSION="1.0.0"
sed -i.bak "s/pluginVersion :.*/pluginVersion : \"$PLUGIN_VERSION\",/" "www/AZME.js"
sed -i.bak "s/AZME_PLUGIN_VERSION .*/AZME_PLUGIN_VERSION \"$PLUGIN_VERSION\"/" "src/ios/AZME.m"
sed -i.bak "s/pluginVersion = .*/pluginVersion = \"$PLUGIN_VERSION\";/" "src/android/AZME.java"
sed -i.bak "s/\"version\": .*/\"version\": \"$PLUGIN_VERSION\",/" "package.json"
sed -i.bak "s/id=\"cordova-plugin-ms-azme\" version=.*/id=\"cordova-plugin-ms-azme\" version=\"$PLUGIN_VERSION\">/" "plugin.xml"
sed -i.bak "s/id=\"cordova-plugin-ms-azme-tests\" version=.*/id=\"cordova-plugin-ms-azme-tests\" version=\"$PLUGIN_VERSION\">/" "tests/plugin.xml"

Просмотреть файл

@ -1,59 +1,59 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
module.exports = {
pluginName : "AZME",
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
module.exports = {
pluginName : "AZME",
pluginVersion : "1.0.0",
onOpenURL : function (_handler) {
var _this = this;
_this.openURLHandler = _handler;
cordova.exec(function( _url) {
if (_url)
_this.handleOpenURL(_url);
}, undefined, _this.pluginName, 'checkRedirect', [] );
},
handleOpenURL : function(_url) {
if (this.openURLHandler) {
this.openURLHandler(_url);
}
},
startActivity: function (_activityName,_extraInfos,_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'startActivity', [_activityName,JSON.stringify(_extraInfos)] );
},
endActivity: function (_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'endActivity', [] );
},
sendAppInfo: function (_appInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendAppInfo', [JSON.stringify(_appInfos)] );
},
sendEvent: function (_eventName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendEvent', [_eventName,JSON.stringify(_extraInfos)] );
},
startJob: function (_jobName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'startJob',[_jobName, JSON.stringify(_extraInfos)] );
},
endJob: function (_jobName,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'endJob', [_jobName] );
},
getStatus: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'getStatus', [] );
},
registerForPushNotification: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'registerForPushNotification', [] );
},
};
onOpenURL : function (_handler) {
var _this = this;
_this.openURLHandler = _handler;
cordova.exec(function( _url) {
if (_url)
_this.handleOpenURL(_url);
}, undefined, _this.pluginName, 'checkRedirect', [] );
},
handleOpenURL : function(_url) {
if (this.openURLHandler) {
this.openURLHandler(_url);
}
},
startActivity: function (_activityName,_extraInfos,_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'startActivity', [_activityName,JSON.stringify(_extraInfos)] );
},
endActivity: function (_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'endActivity', [] );
},
sendAppInfo: function (_appInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendAppInfo', [JSON.stringify(_appInfos)] );
},
sendEvent: function (_eventName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendEvent', [_eventName,JSON.stringify(_extraInfos)] );
},
startJob: function (_jobName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'startJob',[_jobName, JSON.stringify(_extraInfos)] );
},
endJob: function (_jobName,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'endJob', [_jobName] );
},
getStatus: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'getStatus', [] );
},
registerForPushNotification: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'registerForPushNotification', [] );
},
};

Просмотреть файл

@ -1,59 +1,59 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
module.exports = {
pluginName : "AZME",
pluginVersion : "1.0.4",
onOpenURL : function (_handler) {
var _this = this;
_this.openURLHandler = _handler;
cordova.exec(function( _url) {
if (_url)
_this.handleOpenURL(_url);
}, undefined, _this.pluginName, 'checkRedirect', [] );
},
handleOpenURL : function(_url) {
if (this.openURLHandler) {
this.openURLHandler(_url);
}
},
startActivity: function (_activityName,_extraInfos,_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'startActivity', [_activityName,JSON.stringify(_extraInfos)] );
},
endActivity: function (_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'endActivity', [] );
},
sendAppInfo: function (_appInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendAppInfo', [JSON.stringify(_appInfos)] );
},
sendEvent: function (_eventName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendEvent', [_eventName,JSON.stringify(_extraInfos)] );
},
startJob: function (_jobName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'startJob',[_jobName, JSON.stringify(_extraInfos)] );
},
endJob: function (_jobName,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'endJob', [_jobName] );
},
getStatus: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'getStatus', [] );
},
registerForPushNotification: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'registerForPushNotification', [] );
},
};
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license. See License.txt in the project root for license information.
*/
module.exports = {
pluginName : "AZME",
pluginVersion : "1.0.0",
onOpenURL : function (_handler) {
var _this = this;
_this.openURLHandler = _handler;
cordova.exec(function( _url) {
if (_url)
_this.handleOpenURL(_url);
}, undefined, _this.pluginName, 'checkRedirect', [] );
},
handleOpenURL : function(_url) {
if (this.openURLHandler) {
this.openURLHandler(_url);
}
},
startActivity: function (_activityName,_extraInfos,_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'startActivity', [_activityName,JSON.stringify(_extraInfos)] );
},
endActivity: function (_success,_failure) {
cordova.exec(_success, _failure, this.pluginName, 'endActivity', [] );
},
sendAppInfo: function (_appInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendAppInfo', [JSON.stringify(_appInfos)] );
},
sendEvent: function (_eventName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'sendEvent', [_eventName,JSON.stringify(_extraInfos)] );
},
startJob: function (_jobName,_extraInfos,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'startJob',[_jobName, JSON.stringify(_extraInfos)] );
},
endJob: function (_jobName,_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'endJob', [_jobName] );
},
getStatus: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'getStatus', [] );
},
registerForPushNotification: function (_success,_failure) {
cordova.exec(_success,_failure, this.pluginName, 'registerForPushNotification', [] );
},
};