Skip to content

Commit

Permalink
apply lint
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-xyz committed Sep 1, 2024
1 parent 7fa9beb commit 38641f2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/mashup/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.mashup.ui.main.model.MainTab
import com.mashup.ui.main.popup.MainBottomPopup
import com.mashup.ui.qrscan.CongratsAttendanceScreen
import com.mashup.ui.qrscan.QRScanActivity
import com.mashup.ui.webview.birthday.BirthdayActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import dagger.hilt.android.AndroidEntryPoint
class MainBottomPopup : BottomSheetDialogFragment() {

private val mainViewModel: MainViewModel by activityViewModels()
private val webViewViewModel : WebViewViewModel by activityViewModels()
private val webViewViewModel: WebViewViewModel by activityViewModels()

companion object {
fun newInstance(popupType: MainPopupType) = MainBottomPopup().apply {
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/java/com/mashup/ui/webview/WebViewViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import javax.inject.Inject
class WebViewViewModel @Inject constructor(
private val savedStateHandle: SavedStateHandle,
userPreferenceRepository: UserPreferenceRepository,
private val popUpRepository: PopUpRepository,
private val popUpRepository: PopUpRepository
) : BaseViewModel() {

private val showDividerFlow = MutableStateFlow(false)
Expand Down Expand Up @@ -70,12 +70,11 @@ class WebViewViewModel @Inject constructor(
val result = popUpRepository.getPopupKeyList()
val url = savedStateHandle.getStateFlow(EXTRA_URL_KEY, "").value

if(url == "birthday/event") {
return@mashUpScope
if (url == "birthday/event") {
return@mashUpScope
}


if(result.isSuccess()){
if (result.isSuccess()) {
val popupType =
MainPopupType.getMainPopupType(result.data?.firstOrNull() ?: MainPopupType.BIRTHDAY_CELEBRATION.name)
if (popupType != MainPopupType.BIRTHDAY_CELEBRATION) return@mashUpScope
Expand All @@ -88,7 +87,6 @@ class WebViewViewModel @Inject constructor(
popUpRepository.patchPopupDisabled(popupKey.name)
}


fun onClickPopup(popupKey: String) = mashUpScope {
val popupType =
MainPopupType.getMainPopupType(popupKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.KeyEvent
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
import androidx.navigation.fragment.NavHostFragment
import com.mashup.R
import com.mashup.base.BaseActivity
import com.mashup.constant.EXTRA_TITLE_KEY
Expand Down Expand Up @@ -45,13 +40,13 @@ class BirthdayActivity : BaseActivity<ActivityBirthdayBinding>() {
override fun initObserves() {
super.initObserves()
flowLifecycleScope {
launch{
launch {
webViewViewModel.showPopupType.collectLatest {
MainBottomPopup.newInstance(it).safeShow(supportFragmentManager)
}
}

launch{
launch {
webViewViewModel.onClickPopupConfirm.collectLatest { popupType ->
when (popupType) {
MainPopupType.BIRTHDAY_CELEBRATION -> {
Expand All @@ -63,7 +58,7 @@ class BirthdayActivity : BaseActivity<ActivityBirthdayBinding>() {
)
)
}
else->{}
else -> {}
}
}
}
Expand Down

0 comments on commit 38641f2

Please sign in to comment.