Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

2.6.0

Compare
Choose a tag to compare
@StephenCoady StephenCoady released this 23 Jul 13:58
· 67 commits to master since this release

DataSync

Support Apollo 2.6.x

Apollo Client 2.6.x with new typings is now supported.

Extended conflict support

New conflict implementation requires changes on both client and server.
On server we have changed conflict detection mechanism to single method.
Server side conflict resolution was removed due to the fact that we could not provide
reliable diff source without separate store.

Server side implementation:
 const conflictError = conflictHandler.checkForConflict(greeting, args);
      if (conflictError) {
        throw conflictError;
      }
}
Client side implementation:

Client side implementation now requires users to apply returnType to context when performing a mutation.
Conflict interface now has an additional method mergeOccured that will be triggered when a conflict was resolved without data loss.

Please refer to documentation for more details.

Breaking changes

Cache Helper Interface

Cache Helper interface now will now accept object instead of individual parameters:

const updateFunction = getUpdateFunction({
           mutationName,
           idField,
           operationType,
           updateQuery
});
AuthContext Interface

Refactored the Auth interfaces defined in the auth and sync packages to accept a map of headers. token is no longer required.

OfflineClient Interface

offlineMutation has been renamed to offlineMutate. Please review if you are using offlineMutation in your app.

Push

Registration:

A bug was fixed with the registration process which made the sdk unable to receive notifications from UPS without using the alias criteria. That problem was fixed and now devices are able to receive notifications using all criteria provided by UPS (variant, alias, category)

The new registration process doesn’t use the phonegap-push-plugin/Ionic Push anymore. Now all the steps needed to receive push notification are handled by the push JS SDK itself.

import { PushRegistration } from "@aerogear/push";

new PushRegistration(new ConfigurationService(config)).register()
.then(() => {
  console.log('Push registration successful');
}).catch((err) => {
  console.error('Push registration unsuccessful ', err);
});

Unregistration:

We have added an unregister method to the SDK to unregister devices from UPS

new PushRegistration(new ConfigurationService(config))
.unregister()
.then(() => {
  console.log('Successfully unregistered');
}).catch((err) => {
  console.error('Error unregistering', err);
});

Handle notification:

We replaced the Cordova/Ionic notification handler APIs with APIs provided by the push JS SDK:

PushRegistration.onMessageReceived((notification: any) => {
  console.log('Received a push notification', notification);
});