From 38641f239d04ad031db32c5218b6ff8747b3d4ee Mon Sep 17 00:00:00 2001 From: 014967 Date: Sun, 1 Sep 2024 16:46:24 +0900 Subject: [PATCH] apply lint --- app/src/main/java/com/mashup/ui/main/MainActivity.kt | 1 - .../java/com/mashup/ui/main/popup/MainBottomPopup.kt | 2 +- .../java/com/mashup/ui/webview/WebViewViewModel.kt | 10 ++++------ .../mashup/ui/webview/birthday/BirthdayActivity.kt | 11 +++-------- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/mashup/ui/main/MainActivity.kt b/app/src/main/java/com/mashup/ui/main/MainActivity.kt index 6f2e6eb1..ddd85ba5 100644 --- a/app/src/main/java/com/mashup/ui/main/MainActivity.kt +++ b/app/src/main/java/com/mashup/ui/main/MainActivity.kt @@ -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 diff --git a/app/src/main/java/com/mashup/ui/main/popup/MainBottomPopup.kt b/app/src/main/java/com/mashup/ui/main/popup/MainBottomPopup.kt index 4470fec0..a75fff62 100644 --- a/app/src/main/java/com/mashup/ui/main/popup/MainBottomPopup.kt +++ b/app/src/main/java/com/mashup/ui/main/popup/MainBottomPopup.kt @@ -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 { diff --git a/app/src/main/java/com/mashup/ui/webview/WebViewViewModel.kt b/app/src/main/java/com/mashup/ui/webview/WebViewViewModel.kt index 605e708a..6ef265cc 100644 --- a/app/src/main/java/com/mashup/ui/webview/WebViewViewModel.kt +++ b/app/src/main/java/com/mashup/ui/webview/WebViewViewModel.kt @@ -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) @@ -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 @@ -88,7 +87,6 @@ class WebViewViewModel @Inject constructor( popUpRepository.patchPopupDisabled(popupKey.name) } - fun onClickPopup(popupKey: String) = mashUpScope { val popupType = MainPopupType.getMainPopupType(popupKey) diff --git a/app/src/main/java/com/mashup/ui/webview/birthday/BirthdayActivity.kt b/app/src/main/java/com/mashup/ui/webview/birthday/BirthdayActivity.kt index 09d612cb..64484482 100644 --- a/app/src/main/java/com/mashup/ui/webview/birthday/BirthdayActivity.kt +++ b/app/src/main/java/com/mashup/ui/webview/birthday/BirthdayActivity.kt @@ -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 @@ -45,13 +40,13 @@ class BirthdayActivity : BaseActivity() { 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 -> { @@ -63,7 +58,7 @@ class BirthdayActivity : BaseActivity() { ) ) } - else->{} + else -> {} } } }