diff --git a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.kt b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.kt index 000acd7a54..6f882b6d55 100644 --- a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.kt +++ b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.kt @@ -1,10 +1,14 @@ package {{APPLICATION_ID}} +import android.os.Bundle +import android.content.Intent import com.facebook.react.ReactActivity import com.facebook.react.ReactActivityDelegate import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled import com.facebook.react.defaults.DefaultReactActivityDelegate +{{PLUGIN_ACTIVITY_IMPORTS}} + class MainActivity : ReactActivity() { /** @@ -13,6 +17,23 @@ class MainActivity : ReactActivity() { */ override fun getMainComponentName(): String = "RNVApp" + override fun onCreate(savedInstanceState: Bundle?) { + {{INJECT_ON_CREATE}} + {{PLUGIN_ON_CREATE}} + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + {{PLUGIN_ON_ACTIVITY_RESULT}} + } + + override fun onNewIntent(intent:Intent) { + setIntent(intent) + super.onNewIntent(intent) + } + + {{PLUGIN_ACTIVITY_METHODS}} + /** * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] diff --git a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainApplication.kt b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainApplication.kt index d08d727d56..1e7a9ce11f 100644 --- a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainApplication.kt +++ b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainApplication.kt @@ -11,17 +11,18 @@ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost import com.facebook.soloader.SoLoader +{{PLUGIN_IMPORTS}} + class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { override fun getPackages(): List = PackageList(this).packages.apply { - // Packages that cannot be autolinked yet can be added manually here, for example: - // add(MyReactNativePackage()) + {{PLUGIN_PACKAGES}} } - override fun getJSMainModuleName(): String = "index" + override fun getJSMainModuleName(): String = "{{ENTRY_FILE}}" override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG @@ -29,6 +30,8 @@ class MainApplication : Application(), ReactApplication { override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED } + {{PLUGIN_METHODS}} + override val reactHost: ReactHost get() = getDefaultReactHost(this.applicationContext, reactNativeHost) @@ -39,5 +42,6 @@ class MainApplication : Application(), ReactApplication { // If you opted-in for the New Architecture, we load the native entry point for this app. load() } + {{PLUGIN_ON_CREATE}} } } diff --git a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.kt b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.kt index 000acd7a54..6f882b6d55 100644 --- a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.kt +++ b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.kt @@ -1,10 +1,14 @@ package {{APPLICATION_ID}} +import android.os.Bundle +import android.content.Intent import com.facebook.react.ReactActivity import com.facebook.react.ReactActivityDelegate import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled import com.facebook.react.defaults.DefaultReactActivityDelegate +{{PLUGIN_ACTIVITY_IMPORTS}} + class MainActivity : ReactActivity() { /** @@ -13,6 +17,23 @@ class MainActivity : ReactActivity() { */ override fun getMainComponentName(): String = "RNVApp" + override fun onCreate(savedInstanceState: Bundle?) { + {{INJECT_ON_CREATE}} + {{PLUGIN_ON_CREATE}} + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + {{PLUGIN_ON_ACTIVITY_RESULT}} + } + + override fun onNewIntent(intent:Intent) { + setIntent(intent) + super.onNewIntent(intent) + } + + {{PLUGIN_ACTIVITY_METHODS}} + /** * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] diff --git a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainApplication.kt b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainApplication.kt index d08d727d56..1e7a9ce11f 100644 --- a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainApplication.kt +++ b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainApplication.kt @@ -11,17 +11,18 @@ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost import com.facebook.soloader.SoLoader +{{PLUGIN_IMPORTS}} + class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { override fun getPackages(): List = PackageList(this).packages.apply { - // Packages that cannot be autolinked yet can be added manually here, for example: - // add(MyReactNativePackage()) + {{PLUGIN_PACKAGES}} } - override fun getJSMainModuleName(): String = "index" + override fun getJSMainModuleName(): String = "{{ENTRY_FILE}}" override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG @@ -29,6 +30,8 @@ class MainApplication : Application(), ReactApplication { override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED } + {{PLUGIN_METHODS}} + override val reactHost: ReactHost get() = getDefaultReactHost(this.applicationContext, reactNativeHost) @@ -39,5 +42,6 @@ class MainApplication : Application(), ReactApplication { // If you opted-in for the New Architecture, we load the native entry point for this app. load() } + {{PLUGIN_ON_CREATE}} } }