Skip to content

Conversation

kstenerud
Copy link
Contributor

A client library loads the API class "BD_InternalAPI_Capture" and then calls "exposeAPI" on it to link up at runtime. If the class fails to load, or the requested API doesn't exist, it downgrades gracefully to a no-op rather than crashing.

See InternalAPI.h for a more thorough description + example client.

The unit tests also include SampleClient.[hm], which is a full example of a client library.

@kstenerud kstenerud requested review from kattrali and snowp June 5, 2025 13:16
@kstenerud
Copy link
Contributor Author

Note: I'm not sure if the Bazel changes are the best way to do this!

visibility = visibility,
)

def bitdrift_mobile_swift_objc_test(name, srcs_swift, srcs_objc, data = [], deps = [], tags = [], use_test_host = False, repository = "", visibility = []):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically a copy of bitdrift_mobile_swift_test with an additional objc_library cribbed from bitdrift_mobile_objc_test in this same file.

Copy link
Contributor

@kattrali kattrali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense overall. I think a good next step is probably to pull the branch into the RN library and try it out, to test both the ergonomics and the functionality work as expected. wdyk, @snowp? (Since I think you were looking into having internal APIs for RN?)

Another set of eyes on the build system changes also would help, maybe @Reflejo?

@kattrali kattrali requested a review from Reflejo June 6, 2025 15:12
@snowp
Copy link
Contributor

snowp commented Jun 9, 2025

Yeah the way this would be hooked up for the RN use case would be to expose some variant of https://github.com/bitdriftlabs/capture-sdk/blob/main/platform/swift/source/Logger.swift#L248 via this new interface such that the RN implementation at https://github.com/bitdriftlabs/capture-es/blob/main/packages/react-native/ios/BdReactNative.mm can expose a RN function to log a span log. The capture-es RN library consumes capture-sdk via Cocapods but there there is some way to pull in a branch?

The code on the RN to create a span was never merged since we ran into this issue, but I have some old code that implemented it here bitdriftlabs/capture-es@cb61ea2 that we could bring back to call the RN function whenever we have time to put all this together

…ur libraries.

A client library loads the API class "BD_InternalAPI_Capture" and then calls "exposeAPI" on it to link up at runtime.
If the class fails to load, or the requested API doesn't exist, it downgrades gracefully to a no-op rather than crashing.

See InternalAPI.h for a more thorough description + example client.
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