Skip to content

Commit

Permalink
Cleanup duplicate setting of view tree owners
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarr21 committed Aug 7, 2023
1 parent 368da10 commit 53c718b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
package com.uber.rib.compose.root

import android.view.ViewGroup
import androidx.lifecycle.setViewTreeLifecycleOwner
import androidx.savedstate.setViewTreeSavedStateRegistryOwner
import com.uber.rib.compose.root.main.MainScope
import com.uber.rib.compose.util.AnalyticsClient
import com.uber.rib.compose.util.AnalyticsClientImpl
Expand All @@ -43,11 +41,8 @@ interface RootScope {

abstract fun presenter(): EmptyPresenter

fun view(parentViewGroup: ViewGroup, activity: RibActivity): RootView {
return RootView(parentViewGroup.context).apply {
setViewTreeLifecycleOwner(activity)
setViewTreeSavedStateRegistryOwner(activity)
}
fun view(parentViewGroup: ViewGroup): RootView {
return RootView(parentViewGroup.context)
}

@Expose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ import android.view.ViewGroup
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.platform.ComposeView
import androidx.lifecycle.setViewTreeLifecycleOwner
import androidx.savedstate.setViewTreeSavedStateRegistryOwner
import com.uber.rib.compose.root.main.loggedin.LoggedInScope
import com.uber.rib.compose.root.main.loggedout.LoggedOutScope
import com.uber.rib.compose.util.AnalyticsClient
import com.uber.rib.compose.util.ExperimentClient
import com.uber.rib.compose.util.LoggerClient
import com.uber.rib.core.ComposePresenter
import com.uber.rib.core.RibActivity
import motif.Expose

@motif.Scope
Expand Down Expand Up @@ -55,15 +52,8 @@ interface MainScope {
}
}

fun view(
parentViewGroup: ViewGroup,
activity: RibActivity,
presenter: ComposePresenter,
): ComposeView {
return ComposeView(parentViewGroup.context).apply {
setViewTreeLifecycleOwner(activity)
setViewTreeSavedStateRegistryOwner(activity)
}
fun view(parentViewGroup: ViewGroup): ComposeView {
return ComposeView(parentViewGroup.context)
}

abstract fun childContent(): MainRouter.ChildContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
package com.uber.rib.workers.root

import android.view.ViewGroup
import androidx.lifecycle.setViewTreeLifecycleOwner
import androidx.savedstate.setViewTreeSavedStateRegistryOwner
import com.uber.rib.core.EmptyPresenter
import com.uber.rib.core.RibActivity
import com.uber.rib.workers.root.main.MainScope

@motif.Scope
Expand All @@ -36,11 +33,8 @@ interface RootScope {

abstract fun presenter(): EmptyPresenter

fun view(parentViewGroup: ViewGroup, activity: RibActivity): RootView {
return RootView(parentViewGroup.context).apply {
setViewTreeLifecycleOwner(activity)
setViewTreeSavedStateRegistryOwner(activity)
}
fun view(parentViewGroup: ViewGroup): RootView {
return RootView(parentViewGroup.context)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import android.view.ViewGroup
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.platform.ComposeView
import androidx.lifecycle.setViewTreeLifecycleOwner
import androidx.savedstate.setViewTreeSavedStateRegistryOwner
import com.uber.rib.core.ComposePresenter
import com.uber.rib.core.RibActivity
import com.uber.rib.workers.root.main.ribworkerselection.RibWorkerSelectionScope

@motif.Scope
Expand All @@ -45,15 +42,8 @@ interface MainScope {
}
}

fun view(
parentViewGroup: ViewGroup,
activity: RibActivity,
presenter: ComposePresenter,
): ComposeView {
return ComposeView(parentViewGroup.context).apply {
setViewTreeLifecycleOwner(activity)
setViewTreeSavedStateRegistryOwner(activity)
}
fun view(parentViewGroup: ViewGroup): ComposeView {
return ComposeView(parentViewGroup.context)
}

abstract fun childContent(): MainRouter.ChildContent
Expand Down

0 comments on commit 53c718b

Please sign in to comment.