Repository navigation
Report DataSync object type on subscribe events #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6499540
74e0dae
269e6a6
7db45bf
5ba4b22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,19 +134,36 @@ listener.didReceiveBatchSubscription = { events in | |
| } | ||
|
|
||
| case .dataSyncChanged(let dataSyncEvent): | ||
| switch dataSyncEvent { | ||
| case let .entityCreated(entity): | ||
| print("Data Sync entity created: \(entity.id)") | ||
| case let .entityUpdated(entity): | ||
| print("Data Sync entity updated: \(entity.id)") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is not related to this file. Unknown result: the payload is a DataSync event (metadata.source == "data-sync", and metadata.event and metadata.type are present non-empty strings), but the pair isn't one Swift Keep dropping: the pair is known but the payload is broken, e.g. a required data field is missing. JVM drops these too, so behaviour matches.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll take a look at that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add |
||
| case let .entityDeleted(entity): | ||
| print("Data Sync entity deleted: \(entity.id)") | ||
| case let .relationshipCreated(relationship): | ||
| print("Data Sync relationship created: \(relationship.id)") | ||
| case let .relationshipUpdated(relationship): | ||
| print("Data Sync relationship updated: \(relationship.id)") | ||
| case let .relationshipDeleted(relationship): | ||
| print("Data Sync relationship deleted: \(relationship.id)") | ||
| print("Received on \(dataSyncEvent.channel) at \(dataSyncEvent.timetoken)") | ||
|
|
||
| switch dataSyncEvent.change { | ||
| case let .entityCreated(entityEvent): | ||
| let entity = entityEvent.entity | ||
| print("Entity \(entity.id) was created.") | ||
| print("Entity kind: \(entityEvent.kind)") | ||
| case let .entityUpdated(entityEvent): | ||
| let entity = entityEvent.entity | ||
| print("Entity \(entity.id) was updated.") | ||
| print("Entity kind: \(entityEvent.kind)") | ||
| case let .entityDeleted(entityEvent): | ||
| let removedEntity = entityEvent.removed | ||
| print("Entity \(removedEntity.id) was deleted.") | ||
| print("Entity kind: \(entityEvent.kind)") | ||
| case let .relationshipCreated(relationshipEvent): | ||
| let relationship = relationshipEvent.relationship | ||
| print("Relationship \(relationship.id) was created.") | ||
| print("Relationship kind: \(relationshipEvent.kind)") | ||
| case let .relationshipUpdated(relationshipEvent): | ||
| let relationship = relationshipEvent.relationship | ||
| print("Relationship \(relationship.id) was updated.") | ||
| print("Relationship kind: \(relationshipEvent.kind)") | ||
| case let .relationshipDeleted(relationshipEvent): | ||
| let removedRelationship = relationshipEvent.removed | ||
| print("Relationship \(removedRelationship.id) was deleted.") | ||
| print("Relationship kind: \(relationshipEvent.kind)") | ||
| case let .unknown(unknownEvent): | ||
| // An object type or action this SDK version doesn't recognize | ||
| print("Unrecognized \(unknownEvent.type) change: \(unknownEvent.event)") | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, could you add to
PubNubDataSyncRelationshipandPubNubDataSyncRemovedRelationshipclassLevel: PubNubDataSyncClassLeveland pass the decoded classLevel to them?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relationship classes are not possible for extensions. This is the reason why there's no
classLevelproperty inPubNubDataSyncRemovedRelationshipandPubNubDataSyncRelationship. Am I missing something crucial here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not present in CRUD operation but present in subscribe event. Currently for Membership it is "Global " and for Relationships it is "SubKey". But never mind we can handle this. The thing is that Kotlin and JS already have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then I'll add it to