Skip to content

Commit

Permalink
Added new fields to the ARTMessage.
Browse files Browse the repository at this point in the history
  • Loading branch information
maratal committed Nov 21, 2024
1 parent a241afa commit 8812dfc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/ARTJsonLikeEncoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ - (ARTMessage *)messageFromDictionary:(NSDictionary *)input {
ARTMessage *message = [[ARTMessage alloc] init];
message.id = [input artString:@"id"];
message.name = [input artString:@"name"];
message.action = ([input artNumber:@"action"] ?: [[NSNumber alloc] initWithInt:ARTMessageCreate]).integerValue;
message.serial = [input artString:@"serial"];
message.clientId = [input artString:@"clientId"];
message.data = [input objectForKey:@"data"];
message.encoding = [input artString:@"encoding"];;
Expand Down
17 changes: 17 additions & 0 deletions Source/include/Ably/ARTMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
#import <Ably/ARTTypes.h>
#import <Ably/ARTChannelOptions.h>

NS_SWIFT_SENDABLE
typedef NS_ENUM(NSUInteger, ARTMessageAction) {
ARTMessageUnset,
ARTMessageCreate,
ARTMessageUpdate,
ARTMessageDelete,
ARTMessageAnnotationCreate,
ARTMessageAnnotationDelete,
ARTMessageMetaOccupancy,
};

NS_ASSUME_NONNULL_BEGIN

/**
Expand All @@ -14,6 +25,12 @@ NS_ASSUME_NONNULL_BEGIN
/// The event name, if available
@property (nullable, readwrite, nonatomic) NSString *name;

/// The action identifier
@property (readwrite, nonatomic) ARTMessageAction action;

/// The serial lexicographic identifier
@property (nullable, readwrite, nonatomic) NSString *serial;

/**
* Construct an `ARTMessage` object with an event name and payload.
*
Expand Down

0 comments on commit 8812dfc

Please sign in to comment.