MCPcopy Create free account
hub / github.com/Snapchat/Valdi / inflateViewAsync

Method inflateViewAsync

valdi/src/java/com/snap/valdi/ValdiRuntime.kt:168–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166 configuration: ValdiContextConfiguration?,
167 completion: (ValdiContext) -> Unit) {
168 val context = doCreateValdiContext(componentPath, viewModel, componentContext, owner, configuration)
169 context.onCreate()
170 runOnMainThreadIfNeeded {
171 completion(context)
172 }
173 }
174
175 override fun inflateViewAsync(rootView: ValdiRootView,
176 componentPath: String,
177 viewModel: Any?,
178 componentContext: Any?,
179 owner: ValdiViewOwner?,
180 completion: InflationCompletion?,
181 configuration: ValdiContextConfiguration?) {
182 val context = doCreateValdiContext(componentPath, viewModel, componentContext, owner, configuration)
183
184 runOnMainThreadIfNeeded {
185 if (rootView.destroyed) {
186 // destroyed was called before the completion was called
187 context.destroy()
188 return@runOnMainThreadIfNeeded
189 }
190
191 rootView.destroyValdiContextOnFinalize = true
192 context.rootView = rootView
193
194 if (completion != null) {
195 context.enqueueNextRenderCallback { completion(null) }
196 }

Callers 3

pushComponentMethod · 0.45
createRootViewMethod · 0.45

Calls 4

runOnMainThreadIfNeededFunction · 0.85
destroyMethod · 0.65
onCreateMethod · 0.65

Tested by

no test coverage detected