Skip to content

Commit

Permalink
Issues boostcampwm-2022#287 feat: parentViewModels 가 작동하지 않아 SettingF…
Browse files Browse the repository at this point in the history
…ragment 에서 직접 사용
  • Loading branch information
audxo112 committed Mar 1, 2023
1 parent 80d375f commit 08d7b67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import androidx.activity.addCallback
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.NavHostFragment
import com.lighthouse.auth.google.repository.GoogleClient
import com.lighthouse.features.common.binding.viewBindings
import com.lighthouse.features.common.ext.parentViewModels
import com.lighthouse.features.common.ext.repeatOnStarted
import com.lighthouse.features.setting.R
import com.lighthouse.features.setting.adapter.SettingAdapter
Expand All @@ -31,7 +31,15 @@ class SettingFragment : Fragment(R.layout.fragment_setting) {

private val appNavigationViewModel: AppNavigationViewModel by activityViewModels()

private val mainNavigationViewModel: MainNavigationViewModel by parentViewModels()
private val mainNavigationViewModel: MainNavigationViewModel by viewModels(
ownerProducer = {
var parent = requireParentFragment()
while (parent is NavHostFragment) {
parent = parent.requireParentFragment()
}
parent
}
)

private val settingAdapter = SettingAdapter(
onClick = { menu ->
Expand Down

0 comments on commit 08d7b67

Please sign in to comment.