Skip to content
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

Channel resumed parameter now has to be non-null #313

Merged
merged 3 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions ios/Classes/codec/AblyFlutterWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (void)writeValue:(id)value {
}

#define WRITE_VALUE(DICTIONARY, JSON_KEY, VALUE) { \
if (VALUE) { \
if ( (VALUE) != nil ) { \
[DICTIONARY setObject:VALUE forKey:JSON_KEY]; \
} \
}
Expand Down Expand Up @@ -228,7 +228,7 @@ +(NSString *) encodeChannelEvent: (ARTChannelEvent) event {
TxChannelStateChange_event,
[AblyFlutterWriter encodeChannelEvent: [stateChange event]]);

WRITE_VALUE(dictionary, TxChannelStateChange_resumed, [stateChange resumed]?@([stateChange resumed]):nil);
WRITE_VALUE(dictionary, TxChannelStateChange_resumed, [NSNumber numberWithBool: [stateChange resumed]]);
WRITE_VALUE(dictionary, TxChannelStateChange_reason, encodeErrorInfo([stateChange reason]));
return dictionary;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/src/platform/src/codec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ class Codec extends StandardMessageCodec {
_readFromJson<String>(jsonMap, TxChannelStateChange.previous));
final event = _decodeChannelEvent(
_readFromJson<String>(jsonMap, TxChannelStateChange.event));
final resumed = _readFromJson<bool>(jsonMap, TxChannelStateChange.resumed);
final resumed = _readFromJson<bool>(jsonMap, TxChannelStateChange.resumed)!;
final errorInfo =
toJsonMap(_readFromJson<Map>(jsonMap, TxChannelStateChange.reason));
final reason = (errorInfo == null) ? null : _decodeErrorInfo(errorInfo);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/realtime/src/channel_state_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ChannelStateChange {
ErrorInfo? reason;

/// https://docs.ably.com/client-lib-development-guide/features/#TH4
final bool? resumed;
final bool resumed;

/// initializes with [resumed] set to false
ChannelStateChange(
Expand Down