Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Crashlytics Integration with FullStory #68

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OpenEdX/DI/AppAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class AppAssembly: Assembly {
FirebaseAnalyticsService()
}.inObjectScope(.container)

container.register(FullStoryAnalyticsService.self) { r in
FullStoryAnalyticsService()
container.register(FullStoryAnalyticsService.self) { _, firebaseEnabled in
FullStoryAnalyticsService(firebaseEnabled)
}.inObjectScope(.container)

container.register(PipManagerProtocol.self) { r in
Expand Down
5 changes: 4 additions & 1 deletion OpenEdX/Managers/AnalyticsManager/AnalyticsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class AnalyticsManager: AuthorizationAnalytics,
}

if config.fullStory.enabled,
let fullStoryService = Container.shared.resolve(FullStoryAnalyticsService.self) {
let fullStoryService = Container.shared.resolve(
FullStoryAnalyticsService.self,
argument: config.firebase.enabled
) {
analyticsServices.append(fullStoryService)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@
import Foundation
import Core
import FullStory
import FirebaseCrashlytics

class FullStoryAnalyticsService: AnalyticsService {
class FullStoryAnalyticsService: NSObject, AnalyticsService, FSDelegate {

var firebaseEnabled: Bool
init(_ firebaseEnabled: Bool) {
self.firebaseEnabled = firebaseEnabled
super.init()
FS.delegate = self
}

func identify(id: String, username: String?, email: String?) {
FS.identify(id, userVars: ["displayName": id])
Expand All @@ -22,4 +30,13 @@ class FullStoryAnalyticsService: AnalyticsService {
func logScreenEvent(_ event: Core.AnalyticsEvent, parameters: [String: Any]?) {
FS.page(withName: event.rawValue, properties: parameters).start()
}

func fullstoryDidStartSession(_ sessionUrl: String) {
if firebaseEnabled {
Crashlytics.crashlytics().setCustomValue(
sessionUrl,
forKey: "fullstory_session_url"
)
}
}
}
Loading