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

Fix ARTChannel.setOptions and ARTRealtimeChannel.setOptions: Recreate ARTDataEncoder on ARTChannel options update #1208

Merged
merged 4 commits into from
Nov 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Source/ARTChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ - (void)setOptions:(ARTChannelOptions *)options {

- (void)setOptions_nosync:(ARTChannelOptions *)options {
_options = options;
[self recreateDataEncoderWith:options.cipher];
lawrence-forooghian marked this conversation as resolved.
Show resolved Hide resolved
}

- (void)recreateDataEncoderWith:(ARTCipherParams*)cipher {
NSError *error = nil;
_dataEncoder = [[ARTDataEncoder alloc] initWithCipherParams:cipher error:&error];

if (error != nil) {
ben-xD marked this conversation as resolved.
Show resolved Hide resolved
[_logger warn:@"creating ARTDataEncoder: %@", error];
ben-xD marked this conversation as resolved.
Show resolved Hide resolved
_dataEncoder = [[ARTDataEncoder alloc] initWithCipherParams:nil error:nil];
}
}

- (void)publish:(NSString *)name data:(id)data {
Expand Down