Skip to content

Commit

Permalink
refactor : base fragment conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
youlalala committed Nov 16, 2023
1 parent fa27329 commit 11f7c3a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch


abstract class BaseFragment<VB : ViewDataBinding>(
@LayoutRes private val layoutId: Int
Expand All @@ -37,10 +30,4 @@ abstract class BaseFragment<VB : ViewDataBinding>(
super.onDestroyView()
_binding = null
}

fun LifecycleOwner.repeatOnStarted(block: suspend CoroutineScope.() -> Unit) {
viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED, block)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,4 @@ class LoginFragment : BaseFragment<FragmentLoginBinding>(R.layout.fragment_login
googleLoginLauncher.launch(googleSignInClient.signInIntent)
}
}

private fun observeEvent() {
repeatOnStarted {
viewModel.events.collect { event ->
when (event) {
is LoginEvent.NavigateToHome -> {

}

is LoginEvent.NavigateToNickName -> {
val action = LoginFragmentDirections.actionLoginFragmentToNicknameFragment()
}
}
}
}
}
}

0 comments on commit 11f7c3a

Please sign in to comment.