-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move analytics abstractions to shared (#658)
* refactor: move analytics abstractions to shared * remove unnecessary class_name parameter
- Loading branch information
1 parent
e73cff1
commit ac5fdb3
Showing
38 changed files
with
319 additions
and
468 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
// | ||
// AnalyticsExtensions.swift | ||
// iosApp | ||
// | ||
// Created by Horn, Melody on 2025-01-14. | ||
// Copyright © 2025 MBTA. All rights reserved. | ||
// | ||
|
||
import CoreLocation | ||
import shared | ||
import SwiftUI | ||
|
||
extension Analytics { | ||
func recordSession(colorScheme: ColorScheme) { | ||
let analyticsColorScheme: AnalyticsColorScheme = switch colorScheme { | ||
case .light: .light | ||
case .dark: .dark | ||
@unknown default: .unknown | ||
} | ||
recordSession(colorScheme: analyticsColorScheme) | ||
} | ||
|
||
func recordSession(locationAccess: CLAuthorizationStatus, locationAccuracy: CLAccuracyAuthorization) { | ||
let locationAllowed = switch locationAccess { | ||
case .authorizedAlways, .authorizedWhenInUse: true | ||
case .notDetermined, .denied, .restricted: false | ||
@unknown default: false | ||
} | ||
let locationAccess: AnalyticsLocationAccess = switch (locationAllowed, locationAccuracy) { | ||
case (true, .fullAccuracy): .precise | ||
case (true, _): .approximate | ||
case (false, _): .off | ||
} | ||
recordSession(locationAccess: locationAccess) | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.