Skip to content

Commit

Permalink
#121/ 인앱업데이트 다이얼로그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sub101 committed Jan 1, 2024
1 parent a1da51b commit 38c6e68
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
31 changes: 18 additions & 13 deletions app/src/main/java/sopt/uni/presentation/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import sopt.uni.R
import sopt.uni.data.datasource.local.SparkleStorage
import sopt.uni.databinding.ActivitySplashBinding
import sopt.uni.presentation.home.HomeActivity
import sopt.uni.presentation.home.UpdateDialogFragment
import sopt.uni.presentation.invite.NickNameActivity
import sopt.uni.presentation.onboarding.OnBoardingActivity
import sopt.uni.util.binding.BindingActivity
Expand Down Expand Up @@ -46,19 +47,23 @@ class SplashActivity : BindingActivity<ActivitySplashBinding>(R.layout.activity_
}

private fun isUpdateAvailable() {
val appUpdateManager = AppUpdateManagerFactory.create(this)
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && appUpdateInfo.isUpdateTypeAllowed(
AppUpdateType.IMMEDIATE,
)
) {
SparkleStorage.setUpdateAvailableBoolean(IS_UPDATE_AVAILABLE, true)
Log.e("subin", "${SparkleStorage.getUpdateAvailableBoolean(IS_UPDATE_AVAILABLE)}")
} else {
SparkleStorage.setUpdateAvailableBoolean(IS_UPDATE_AVAILABLE, false)
Log.e("subin", "${SparkleStorage.getUpdateAvailableBoolean(IS_UPDATE_AVAILABLE)}")
}
// val appUpdateManager = AppUpdateManagerFactory.create(this)
// val appUpdateInfoTask = appUpdateManager.appUpdateInfo
// appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
// if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && appUpdateInfo.isUpdateTypeAllowed(
// AppUpdateType.IMMEDIATE,
// )
// ) {
// SparkleStorage.setUpdateAvailableBoolean(IS_UPDATE_AVAILABLE, true)
// Log.e("subin", "${SparkleStorage.getUpdateAvailableBoolean(IS_UPDATE_AVAILABLE)}")
// } else {
// SparkleStorage.setUpdateAvailableBoolean(IS_UPDATE_AVAILABLE, false)
// Log.e("subin", "${SparkleStorage.getUpdateAvailableBoolean(IS_UPDATE_AVAILABLE)}")
// }
// }
Log.e("hyeon","${SparkleStorage.getUpdateAvailableBoolean(IS_UPDATE_AVAILABLE)}")
if(SparkleStorage.getUpdateAvailableBoolean(IS_UPDATE_AVAILABLE)){
UpdateDialogFragment().show(supportFragmentManager,"UpdateDialog")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.appupdate.AppUpdateOptions
import com.google.android.play.core.install.model.AppUpdateType
import com.google.android.play.core.install.model.UpdateAvailability
import dagger.hilt.android.AndroidEntryPoint
import sopt.uni.R
import sopt.uni.data.datasource.local.SparkleStorage
import sopt.uni.databinding.TitleAction2DialogBinding
import sopt.uni.presentation.BindingDialogFragment
import sopt.uni.util.extension.setOnSingleClickListener

@AndroidEntryPoint
class UpdateDialogFragment :
BindingDialogFragment<TitleAction2DialogBinding>(R.layout.title_action2_dialog) {

Expand Down

0 comments on commit 38c6e68

Please sign in to comment.