onesignal-cordova-plugin
Advanced tools
Comparing version 3.0.2 to 3.0.3
{ | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
@@ -4,0 +4,0 @@ "name": "onesignal-cordova-plugin", |
@@ -7,1 +7,12 @@ export interface InAppMessageAction { | ||
} | ||
export interface OSInAppMessage { | ||
messageId : string | ||
} | ||
export interface InAppMessageLifecycleHandlerObject { | ||
onWillDisplayInAppMessage ?: (message: InAppMessage) => void; | ||
onDidDisplayInAppMessage ?: (message: InAppMessage) => void; | ||
onWillDismissInAppMessage ?: (message: InAppMessage) => void; | ||
onDidDismissInAppMessage ?: (message: InAppMessage) => void; | ||
} |
import { NotificationReceivedEvent, OpenedEvent, OpenedEventAction } from './Notification'; | ||
import { OutcomeEvent } from './Outcomes'; | ||
import { InAppMessageAction } from './InAppMessage'; | ||
import { InAppMessageAction, InAppMessageLifecycleHandlerObject } from './InAppMessage'; | ||
import { PermissionChange, SubscriptionChange, EmailSubscriptionChange, SMSSubscriptionChange, DeviceState } from './Subscription'; | ||
@@ -222,2 +222,10 @@ import { LogLevel, ChangeEvent } from './Extras'; | ||
/** | ||
* iOS only. | ||
* This method can be used to set if launch URLs should be opened within the application or in Safari. | ||
* @param {boolean} isEnabled - false will open the link in Safari or user's default browser | ||
* @returns void | ||
*/ | ||
setLaunchURLsInApp(isEnabled: boolean): void; | ||
/** | ||
* Allows you to use your own system's user ID's to send push notifications to your users. | ||
@@ -245,2 +253,9 @@ * @param {string} externalId | ||
/** | ||
* Sets the In-App Message lifecycle handler object to run on displaying and/or dismissing an In-App Message. | ||
* @param {InAppMessageLifecycleHandlerObject} handlerObject | ||
* @returns void | ||
*/ | ||
setInAppMessageLifecycleHandler(handlerObject: InAppMessageLifecycleHandlerObject) : void; | ||
/** | ||
* Add an In-App Message Trigger. | ||
@@ -247,0 +262,0 @@ * @param {string} key |
@@ -8,2 +8,9 @@ function OSInAppMessageAction (json) { | ||
module.exports = OSInAppMessageAction; | ||
function OSInAppMessage (json) { | ||
this.messageId = json.messageId; | ||
} | ||
module.exports = { | ||
OSInAppMessageAction: OSInAppMessageAction, | ||
OSInAppMessage: OSInAppMessage | ||
}; |
@@ -30,3 +30,4 @@ /** | ||
var OSNotificationOpenedResult = require('./NotificationOpened'); | ||
var OSInAppMessageAction = require('./InAppMessage'); | ||
var OSInAppMessageAction = require('./InAppMessage').OSInAppMessageAction; | ||
var OSInAppMessage = require('./InAppMessage').OSInAppMessage; | ||
var OSDeviceState = require('./Subscription').OSDeviceState; | ||
@@ -43,2 +44,6 @@ var OSPermissionStateChanges = require('./Subscription').OSPermissionStateChanges; | ||
var _inAppMessageClickDelegate = function (action) {}; | ||
var _onWillDisplayInAppMessageDelegate = function(message) {}; | ||
var _onDidDisplayInAppMessageDelegate = function(message) {}; | ||
var _onWillDismissInAppMessageDelegate = function(message) {}; | ||
var _onDidDismissInAppMessageDelegate = function(message) {}; | ||
}; | ||
@@ -95,2 +100,43 @@ | ||
OneSignalPlugin.prototype.setInAppMessageLifecycleHandler = function(handlerObject) { | ||
if (handlerObject.onWillDisplayInAppMessage) { | ||
OneSignalPlugin._onWillDisplayInAppMessageDelegate = handlerObject.onWillDisplayInAppMessage; | ||
var onWillDisplayInAppMessageHandler = function(json) { | ||
OneSignalPlugin._onWillDisplayInAppMessageDelegate(new OSInAppMessage(json)); | ||
}; | ||
window.cordova.exec(onWillDisplayInAppMessageHandler, function() {}, "OneSignalPush", "setOnWillDisplayInAppMessageHandler", []); | ||
} | ||
if (handlerObject.onDidDisplayInAppMessage) { | ||
OneSignalPlugin._onDidDisplayInAppMessageDelegate = handlerObject.onDidDisplayInAppMessage; | ||
var onDidDisplayInAppMessageHandler = function(json) { | ||
OneSignalPlugin._onDidDisplayInAppMessageDelegate(new OSInAppMessage(json)); | ||
}; | ||
window.cordova.exec(onDidDisplayInAppMessageHandler, function() {}, "OneSignalPush", "setOnDidDisplayInAppMessageHandler", []); | ||
} | ||
if (handlerObject.onWillDismissInAppMessage) { | ||
OneSignalPlugin._onWillDismissInAppMessageDelegate = handlerObject.onWillDismissInAppMessage; | ||
var onWillDismissInAppMessageHandler = function(json) { | ||
OneSignalPlugin._onWillDismissInAppMessageDelegate(new OSInAppMessage(json)); | ||
}; | ||
window.cordova.exec(onWillDismissInAppMessageHandler, function() {}, "OneSignalPush", "setOnWillDismissInAppMessageHandler", []); | ||
} | ||
if (handlerObject.onDidDismissInAppMessage) { | ||
OneSignalPlugin._onDidDismissInAppMessageDelegate = handlerObject.onDidDismissInAppMessage; | ||
var onDidDismissInAppMessageHandler = function(json) { | ||
OneSignalPlugin._onDidDismissInAppMessageDelegate(new OSInAppMessage(json)); | ||
}; | ||
window.cordova.exec(onDidDismissInAppMessageHandler, function() {}, "OneSignalPush", "setOnDidDismissInAppMessageHandler", []); | ||
} | ||
window.cordova.exec(function() {}, function() {}, "OneSignalPush", "setInAppMessageLifecycleHandler", []); | ||
}; | ||
OneSignalPlugin._processFunctionList = function(array, param) { | ||
@@ -219,2 +265,7 @@ for (var i = 0; i < array.length; i++) | ||
// Only applies to iOS | ||
OneSignalPlugin.prototype.setLaunchURLsInApp = function(isEnabled) { | ||
window.cordova.exec(function(){}, function(){}, "OneSignalPush", "setLaunchURLsInApp", [isEnabled]); | ||
}; | ||
OneSignalPlugin.prototype.setLogLevel = function(nsLogLevel, visualLogLevel) { | ||
@@ -221,0 +272,0 @@ window.cordova.exec(function(){}, function(){}, "OneSignalPush", "setLogLevel", [nsLogLevel, visualLogLevel]); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
636547
35
2408