1 package com.expo.modules.devclient.activities
2 
3 import android.content.Intent
4 import com.facebook.react.ReactActivityDelegate
5 import com.facebook.react.ReactNativeHost
6 import expo.modules.devlauncher.DevLauncherController.Companion.tryToHandleIntent
7 import expo.modules.devlauncher.DevLauncherController.Companion.wrapReactActivityDelegate
8 import expo.modules.devlauncher.launcher.DevLauncherReactActivityDelegateSupplier
9 import expo.modules.devmenu.react.DevMenuAwareReactActivity
10 
11 internal var reactNativeHostHolder: ReactNativeHost? = null
12 
13 internal class DevClientBundledAppActivity : DevMenuAwareReactActivity() {
getMainComponentNamenull14   override fun getMainComponentName(): String {
15     return "main"
16   }
17 
createReactActivityDelegatenull18   override fun createReactActivityDelegate(): ReactActivityDelegate {
19     val activity = this
20     return wrapReactActivityDelegate(
21       this,
22       object : DevLauncherReactActivityDelegateSupplier {
23         override fun get(): ReactActivityDelegate {
24           return object : ReactActivityDelegate(activity, mainComponentName) {
25             override fun getReactNativeHost(): ReactNativeHost {
26               return reactNativeHostHolder!!
27             }
28           }
29         }
30       }
31     )
32   }
33 
onNewIntentnull34   override fun onNewIntent(intent: Intent?) {
35     if (tryToHandleIntent(this, intent!!)) {
36       return
37     }
38 
39     super.onNewIntent(intent)
40   }
41 }
42