Compare commits

..
Author SHA1 Message Date
Daniel Sogl c8edd359b2 feat(applovin): sync wrapper with cordova-plugin-applovin-max@2.1.0
Add segment targeting, ad-ready checks, banner/mrec position updates,
and the full set of banner/mrec/interstitial/rewarded ad lifecycle
events introduced upstream. Deprecate APIs removed in 2.0.0 and fix
setMuted's missing parameter plus a broken rewarded-ad event name.
2026-07-27 22:23:54 +02:00
2 changed files with 196 additions and 476 deletions
@@ -35,7 +35,7 @@ declare const window: Window & { Airship: any };
pluginName: 'Airship',
plugin: '@ua/cordova-airship',
pluginRef: 'Airship',
repo: 'https://github.com/urbanairship/urbanairship-cordova',
repo: 'https://www.npmjs.com/package/@ua/cordova-airship',
install: 'ionic cordova plugin add @ua/cordova-airship',
platforms: ['Android', 'iOS'],
})
@@ -52,14 +52,6 @@ export class Airship extends AwesomeCordovaNativePlugin {
public preferenceCenter: AirshipPreferenceCenter;
public privacyManager: AirshipPrivacyManager;
public push: AirshipPush;
/**
* Live Activity manager. iOS only.
*/
public liveActivityManager: AirshipLiveActivityManager;
/**
* Live Update manager. Android only.
*/
public liveUpdateManager: AirshipLiveUpdateManager;
/**
* Call after platform ready
@@ -265,252 +257,6 @@ export interface DisplayPreferenceCenterEvent {
preferenceCenterId: string;
}
/**
* Event fired when Live Activities are updated. iOS only.
*/
export interface LiveActivitiesUpdatedEvent {
/**
* The Live Activities.
*/
activities: LiveActivity[];
}
/**
* Live Activity info. iOS only.
*/
export interface LiveActivity {
/**
* The activity ID.
*/
id: string;
/**
* The attribute types.
*/
attributeTypes: string;
/**
* The content.
*/
content: LiveActivityContent;
/**
* The attributes.
*/
attributes: JsonObject;
}
/**
* Live Activity content. iOS only.
*/
export interface LiveActivityContent {
/**
* The content state.
*/
state: JsonObject;
/**
* Optional ISO 8601 date string that defines when the Live Activity will be stale.
*/
staleDate?: string;
/**
* The relevance score.
*/
relevanceScore: number;
}
/**
* Base Live Activity request. iOS only.
*/
export interface LiveActivityRequest {
/**
* Attributes type. This should match the Activity type of your Live Activity.
*/
attributesType: string;
}
/**
* Live Activity list request. iOS only.
*/
export type LiveActivityListRequest = LiveActivityRequest;
/**
* Live Activity start request. iOS only.
*/
export interface LiveActivityStartRequest extends LiveActivityRequest {
/**
* Dynamic content.
*/
content: LiveActivityContent;
/**
* Fixed attributes.
*/
attributes: JsonObject;
}
/**
* Live Activity update request. iOS only.
*/
export interface LiveActivityUpdateRequest extends LiveActivityRequest {
/**
* The Live Activity ID to update.
*/
activityId: string;
/**
* Dynamic content.
*/
content: LiveActivityContent;
}
/**
* Live Activity end request. iOS only.
*/
export interface LiveActivityEndRequest extends LiveActivityRequest {
/**
* The Live Activity ID to end.
*/
activityId: string;
/**
* Dynamic content.
*/
content?: LiveActivityContent;
/**
* Dismissal policy. Defaults to `LiveActivityDismissalPolicyDefault`.
*/
dismissalPolicy?: LiveActivityDismissalPolicy;
}
export type LiveActivityDismissalPolicy =
LiveActivityDismissalPolicyImmediate | LiveActivityDismissalPolicyDefault | LiveActivityDismissalPolicyAfterDate;
/**
* Dismissal policy to immediately dismiss the Live Activity on end.
*/
export interface LiveActivityDismissalPolicyImmediate {
type: 'immediate';
}
/**
* Dismissal policy to dismiss the Live Activity after the expiration.
*/
export interface LiveActivityDismissalPolicyDefault {
type: 'default';
}
/**
* Dismissal policy to dismiss the Live Activity after a given date.
*/
export interface LiveActivityDismissalPolicyAfterDate {
type: 'after';
/**
* ISO 8601 date string.
*/
date: string;
}
/**
* Live Update info. Android only.
*/
export interface LiveUpdate {
/**
* The Live Update name.
*/
name: string;
/**
* The Live Update type.
*/
type: string;
/**
* Dynamic content.
*/
content: JsonObject;
/**
* ISO 8601 date string of the last content update.
*/
lastContentUpdateTimestamp: string;
/**
* ISO 8601 date string of the last state update.
*/
lastStateChangeTimestamp: string;
/**
* Optional ISO 8601 date string that defines when to end this Live Update.
*/
dismissTimestamp?: string;
}
/**
* Live Update list request. Android only.
*/
export interface LiveUpdateListRequest {
type: string;
}
/**
* Live Update start request. Android only.
*/
export interface LiveUpdateStartRequest {
/**
* The Live Update name.
*/
name: string;
/**
* The Live Update type.
*/
type: string;
/**
* Dynamic content.
*/
content: JsonObject;
/**
* Optional ISO 8601 date string, used to filter out of order updates.
*/
timestamp?: string;
/**
* Optional ISO 8601 date string that defines when to end this Live Update.
*/
dismissTimestamp?: string;
}
/**
* Live Update update request. Android only.
*/
export interface LiveUpdateUpdateRequest {
/**
* The Live Update name.
*/
name: string;
/**
* Dynamic content.
*/
content: JsonObject;
/**
* Optional ISO 8601 date string, used to filter out of order updates.
*/
timestamp?: string;
/**
* Optional ISO 8601 date string that defines when to end this Live Update.
*/
dismissTimestamp?: string;
}
/**
* Live Update end request. Android only.
*/
export interface LiveUpdateEndRequest {
/**
* The Live Update name.
*/
name: string;
/**
* Dynamic content.
*/
content?: JsonObject;
/**
* Optional ISO 8601 date string, used to filter out of order updates.
*/
timestamp?: string;
/**
* Optional ISO 8601 date string that defines when to end this Live Update.
*/
dismissTimestamp?: string;
}
/**
* iOS options
*/
@@ -702,18 +448,6 @@ export interface ConfigEnvironment {
* Optional log level.
*/
logLevel?: LogLevel;
/**
* Optional iOS config.
*/
ios?: {
/**
* Log privacy level. By default it logs at `private`, not logging anything lower than info to the console
* and redacting logs with string interpolation. `public` will log all configured log levels to the console
* without redacting any of the log lines.
*/
logPrivacyLevel?: 'private' | 'public';
};
}
/**
@@ -885,14 +619,12 @@ export namespace Android {
* Enum of authorized Features.
*/
export enum Feature {
All = 'all',
InAppAutomation = 'in_app_automation',
MessageCenter = 'message_center',
Push = 'push',
Analytics = 'analytics',
TagsAndAttributes = 'tags_and_attributes',
Contacts = 'contacts',
FeatureFlags = 'feature_flags',
}
/**
@@ -1264,17 +996,6 @@ export interface AttributeEditor {
*/
setAttribute(name: string, value: string | number | boolean | Date): AttributeEditor;
/**
* Adds a JSON attribute.
*
* @param name The attribute name.
* @param instanceId The instance ID.
* @param json The json value. Must not contain `exp` as top level key.
* @param expiration Optional expiration.
* @return The attribute editor instance.
*/
setJsonAttribute(name: string, instanceId: string, json: Record<string, any>, expiration?: Date): AttributeEditor;
/**
* Removes an attribute.
* @param name The name of the attribute to remove.
@@ -1282,14 +1003,6 @@ export interface AttributeEditor {
*/
removeAttribute(name: string): AttributeEditor;
/**
* Removes a JSON attribute.
* @param name The name of the attribute to remove.
* @param instanceId The instance ID.
* @return The attribute editor instance.
*/
removeJsonAttribute(name: string, instanceId: string): AttributeEditor;
/**
* Applies the attribute operations.
* @param success Success callback.
@@ -1331,15 +1044,6 @@ class AirshipPush {
return;
}
/**
* Enables user notifications and prompts the user for permission, if needed.
* @returns Whether user notifications are enabled after the request.
*/
@CordovaInstance()
enableUserNotifications(): Promise<boolean> {
return;
}
/**
* Gets the notification status.
*/
@@ -1482,13 +1186,6 @@ export interface AirshipPushIOS {
*/
getBadgeNumber(success: (badge: number) => void, error?: (err: string) => void): void;
/**
* Resets the badge number to zero.
* @param success Success callback.
* @param error Error callback.
*/
resetBadge(success?: () => void, error?: (err: string) => void): void;
/**
* Gets the list of authorized notification settings.
* @param success Success callback.
@@ -1853,41 +1550,6 @@ export interface AirshipFeatureFlagManager {
trackInteraction(flag: FeatureFlag, success?: () => void, error?: (err: string) => void): void;
}
/**
* Options for email channel registration.
*/
export interface EmailRegistrationOptions {
/**
* Transactional opt-in date as milliseconds since epoch.
*/
transactionalOptedIn?: number;
/**
* Commercial opt-in date as milliseconds since epoch.
*/
commercialOptedIn?: number;
/**
* Custom properties for the email channel.
*/
properties?: Record<string, string>;
/**
* Request double opt-in for commercial messages when `commercialOptedIn` is not set.
*/
doubleOptIn?: boolean;
}
/**
* Options for SMS channel registration.
*/
export interface SmsRegistrationOptions {
/**
* The sender ID.
*/
senderId: string;
}
/**
* Airship contact.
*/
@@ -1958,26 +1620,6 @@ class AirshipContact {
reset(): Promise<void> {
return;
}
/**
* Registers an email channel for the contact.
* @param email The email address.
* @param options Registration options.
*/
@CordovaInstance()
registerEmail(email: string, options: EmailRegistrationOptions): Promise<void> {
return;
}
/**
* Registers an SMS channel for the contact.
* @param msisdn The MSISDN, including country code.
* @param options Registration options.
*/
@CordovaInstance()
registerSMS(msisdn: string, options: SmsRegistrationOptions): Promise<void> {
return;
}
}
/**
@@ -2123,114 +1765,3 @@ export interface AirshipActions {
error?: (err: string) => void
): void;
}
/**
* Live Activity manager. iOS only.
*/
export interface AirshipLiveActivityManager {
/**
* Lists any Live Activities for the request.
* @param request The request options.
* @param success Success callback with the list.
* @param error Error callback.
*/
list(
request: LiveActivityListRequest,
success: (activities: LiveActivity[]) => void,
error?: (err: string) => void
): void;
/**
* Lists all Live Activities.
* @param success Success callback with the list.
* @param error Error callback.
*/
listAll(success: (activities: LiveActivity[]) => void, error?: (err: string) => void): void;
/**
* Starts a Live Activity.
* @param request The request options.
* @param success Success callback with the started activity.
* @param error Error callback.
*/
start(
request: LiveActivityStartRequest,
success: (activity: LiveActivity) => void,
error?: (err: string) => void
): void;
/**
* Updates a Live Activity.
* @param request The request options.
* @param success Success callback.
* @param error Error callback.
*/
update(request: LiveActivityUpdateRequest, success?: () => void, error?: (err: string) => void): void;
/**
* Ends a Live Activity.
* @param request The request options.
* @param success Success callback.
* @param error Error callback.
*/
end(request: LiveActivityEndRequest, success?: () => void, error?: (err: string) => void): void;
/**
* Live Activities updated listener.
*
* @param callback The callback.
* @return A cancellable that can be used to cancel the listener.
*/
onLiveActivitiesUpdated(callback: (event: LiveActivitiesUpdatedEvent) => void): Cancellable;
}
/**
* Live Update manager. Android only.
*/
export interface AirshipLiveUpdateManager {
/**
* Lists any Live Updates for the request.
* @param request The request options.
* @param success Success callback with the list.
* @param error Error callback.
*/
list(request: LiveUpdateListRequest, success: (updates: LiveUpdate[]) => void, error?: (err: string) => void): void;
/**
* Lists all Live Updates.
* @param success Success callback with the list.
* @param error Error callback.
*/
listAll(success: (updates: LiveUpdate[]) => void, error?: (err: string) => void): void;
/**
* Starts a Live Update.
* @param request The request options.
* @param success Success callback.
* @param error Error callback.
*/
start(request: LiveUpdateStartRequest, success?: () => void, error?: (err: string) => void): void;
/**
* Updates a Live Update.
* @param request The request options.
* @param success Success callback.
* @param error Error callback.
*/
update(request: LiveUpdateUpdateRequest, success?: () => void, error?: (err: string) => void): void;
/**
* Ends a Live Update.
* @param request The request options.
* @param success Success callback.
* @param error Error callback.
*/
end(request: LiveUpdateEndRequest, success?: () => void, error?: (err: string) => void): void;
/**
* Clears all Live Updates.
* @param success Success callback.
* @param error Error callback.
*/
clearAll(success?: () => void, error?: (err: string) => void): void;
}
@@ -3,10 +3,27 @@ import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-pl
import { Observable } from 'rxjs';
export interface InitializeConfig {
hasUserConsentValue: boolean;
isAgeRestrictedUserValue: boolean;
isDoNotSellValue: boolean;
isTabletValue: boolean;
/**
* @deprecated Never populated by the native SDKs. Use `hasUserConsent` instead.
*/
hasUserConsentValue?: boolean;
/**
* @deprecated Never populated by the native SDKs, and the underlying `isAgeRestrictedUser`
* field was removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
isAgeRestrictedUserValue?: boolean;
/**
* @deprecated Never populated by the native SDKs. Use `isDoNotSell` instead.
*/
isDoNotSellValue?: boolean;
/**
* @deprecated Never populated by the native SDKs. Use `isTablet` instead.
*/
isTabletValue?: boolean;
hasUserConsent: boolean;
isDoNotSell: boolean;
isTablet: boolean;
countryCode: string;
}
export interface AdInfo {
@@ -17,6 +34,11 @@ export interface AdInfo {
revenue: number;
}
export interface AdRewardInfo extends AdInfo {
rewardLabel: string;
rewardAmount: number;
}
export enum AdViewPosition {
TOP_CENTER = 'top_center',
TOP_RIGHT = 'top_right',
@@ -28,6 +50,10 @@ export enum AdViewPosition {
BOTTOM_RIGHT = 'bottom_right',
}
/**
* @deprecated Only produced by the now-removed `getConsentDialogState` method
* (removed upstream in cordova-plugin-applovin-max@2.0.0).
*/
export enum ConsentDialogState {
UNKNOWN = 0,
APPLIES = 1,
@@ -80,11 +106,22 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* Check whether the SDK has been initialized.
*/
@Cordova()
isInitialized(): Promise<boolean> {
return;
}
@Cordova()
showMediationDebugger(): Promise<any> {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
getConsentDialogState(): Promise<ConsentDialogState> {
return;
@@ -100,11 +137,17 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
setIsAgeRestrictedUser(isAgeRestrictedUser: boolean): Promise<any> {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
isAgeRestrictedUser(): Promise<boolean> {
return;
@@ -130,8 +173,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @param {boolean} muted Whether ads should be muted.
*/
@Cordova()
setMuted(): Promise<boolean> {
setMuted(muted: boolean): Promise<any> {
return;
}
@@ -145,6 +191,19 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/** SEGMENT TARGETING */
/**
* Add a segment for segment targeting. Must be called before `initialize()`.
*
* @param {number} key The segment key.
* @param {number[]} values The segment values.
*/
@Cordova()
addSegment(key: number, values: number[]): Promise<any> {
return;
}
@Cordova()
trackEvent(event: string, parameters?: object): Promise<any> {
return;
@@ -167,6 +226,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova()
updateBannerPosition(adUnitId: string, position: AdViewPosition): Promise<any> {
return;
}
@Cordova()
setBannerExtraParameter(adUnitId: string, key: string, value: string): Promise<any> {
return;
@@ -187,6 +251,46 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdLoadedEvent',
})
onBannerAdLoaded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdLoadFailedEvent',
})
onBannerAdLoadFailed(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdClickedEvent',
})
onBannerAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdExpandedEvent',
})
onBannerAdExpanded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdCollapsedEvent',
})
onBannerAdCollapsed(): Observable<AdInfo> {
return;
}
/** MRECS */
@Cordova()
@@ -204,6 +308,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova()
updateMRecPosition(adUnitId: string, position: AdViewPosition): Promise<any> {
return;
}
@Cordova()
setMRecExtraParameter(adUnitId: string, key: string, value: string): Promise<any> {
return;
@@ -224,6 +333,46 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdLoadedEvent',
})
onMRecAdLoaded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdLoadFailedEvent',
})
onMRecAdLoadFailed(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdClickedEvent',
})
onMRecAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdExpandedEvent',
})
onMRecAdExpanded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdCollapsedEvent',
})
onMRecAdCollapsed(): Observable<AdInfo> {
return;
}
/** INTERSTITIALS */
@Cordova()
@@ -231,6 +380,14 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @param {string} adUnitId The ad unit id to check.
*/
@Cordova()
isInterstitialReady(adUnitId: string): Promise<boolean> {
return;
}
@Cordova()
showInterstitial(adUnitId: string, placement?: string): Promise<any> {
return;
@@ -249,6 +406,14 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnInterstitialClickedEvent',
})
onInterstitialClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnInterstitialLoadFailedEvent',
@@ -288,6 +453,14 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @param {string} adUnitId The ad unit id to check.
*/
@Cordova()
isRewardedAdReady(adUnitId: string): Promise<boolean> {
return;
}
@Cordova()
showRewardedAd(adUnitId: string, placement?: string): Promise<any> {
return;
@@ -306,6 +479,14 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdClickedEvent',
})
onRewardedAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdLoadFailedEvent',
@@ -332,9 +513,17 @@ export class Applovin extends AwesomeCordovaNativePlugin {
@Cordova({
eventObservable: true,
event: 'OnRewardedAdAdFailedToDisplayEvent',
event: 'OnRewardedAdFailedToDisplayEvent',
})
onRewardedAdAdFailedToDisplay(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdReceivedRewardEvent',
})
onRewardedAdReceivedReward(): Observable<AdRewardInfo> {
return;
}
}