firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

[Sessions] Add optional interop between Crashlytics and Sessions

Open samedson opened this issue 3 years ago • 3 comments

Description

  • I originally defined FIRSessionsProvider in FirebaseSessions.swift. Then, in Crashlytics I was importing <FirebaseSessions/FirebaseSessions-Swift.h>. This was going to be fairly messy to code because it needs to be an optional import until Firebase Sessions releases, and all uses of the FIRSessionsProvider would need to be protected by #if __has_include... or some other IfDef.

  • Instead, I tried the AnalyticsInterop pattern, and it was fairly simple to implement, and makes this interum state easy to code by just giving us a nil sessions SDK when it's not installed in the customer's app.

Once Sessions SDK releases, we can make it a hard dependency by just moving FIRSessionsProvider to FirebaseSessions.swift, and importing <FirebaseSessions/FirebaseSessions-Swift.h>. I've added TODOs for this.

Example reading the session ID:

Screen Shot 2022-12-28 at 3 39 14 PM

TODO

  • [ ] Figure out how to wait for Subscribers in the Sessions SDK for the purposes of determining data collection state and filling in fields.

#no-changelog

samedson avatar Dec 28 '22 20:12 samedson

Size Report 1

Affected Products

  • FirebaseCrashlytics

    TypeBase (b2eaea9)Merge (d9f9df8)Diff
    CocoaPods?-51.5 kB? (?)

Test Logs

google-oss-bot avatar Dec 28 '22 20:12 google-oss-bot

Package.swift needs updates

@paulb777 so I thought that too, but for some reason we don't specify the Analytics Interop file here: https://github.com/firebase/firebase-ios-sdk/blob/master/Package.swift#L492-L533

Even though we do in the podspec: https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseCrashlytics.podspec#L36

And weirdly, Crashlytics builds when I open the Package.swift and compile the SDK target

samedson avatar Dec 28 '22 21:12 samedson

Oh right, SPM doesn't need referenced headers to be specified. There is an SPM CI problem though

paulb777 avatar Dec 28 '22 21:12 paulb777

Closing in favor of https://github.com/firebase/firebase-ios-sdk/pull/10664

samedson avatar Jan 11 '23 20:01 samedson