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

Move presence property back to ARTRealtime and change its type back to concrete #2015

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Jan 16, 2025

This reverts 26d9bf7.

That change, which moved the presence property from the ARTRealtimeChannel class to ARTRealtimeChannelProtocol, changed the type of the property from ARTRealtimePresence to
id<ARTRealtimePresenceProtocol>. This is a breaking change for anybody who was relying on the property returning the concrete type, one such example being our Asset Tracking SDK. So, we undo it.

The change made in 26d9bf7 was triggered by us noticing, whilst working on the Chat SDK — which does its best to avoid referring to ably-cocoa's concrete types — that when you have an ably-cocoa concrete type ConcreteA which implements a protocol ProtocolA, and where ConcreteA has a public method or property someMethod which returns an instance of another concrete type ConcreteB which happens to implement a protocol ConcreteB, then someMethod is always defined directly on ConcreteA, not on ProtocolA. We wondered "why can't these methods be on ProtocolA instead?", hence 26d9bf7. But the first reason is that we can't because in order to do this it makes sense for you to also change the the return type of someMethod from ConcreteB to ProtocolB, which is a breaking change as we've seen here. But also I'm not sure whether it'd work even if we accepted the breaking change; for example, I don't know if you can mark a protocol as Sendable in Objective-C (haven't looked into it since we currently have no intention of making the breaking change, but one to investigate if we consider it in the future).

Resolves #2003.

Summary by CodeRabbit

  • Code Refactoring

    • Updated internal presence property naming from internalPresence to presence across multiple files
    • Simplified access to channel presence management
  • Type Changes

    • Modified presence property return type from protocol to concrete class in ARTRealtimeChannel
  • Test Updates

    • Adjusted test cases to reflect new presence property naming
    • Ensured consistent presence management validation

That change, which moved the `presence` property from the
ARTRealtimeChannel class to ARTRealtimeChannelProtocol, changed the type
of the property from ARTRealtimePresence to
id<ARTRealtimePresenceProtocol>. This is a breaking change for anybody
who was relying on the property returning the concrete type, one such
example being our Asset Tracking SDK. So, we undo it.

The change made in 26d9bf7 was triggered by us noticing, whilst working
on the Chat SDK — which does its best to avoid referring to ably-cocoa's
concrete types — that when you have an ably-cocoa concrete type
ConcreteA which implements a protocol ProtocolA, and where ConcreteA has
a public method or property `someMethod` which returns an instance of
another concrete type ConcreteB which happens to implement a protocol
ConcreteB, then `someMethod` is always defined directly on ConcreteA,
not on ProtocolA. We wondered "why can't these methods be on ProtocolA
instead?", hence 26d9bf7. But the first reason is that we can't because
in order to do this it makes sense for you to also change the the return
type of `someMethod` from ConcreteB to ProtocolB, which is a breaking
change as we've seen here. But also I'm not sure whether it'd work even
if we accepted the breaking change; for example, I don't know if you can
mark a protocol as Sendable in Objective-C (haven't looked into it since
we currently have no intention of making the breaking change, but one to
investigate if we consider it in the future).

Resolves #2003.
Copy link

coderabbitai bot commented Jan 16, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 SwiftLint (0.57.0)
Test/Tests/RealtimeClientChannelTests.swift

[
{
"character" : 47,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 63,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 606,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 663,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 779,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 818,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 851,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 915,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 1134,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 1277,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 1857,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 1946,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 1982,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2308,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2331,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2360,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2390,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2419,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2640,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2660,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2699,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2730,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2756,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2781,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 76,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2824,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 40,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2958,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2964,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 66,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2967,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3013,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 70,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3016,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3017,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3018,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3052,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 70,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3055,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3056,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3057,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3086,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 70,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3089,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3090,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3091,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3123,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3448,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 4112,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 63,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 4769,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 67,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 4778,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 12,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 2650,
"reason" : "TODOs should be resolved (limit the total number of mess...)",
"rule_id" : "todo",
"severity" : "Warning",
"type" : "Todo"
},
{
"character" : 16,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 3832,
"reason" : "TODOs should be resolved (->)",
"rule_id" : "todo",
"severity" : "Warning",
"type" : "Todo"
},
{
"character" : 54,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 527,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 982,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 37,
"file" : "/Test/Tests/RealtimeClientChannelTests.swift",
"line" : 4320,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
}
]

Test/Tests/RealtimeClientPresenceTests.swift

[
{
"character" : 47,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 83,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 134,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 1137,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 40,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 1368,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 1394,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 2119,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 2161,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 2655,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 54,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 2700,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 2868,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 40,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 3204,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 3382,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 41,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 3642,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 45,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 3659,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 3694,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 10,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 2797,
"reason" : "Type name 'TestCase_ReusableTestsTestPresencePerformMethod' should only contain alphanumeric and other allowed characters",
"rule_id" : "type_name",
"severity" : "Error",
"type" : "Type Name"
},
{
"character" : 39,
"file" : "/Test/Tests/RealtimeClientPresenceTests.swift",
"line" : 2669,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
}
]

Walkthrough

The pull request introduces changes to the Ably Cocoa SDK's presence management, primarily focusing on refactoring how presence is accessed and handled across multiple files. The modifications involve changing the presence property from a protocol-based return type to a concrete class type, renaming internal variables, and updating method signatures to reflect these changes. These updates aim to streamline the presence functionality and improve code clarity.

Changes

File Change Summary
Source/ARTRealtimeChannel.m - Changed presence return type from id<ARTRealtimePresenceProtocol> to ARTRealtimePresence *
- Renamed _internalPresence to _realtimePresence
Source/ARTRealtimeChannels.m - Updated presence unsubscribe method from channel.internalPresence to channel.presence
Source/PrivateHeaders/Ably/ARTRealtimeChannel+Private.h - Renamed internalPresence property to presence
Source/include/Ably/ARTRealtimeChannel.h - Added presence property of type ARTRealtimePresence *
- Removed presence property from ARTRealtimeChannelProtocol
Source/include/Ably/ARTRealtimePresence.h - Added import for ARTRealtimeChannel.h
Test Files - Updated references from internalPresence to presence in various test cases

Assessment against linked issues

Objective Addressed Explanation
Resolve compatibility issue with ably-asset-tracking-swift [#2003]

Possibly related issues

  • ably/ably-cocoa#1994: Expose presence on ARTRealtimeChannelProtocol - This PR seems to directly address the need for more straightforward presence access.

Poem

🐰 A Rabbit's Refactoring Rhyme 🐰

In channels of presence, a change takes flight,
From protocol's maze to a clearer sight,
Renaming and shifting with surgical grace,
Our code now dances with elegant pace!
Hop, hop, hurray for clean design! 🎉


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba7809 and e216ae5.

📒 Files selected for processing (8)
  • Source/ARTRealtimeChannel.m (10 hunks)
  • Source/ARTRealtimeChannels.m (1 hunks)
  • Source/PrivateHeaders/Ably/ARTRealtimeChannel+Private.h (1 hunks)
  • Source/include/Ably/ARTRealtimeChannel.h (2 hunks)
  • Source/include/Ably/ARTRealtimePresence.h (1 hunks)
  • Test/Tests/RealtimeClientChannelTests.swift (2 hunks)
  • Test/Tests/RealtimeClientPresenceTests.swift (51 hunks)
  • Test/Tests/RestClientPresenceTests.swift (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Source/include/Ably/ARTRealtimePresence.h
🧰 Additional context used
📓 Learnings (4)
Source/ARTRealtimeChannels.m (1)
Learnt from: maratal
PR: ably/ably-cocoa#1995
File: Source/ARTRealtimeChannel.m:227-227
Timestamp: 2024-11-12T07:31:47.967Z
Learning: In `ARTRealtimeChannelInternal`, the `internalPresence` property is declared in the private header `ARTRealtimeChannel+Private.h`, so it does not need to be redeclared in `ARTRealtimeChannel.m`.
Source/PrivateHeaders/Ably/ARTRealtimeChannel+Private.h (1)
Learnt from: maratal
PR: ably/ably-cocoa#1995
File: Source/ARTRealtimeChannel.m:227-227
Timestamp: 2024-11-12T07:31:47.967Z
Learning: In `ARTRealtimeChannelInternal`, the `internalPresence` property is declared in the private header `ARTRealtimeChannel+Private.h`, so it does not need to be redeclared in `ARTRealtimeChannel.m`.
Source/include/Ably/ARTRealtimeChannel.h (2)
Learnt from: maratal
PR: ably/ably-cocoa#1995
File: Source/ARTRealtimeChannel.m:227-227
Timestamp: 2024-11-12T07:31:47.967Z
Learning: In `ARTRealtimeChannelInternal`, the `internalPresence` property is declared in the private header `ARTRealtimeChannel+Private.h`, so it does not need to be redeclared in `ARTRealtimeChannel.m`.
Learnt from: maratal
PR: ably/ably-cocoa#1973
File: Source/include/Ably/ARTRealtimeChannelOptions.h:33-33
Timestamp: 2024-11-12T07:31:53.691Z
Learning: `ARTChannelOptions` is already marked with `NS_SWIFT_SENDABLE`.
Source/ARTRealtimeChannel.m (1)
Learnt from: maratal
PR: ably/ably-cocoa#1995
File: Source/ARTRealtimeChannel.m:227-227
Timestamp: 2024-11-12T07:31:47.967Z
Learning: In `ARTRealtimeChannelInternal`, the `internalPresence` property is declared in the private header `ARTRealtimeChannel+Private.h`, so it does not need to be redeclared in `ARTRealtimeChannel.m`.
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: check (macOS, test_macOS)
  • GitHub Check: check (tvOS, test_tvOS17_2)
  • GitHub Check: check (iOS, test_iOS17_2)
  • GitHub Check: check
  • GitHub Check: build
  • GitHub Check: check
🔇 Additional comments (11)
Source/PrivateHeaders/Ably/ARTRealtimeChannel+Private.h (1)

22-22: LGTM! Property renamed for consistency.

The property has been correctly renamed from internalPresence to presence while maintaining its type as ARTRealtimePresenceInternal. This change aligns with the PR objective and maintains proper encapsulation.

Source/ARTRealtimeChannels.m (1)

119-119: LGTM! Property access updated consistently.

The property access has been updated from internalPresence to presence to match the renamed property, maintaining the same unsubscribe functionality.

Source/include/Ably/ARTRealtimeChannel.h (1)

183-186: LGTM! Property added with proper type and documentation.

The presence property has been correctly added with:

  • Concrete type ARTRealtimePresence instead of protocol type
  • Proper readonly access
  • Clear documentation
Source/ARTRealtimeChannel.m (4)

80-81: LGTM! Getter implementation is correct.

The presence getter correctly initializes and returns an ARTRealtimePresence instance using the internal presence object.


227-227: LGTM! Instance variable renamed and initialized correctly.

The instance variable has been renamed from _internalPresence to _realtimePresence for better clarity, and its initialization remains correct.

Also applies to: 266-266


570-570: LGTM! Property accesses updated consistently.

All references to the presence property have been updated consistently throughout the file, maintaining the same functionality while using the new property name.

Also applies to: 577-577, 807-807, 811-811


1029-1030: LGTM! Added safety check for presence sync.

A safety check has been added to handle presence sync state during channel detachment, which improves robustness.

Test/Tests/RealtimeClientPresenceTests.swift (2)

168-169: Consistent refactoring of presence member access.

The changes replace internal.internalPresence with internal.presence for accessing presence members, making the code more consistent and cleaner.

Also applies to: 192-193, 198-199, 215-217, 219-222


2804-2804: Method signature update for better type safety.

The method signature now uses concrete ARTRealtimePresence type instead of ARTRealtimePresenceProtocol, which aligns with the broader refactoring to use concrete types.

Test/Tests/RealtimeClientChannelTests.swift (1)

192-193: Simplified presence member access path.

The changes update the access path for presence members from internal.internalPresence.members to internal.presence.members. This aligns with the PR objective of moving the presence property back to ARTRealtime and simplifies the access path.

Also applies to: 198-199, 215-222

Test/Tests/RestClientPresenceTests.swift (1)

100-100: Simplified presence member access path.

The change updates the access path for presence members from internal.internalPresence.members to internal.presence.members, consistent with the changes in RealtimeClientChannelTests.swift.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@umair-ably umair-ably merged commit bd1a494 into main Jan 17, 2025
8 checks passed
@umair-ably umair-ably deleted the revert-presence-on-realtime-protocol branch January 17, 2025 14:05
@coderabbitai coderabbitai bot mentioned this pull request Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1.2.34 and newer are incompatible with ably-asset-tracking-swift
3 participants