Skip to content

Conversation

@marco-saia-datadog
Copy link
Member

@marco-saia-datadog marco-saia-datadog commented May 13, 2024

What does this PR do?

Exposes native getCurrentSessionId() method introduced with #1810 and #1616.

Notes

Initially, I have added a BoundedBuffer method to handle callbacks with optional strings. I have decided to remove it in the end since, as opposed to the other SDK functions, getCurrentSessionId() does not perform any action on the backend, and it would not make sense to await its result until the initialization is done (it would actually block the initialization from being called).

Therefore, I have decided to expose DdSdkReactNative.wasInitialized in order to perform a simple check on whether the SDK is initialized or not before returning the current session ID.

Additional Notes

In DdRumImplementation.swift I have used:

    @objc
    public func getCurrentSessionId(_ resolve: @escaping (Any?) -> Void, reject: RCTPromiseRejectBlock) -> Void {

instead of

    @objc
    public func getCurrentSessionId(_ resolve: @escaping RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {

As the @objc macro generates broken and malformed bridge header code otherwise.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-1963/session-id-getter branch 3 times, most recently from 0d4aaab to 637d7a9 Compare May 13, 2024 16:18
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-1963/session-id-getter branch 5 times, most recently from 4afd5ae to 448e45c Compare May 14, 2024 08:27
@marco-saia-datadog marco-saia-datadog marked this pull request as ready for review May 14, 2024 08:57
@marco-saia-datadog marco-saia-datadog requested a review from a team as a code owner May 14, 2024 08:57
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-1963/session-id-getter branch from 5228daf to d65fa79 Compare May 14, 2024 12:51
@marco-saia-datadog marco-saia-datadog requested a review from 0xnm May 14, 2024 12:58
@marco-saia-datadog marco-saia-datadog merged commit f6880fe into develop May 14, 2024
@marco-saia-datadog marco-saia-datadog deleted the marcosaia/RUM-1963/session-id-getter branch May 14, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants