Skip to content

Commit

Permalink
DRY string for unavailable UIApplication.State (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Aug 30, 2022
2 parents 449b164 + 10f02d0 commit a691df9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Remote Logging/Crash Logging/ApplicationFacade.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ final class ApplicationFacade {
#if os(iOS)
guard Thread.isMainThread else {
// UIApplication.applicationState can only be accessed from the main thread.
return "unavailable"
return UIApplication.State.unavailable
}

return (UIApplication.sharedIfAvailable()?.applicationState.descriptionForEventTag
?? "unavailable")
?? UIApplication.State.unavailable)

#else

Expand Down Expand Up @@ -59,6 +59,8 @@ private extension UIApplication.State {
return "unknown"
}
}

static var unavailable: String { "unavailable" }
}

#endif

0 comments on commit a691df9

Please sign in to comment.