-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c10d01b
commit 74a5ca2
Showing
7 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Basic-Car-Maintenance/Shared/Utilities/AnalyticsService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// AnalyticsService.swift | ||
// Basic-Car-Maintenance | ||
// | ||
// Created by Mikaela Caron on 11/11/23. | ||
// | ||
|
||
import Foundation | ||
import FirebaseAnalytics | ||
|
||
class AnalyticsService { | ||
private init() { } | ||
|
||
static let shared = AnalyticsService() | ||
|
||
/// Log an `AnalyticEvent` that happened | ||
/// - Parameter event: The event that happened | ||
/// - Parameter parameters: Extra parameters for more information about this event, if needed | ||
func logEvent(_ event: AnalyticEvent, with parameters: [String: String] = [:]) { | ||
Analytics.logEvent(event.rawValue, parameters: parameters) | ||
} | ||
|
||
func setUserID(_ id: String) { | ||
Analytics.setUserID(id) | ||
} | ||
} | ||
|
||
enum AnalyticEvent: String { | ||
|
||
case maintenanceCreate = "maintenance_create" | ||
case maintenanceUpdate = "maintenance_update" | ||
case maintenanceDelete = "maintenance_delete" | ||
|
||
case odometerCreate = "odometer_create" | ||
case odometerUpdate = "odometer_update" | ||
case odometerDelete = "odometer_delete" | ||
|
||
case vehicleCreate = "vehicle_create" | ||
case vehicleUpdate = "vehicle_update" | ||
case vehicleDelete = "vehicle_delete" | ||
} |