Skip to content

Migration to version 1.x.x

Alexander Boldyrev edited this page Nov 8, 2022 · 1 revision

Changed configuration

Now for android you will have to set Firebase Sender ID via config.xml and not via javascript configuration. Refer to Quick start guide for more details.

Changed events

Events removed from 0.x.x Event to use instead in 1.x.x
logoutCompleted depersonalized
primaryChanged installationUpdated

depersonalized event is the direct replacement for logoutCompleted event. No more changes are required except event renaming.

installationUpdated is more common event that is intended to replace primaryChanged event. Handler of the installationUpdated event will receive the whole installation as an argument. So this handler

MobileMessaging.register('primaryChanged',
    function() {
        // primary changed on the server, request new value
    }
);

can be replaced with the following

MobileMessaging.register('installationUpdated',
    function(installation) {
        // here installation.isPrimaryDevice is available for utilization
    }
);

Installation management changes

Version 1.x.x introduced new installation data model that combines fields installation.pushRegistrationId, installation.isPrimaryDevice, installation.isPushRegistrationEnabled. These fields can be used instead of methods in 0.x.x to get/set primary status of device and isPushRegistrationEnabled flag to get pushRegistrationId.

Methods used in 0.x.x Field of installation in 1.x.x
enablePushRegistration, disablePushRegistration, isPushRegistrationEnabled installation.isPushRegistrationEnabled
setPrimary, isPrimary, syncPrimary installation.isPrimaryDevice
getPushRegistrationId installation.getPushRegistrationId

Instead of enablePushRegistration, disablePushRegistration and isPushRegistrationEnabled you can use isPushRegistrationEnabled flag of the installation data model. The same applies to setPrimary, isPrimary and syncPrimary, you can use isPrimaryDevice flag instead. Instead of getPushRegistrationId you can use pushRegistrationId of installation. It is available only as readonly. You cannot change this field on server.

User management changes

In version 1.x.x user data model was changed in the next way:

User data in 0.x.x User data model in 1.x.x
msisdn: string For example msisdn: '385989000000' phones: string[] For example phones: ['79210000000', '79110000000']
email: string For example email: 'john.smith@infobip.com' emails: string[] For example emails: ['one@email.com', 'two@email.com']
gender: 'M' or 'F' gender: 'Male' or 'Female'
birthdate: Date For example birthdate: Date() birthday: string where string is in date format yyyy-MM-dd. For example birthday: "1985-01-15"

Also some methods were removed but new ones introduced instead:

Methods used in 0.x.x Methods to use in 1.x.x
syncUserData saveUser, personalize
fetchUserData fetchUser
logout depersonalize

Notice

Functionality of syncUserData was decoupled into personalize and saveUser functions to avoid potential problems with person merging and to clarify the intent of explicitly attaching current device to the person. To learn more, read about User profile

Clone this wiki locally