Skip to content

Commit

Permalink
feat: 선택 업데이트 요청 버전만 선택 업데이트 창을 띄운다
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongHoonC committed May 17, 2024
1 parent c9edcd4 commit c8106fb
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,27 @@ class SplashActivity : ComponentActivity() {
}

private fun requestUpdate(latestVersion: Long) {
val isForceUpdateVersion = firebaseRemoteConfig.getBoolean(KEY_FORCE_UPDATE_REQUIRED)
val latestVersionDescription =
firebaseRemoteConfig.getString(KEY_LATEST_VERSION_DESCRIPTION)

if (checkForceUpdate(latestVersionDescription)) return
checkOptionalUpdate(latestVersion, latestVersionDescription)
}

private fun checkForceUpdate(latestVersionDescription: String): Boolean {
val isForceUpdateVersion = firebaseRemoteConfig.getBoolean(KEY_FORCE_UPDATE_REQUIRED)
if (isForceUpdateVersion) {
requestForceUpdate(message = latestVersionDescription)
return
return true
}
return false
}

private fun checkOptionalUpdate(latestVersion: Long, latestVersionDescription: String) {
val isOptionalUpdateVersion = firebaseRemoteConfig.getBoolean(KEY_OPTIONAL_UPDATE_REQUIRED)
if (isOptionalUpdateVersion) {
requestOptionalUpdate(latestVersion = latestVersion, message = latestVersionDescription)
}
requestOptionalUpdate(latestVersion = latestVersion, message = latestVersionDescription)
}

private fun requestForceUpdate(message: String) {
Expand Down Expand Up @@ -188,6 +201,7 @@ class SplashActivity : ComponentActivity() {
private const val DEBUG_REMOTE_CONFIG_FETCH_INTERVAL = 0L
private const val RELEASE_REMOTE_CONFIG_FETCH_INTERVAL = 3600L
private const val KEY_FORCE_UPDATE_REQUIRED = "FORCE_UPDATE_REQUIRED"
private const val KEY_OPTIONAL_UPDATE_REQUIRED = "OPTIONAL_UPDATE_REQUIRED"
private const val KEY_LATEST_VERSION = "LATEST_VERSION"
private const val KEY_LATEST_VERSION_DESCRIPTION = "LATEST_VERSION_DESCRIPTION"
}
Expand Down

0 comments on commit c8106fb

Please sign in to comment.