[Sessions] Add optional interop between Crashlytics and Sessions
Description
-
I originally defined
FIRSessionsProviderin 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 theFIRSessionsProviderwould 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
nilsessions 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:

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
Size Report 1
Affected Products
FirebaseCrashlyticsType Base (b2eaea9) Merge (d9f9df8) Diff CocoaPods ? -51.5 kB ? (?)
Test Logs
- Merge (d9f9df8): https://github.com/firebase/firebase-ios-sdk/actions/runs/3796507071
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
Oh right, SPM doesn't need referenced headers to be specified. There is an SPM CI problem though
Closing in favor of https://github.com/firebase/firebase-ios-sdk/pull/10664