Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
simplified logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AndroidMedaGalaxy committed Oct 7, 2020
1 parent 0267c84 commit a419e5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
11 changes: 10 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ class GoogleAPIVersion @Inject constructor() {
val currentVersion = InternalExposureNotificationClient.getVersion()
currentVersion >= compareVersion
} catch (apiException: ApiException) {
isGoogleAPIConnected(apiException)
if (apiException.statusCode == CommonStatusCodes.API_NOT_CONNECTED) {
throw apiException
}
return false
}
}

private fun isGoogleAPIConnected(apiException: ApiException): Boolean {
if (apiException.statusCode != CommonStatusCodes.API_NOT_CONNECTED) throw apiException
else return false
}

// check if a raw long has the correct length to be considered an API version
private val Long.isCorrectVersionLength
get(): Boolean = abs(this).toString().length == GOOGLE_API_VERSION_FIELD_LENGTH
Expand Down

0 comments on commit a419e5b

Please sign in to comment.