Add analytics for Unauthenticated errors

This commit is contained in:
David Langley
2022-01-13 17:33:51 +00:00
parent 8f014961e8
commit 21d49a5067
12 changed files with 55 additions and 14 deletions
+11 -1
View File
@@ -83,7 +83,7 @@ import AnalyticsEvents
// Catch and log crashes
MXLogger.logCrashes(true)
MXLogger.setBuildVersion(AppDelegate.theDelegate().build)
MXLogger.setBuildVersion(AppInfo.current.buildInfo.readableBuildVersion)
}
/// Use the analytics settings from the supplied session to configure analytics.
@@ -200,6 +200,16 @@ extension Analytics {
}
}
/// Track when a user becomes unauthenticated without pressing the `sign out` button.
/// - Parameters:
/// - reason: The error that occurred.
/// - count: The number of times that error occurred.
func trackAuthUnauthenticatedError(softLogout: Bool, refreshTokenAuth: Bool, errorCode: String, errorReason: String) {
let errorCode = AnalyticsEvent.UnauthenticatedError.ErrorCode(rawValue: errorCode) ?? .M_UNKNOWN
let event = AnalyticsEvent.UnauthenticatedError(errorCode: errorCode, errorReason: errorReason, refreshTokenAuth: refreshTokenAuth, softLogout: softLogout)
client.capture(event)
}
/// Track whether the user accepted or declined the terms to an identity server.
/// **Note** This method isn't currently implemented.
/// - Parameter accepted: Whether the terms were accepted.