chore: Identify API for MAUI refactor#156
Conversation
Sources/LaunchDarklySessionReplay/SessionReplayHookExporter.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| public var hookProxy: SessionReplayHookProxy? | ||
| public var hookProxy: SessionReplayHookProxy? { | ||
| client.map { SessionReplayHookProxy(sessionReplayService: $0) } | ||
| } |
There was a problem hiding this comment.
Computed hookProxy creates new instance on every access
Medium Severity
The hookProxy property changed from a stored property to a computed property, meaning every access allocates a new SessionReplayHookProxy (an NSObject subclass) instead of returning a cached instance. This is particularly wasteful for the C#/MAUI bridge, where each call like LDReplay.shared.hookProxy?.afterIdentify(...) creates a throwaway object. The sibling LDObserve.shared.hookProxy remains a stored property set once in getHooks(), making this inconsistent across the two plugins.


Make architecture more iOS standard ( delegate )
Note
Medium Risk
Refactors the identify hook/bridge path to call into
SessionReplayServicevia a new delegate method, which could affect when/if identify events are emitted. Risk is limited to session-replay observability behavior (no auth/payment changes) but touches cross-platform bridge code.Overview
Refactors Session Replay’s identify handling so both the native SDK hook and the MAUI/C# bridge proxy delegate directly to
SessionReplayService.afterIdentify(...), instead of constructing identify payloads insideSessionReplayHook/SessionReplayHookProxy.LDReplay.hookProxyis now a computed property derived from the currentclient, andSessionReplayreuses a singleSessionReplayHookinstance with a weakdelegate.SessionReplayServicenow retainsobservabilityContextand owns the identify payload creation/scheduling.Minor updates include conditional
Commonimports for non-CocoaPods builds, a formatting fix inInitializeSessionOperation, and enablingcrashReportingin the test app’sObservabilityplugin options.Written by Cursor Bugbot for commit 01a088d. This will update automatically on new commits. Configure here.