This version of the plugin now requires iOS 14+ as the min deployment target and Xcode 14.3+.
The notification status object returned by Airship.push.getNotificationStatus()
has changed:
15.x:
export interface NotificationStatus {
/**
* If airship is opted in for push notifications are not.
*/
airshipOptIn: boolean;
/**
* If notifications are enabled on Airship or not.
*/
airshipEnabled: boolean;
/**
* If notifications are enabled in the app settings or not.
*/
systemEnabled: boolean;
/**
* iOS status.
*/
ios?: {
/**
* Authorized settings.
*/
authorizedSettings: iOS.AuthorizedNotificationSetting[];
/**
* Authorized status.
*/
authorizedStatus: iOS.AuthorizedNotificationStatus;
};
}
16.x:
/**
* Push notification status.
*/
export interface PushNotificationStatus {
/**
* If user notifications are enabled on [Airship.push].
*/
isUserNotificationsEnabled: boolean;
/**
* If notifications are allowed at the system level for the application.
*/
areNotificationsAllowed: boolean;
/**
* If the push feature is enabled on [Airship.privacyManager].
*/
isPushPrivacyFeatureEnabled: boolean;
/*
* If push registration was able to generate a token.
*/
isPushTokenRegistered: boolean;
/*
* If Airship is able to send and display a push notification .
*/
isOptedIn: boolean;
/*
* If user notifications are enabled on Airship and the notification permission is granted. This check
* checks for everything but if isPushTokenRegistered is true.
*/
isUserOptedIn: boolean;
}
The old flags can be determined using:
airshipOptIn = isOptedIn
airshipEnabled = isUserNotificationsEnabled && isPushPrivacyFeatureEnabled
systemEnabled = areNotificationsAllowed
On iOS, you can get the authorized settings and status using:
Airship.push.iOS.getAuthorizedSettings()
Airship.push.iOS.getAuthorizedStatus()
The NotificationOptInStatusEvent
has been replaced with PushNotificationStatusChangedEvent
which now returns the new PushNotificationStatus
object:
/**
* Event fired when the notification status changes.
*/
export interface NotificationStatusChangedEvent {
/**
* The notification status
*/
status: NotificationStatus
}
On iOS, you can use the new iOS.AuthorizedNotificationSettingsChangedEvent
event to be notified when authorized settings have changed.
The npm module is now published under the name @ua/react-native-airship
instead of urbanairship-react-native
. The Airship
instance is now also exported by default.
Old import import { UrbanAirship, EventType } from 'urbanairship-react-native';
New import
import Airship, { EventType } from '@ua/react-native-airship';
The package urbanairship-chat-react-native
and urbanairship-accengage-react-native
have been removed without a replacement. The chat
feature was discontinued and the Accengage package is only useful during the migration period from Accengage to Airship. Apps that still need to migrate should stick with 14.x until after the migration period.
The urbanairship-preference-center-react-native
is now in the main package. You can access it through Airship.preferenceCenter
. See the API changes for 1 to 1 method replacements.
The urbanairship-hms-react-native
has been removed and replaced with a new gradle flag airshipHmsEnabled
flag. You can set the flag to true
in the android/gradle.properties
file. In order to use HMS, the app still needs to include a dependency for com.huawei.hms:push
and apply the HMS gradle plugin. See Airship React Native setup guide for more info.
The API is now divided up into functional components that can eb accessed from the Airship
instance. Use the table
for replacements.
14.x | 15.x |
---|---|
UrbanAirship.takeOff(config: AirshipConfig): Promise | Airship.takeOff(config: AirshipConfig): Promise |
UrbanAirship.isFlying(): Promise | Airship.isFlying(): Promise |
UrbanAirship.addListener(eventType: EventType, listener: (...args: any[]) => any): Subscription | Airship.addListener(eventType: EventType, listener: (...args: any[]) => any): Subscription |
UrbanAirship.removeListener(eventType: EventType, listener: (...args: any[]) => any) | Airship.removeListener(eventType: EventType, listener: (...args: any[]) => any) |
UrbanAirship.removeAllListeners(eventType: EventType) | Airship.removeAllListeners(eventType: EventType) |
UrbanAirship.setEnabledFeatures(features: Feature[]): Promise | Airship.privacyManager.setEnabledFeatures(features: Feature[]): Promise |
UrbanAirship.getEnabledFeatures(): Promise<Feature[]> | Airship.privacyManager.getEnabledFeatures(): Promise<Feature[]> |
UrbanAirship.enableFeature(features: Feature[]): Promise | Airship.privacyManager.enableFeature(features: Feature[]): Promise |
UrbanAirship.disableFeature(features: Feature[]): Promise | Airship.privacyManager.disableFeature(features: Feature[]): Promise |
UrbanAirship.isFeatureEnabled(features: Feature[]): Promise | Airship.privacyManager.isFeatureEnabled(features: Feature[]): Promise |
UrbanAirship.enableChannelCreation() | Removed, use privacy manager flags |
UrbanAirship.addTag(tag: string) | Airship.channel.addTag(tag: string): Promise |
UrbanAirship.removeTag(tag: string) | Airship.channel.removeTag(tag: string): Promise |
UrbanAirship.getTags(): Promise<string[]> | Airship.channel.getTags(): Promise<string[]> |
UrbanAirship.getChannelId(): Promise<string | null | undefined> | Airship.channel.getChannelId(): Promise<string | null | undefined> |
UrbanAirship.editChannelTagGroups(): TagGroupEditor | Airship.channel.editTagGroups(): TagGroupEditor |
UrbanAirship.editChannelAttributes(): AttributeEditor | Airship.channel.editAttributes(): AttributeEditor |
UrbanAirship.editSubscriptionLists(): SubscriptionListEditor | Airship.channel.editSubscriptionLists(): SubscriptionListEditor |
UrbanAirship.editChannelSubscriptionLists(): SubscriptionListEditor | Airship.channel.editSubscriptionLists(): SubscriptionListEditor |
UrbanAirship.getSubscriptionLists(types?: [...SubscriptionListType[]]): Promise | Airship.channel.getSubscriptionLists(): Promise<string[]> and Airship.contactgetSubscriptionLists(): Promise<Record<string, SubscriptionScope[]>> |
UrbanAirship.setNamedUser(namedUser: string | null | undefined) | Airship.contact.identify(namedUserId: String): Promise and Airship.contact.reset(): Promise |
UrbanAirship.getNamedUser(): Promise<string | null | undefined> | Airship.contact.getNamedUserId(): Promise<string | null | undefined> |
UrbanAirship.editNamedUserAttributes(): AttributeEditor | Airship.contact.editAttributes(): AttributeEditor |
UrbanAirship.editContactAttributes(): AttributeEditor | Airship.contact.editAttributes(): AttributeEditor |
UrbanAirship.editContactSubscriptionLists(): ScopedSubscriptionListEditor | Airship.contact.editSubscriptionLists(): ScopedSubscriptionListEditor |
UrbanAirship.editNamedUserTagGroups(): TagGroupEditor | Airship.contact.editTagGroups(): TagGroupEditor |
UrbanAirship.editContactTagGroups(): TagGroupEditor | Airship.contact.editTagGroups(): TagGroupEditor |
UrbanAirship.isUserNotificationsOptedIn(): Promise | Removed, use Airship.push.getNotificationStatus() instead. |
UrbanAirship.isSystemNotificationsEnabledForApp(): Promise | Removed, use Airship.push.getNotificationStatus() instead. |
UrbanAirship.getNotificationStatus(): Promise | Airship.push.getNotificationStatus(): Promise |
UrbanAirship.getNotificationChannelStatus(channel: string): Promise | Airship.push.isNotificationChannelEnabled(channel: string): Promise |
UrbanAirship.setAndroidNotificationConfig(config: NotificationConfigAndroid) | Airship.push.android.setNotificationConfig(config: Android.NotificationConfig) |
UrbanAirship.setUserNotificationsEnabled(enabled: boolean) | Airship.push.setUserNotificationsEnabled(enabled: boolean): Promise |
UrbanAirship.isUserNotificationsEnabled(): Promise | Removed, use Airship.push.getNotificationStatus() instead. |
UrbanAirship.enableUserPushNotifications(): Promise | Airship.push.enableUserNotifications(): Promise |
UrbanAirship.getRegistrationToken(): Promise<string | null | undefined> | Airship.push.getRegistrationToken(): Promise<string | null | undefined> |
UrbanAirship.setForegroundPresentationOptions(options: ForegroundNotificationOptionsIOS | [iOS.ForegroundPresentationOption]) | Airship.push.iOS.setForegroundPresentationOptions(options: iOS.ForegroundPresentationOption[]): Promise |
UrbanAirship.setNotificationOptions(options: [iOS.NotificationOption]) | Airship.push.iOS.setNotificationOptions(options: iOS.NotificationOption[]): Promise |
UrbanAirship.setAutobadgeEnabled(enabled: boolean) | Airship.push.iOS.setAutobadgeEnabled(enabled: boolean): Promise |
UrbanAirship.isAutobadgeEnabled(): Promise | Airship.push.iOS.isAutobadgeEnabled(): Promise |
UrbanAirship.setBadgeNumber(badgeNumber: number) | Airship.push.iOS.setBadgeNumber(badgeNumber: number): Promise |
UrbanAirship.getBadgeNumber(): Promise | Airship.push.iOSgetBadgeNumber(): Promise |
UrbanAirship.getActiveNotifications(): Promise<PushMessage[]> | Airship.push.getActiveNotifications(): Promise<PushNotification[]> |
UrbanAirship.clearNotifications() | Airship.push.clearNotifications() |
UrbanAirship.clearNotification(identifier: string) | Airship.push.clearNotification(identifier: string) |
UrbanAirship.runAction(name: string, value?: JsonValue): Promise<JsonValue | Error> | Airship.actions.run(name: string, value?: JsonValue): Promise<JsonValue | Error> |
UrbanAirship.associateIdentifier(key: string, id?: string) | Airship.analytics.associateIdentifier(key: string, id?: string) |
UrbanAirship.addCustomEvent(event: CustomEvent): Promise<null | Error> | Airship.analytics.addCustomEvent(event: CustomEvent): Promise<null | Error> |
UrbanAirship.setAnalyticsEnabled(enabled: boolean) | Removed, use privacy manager flags |
UrbanAirship.isAnalyticsEnabled(): Promise | Removed, use privacy manager flags |
UrbanAirship.trackScreen(screen: string) | Airship.analytics.trackScreen(screen: string?): Promise |
UrbanAirship.getUnreadMessageCount(): Promise | Airship.messageCenter.getUnreadCount(): Promise |
UrbanAirship.displayMessageCenter() | Airship.messageCenter.display(messageId?: string): Promise |
UrbanAirship.dismissMessageCenter() | Airship.messageCenter.dismiss(): Promise |
UrbanAirship.displayMessage(messageId: string): Promise | Airship.messageCenter.display(messageId?: string): Promise |
UrbanAirship.dismissMessage() | Airship.messageCenter.dismiss(): Promise |
UrbanAirship.getInboxMessages(): Promise<InboxMessage[]> | Airship.messageCenter.getMessages(): Promise<InboxMessage[]> |
UrbanAirship.deleteInboxMessage(messageId: string): Promise | Airship.messageCenter.deleteMessage(messageId: string): Promise |
UrbanAirship.markInboxMessageRead(messageId: string): Promise | Airship.messageCenter.markMessageRead(messageId: string): Promise |
UrbanAirship.refreshInbox(): Promise | Airship.messageCenter.refreshMessages(): Promise |
UrbanAirship.setAutoLaunchDefaultMessageCenter(enabled: boolean) | Airship.messageCenter.setAutoLaunchDefaultMessageCenter(enabled: boolean) |
UrbanAirship.setCurrentLocale(localeIdentifier: String) | Airship.locale.setLocaleOverride(localeIdentifier: String): Promise |
UrbanAirship.getCurrentLocale(): Promise | Airship.locale.getCurrentLocale(): Promise |
UrbanAirship.clearLocale() | Airship.locale.clearLocaleOverride(): Promise |
UrbanAirship.setInAppAutomationDisplayInterval(seconds: number) | Airship.inApp.setDisplayInterval(milliseconds: number): Promise |
AirshipPreferenceCenter.openPreferenceCenter(preferenceCenterId: String) | Airship.preferenceCenter.display(preferenceCenterId: String): Promise |
AirshipPreferenceCenter.getConfiguration(preferenceCenterId: String): Promise | Airship.preferenceCenter.getConfig(preferenceCenterId: String): Promise |
AirshipPreferenceCenter.setUseCustomPreferenceCenterUi(useCustomUi: boolean, preferenceCenterId: String) | Airship.preferenceCenter.setAutoLaunchDefaultPreferenceCenterut(useCustomUi: boolean, preferenceCenterId: String) |
AirshipPreferenceCenter.addPreferenceCenterOpenListener(listener: (...args: any[]) => any): Subscription | Removed, use normal addListener |
14.x | 15.x | Notes |
---|---|---|
EventType.NotificationResponse | EventType.NotificationResponse | The notification property has been renamed to pushPayload |
EventType.PushReceived | EventType.PushReceived | The push body is now under a sub property pushPayload |
EventType.Register | EventType.ChannelCreated and EventType.PushTokenReceived | |
EventType.Registration | EventType.ChannelCreated and EventType.PushTokenReceived | |
EventType.DeepLink | EventType.DeepLink | |
EventType.NotificationOptInStatus | EventType.NotificationOptInStatus | The array of authorized setting names is now under ios.authorizedSettings |
EvenType.InboxUpdated | EventType.MessageCenterUpdated | |
EvenType.ShowInbox | EventType.DisplayMessageCenter | |
EventType.ConversationUpdated | Removed | |
EventType.OpenChat | Removed | |
EventType.OpenPreferenceCenter | EventType.DisplayPreferenceCenter |
The list of available features no longer includes all
or none
. A new constant FEATURES_ALL
is available that is a list of all features that can be used instead of all
. For none
, use an empty array instead.
Data collection enabled has been replaced with privacy manager.
// 11.x
static setDataCollectionEnabled(enabled: boolean)
static isDataCollectionEnabled(): Promise<boolean>
// 12.x
static enableFeature(features: Feature[]): Promise<boolean>
static disableFeature(features: Feature[]): Promise<boolean>
static isFeatureEnabled(features: Feature[]): Promise<boolean>
For more infomration on privacy manager, please read:
Location support is now provided by the new urbanairship-location-react-native
module. Previous
integration steps that required manually installing AirshipLocation or AirshipLocationKit framework
dependencies are no longer neessary.
UACustomEvent
->CustomEvent
UAMessageView
->MessageView
getQuietTime
setQuietTime
getQuietTimeEnabled
setQuietTImeEnabled
EventType
enum (backwards compatible with raw event strings such as"register"
,"notificationReceived"
, etc)
The module has been completely rewritten in TypeScript, and so typings now have full coverage, with a handful of small changes.
Message
->InboxMessage
MessageCloseEvent
->MessageClosedEvent
JsonMap
->JsonObject
Event
->EventType
MessageLoadError
As of 7.0.0 Flow typings are no longer provided, but existing apps written in Flow as well as plain JavaScript apps will continue to work with the module. For new apps needing static type checking, TypeScript is strongly recommended.
Due to changes to the iOS SDK, location services now require an additional dependency on AirshipLocationKit. See the location documentation for more details.