From a2358f4784e7895140ceba4b2a5663dde57842f1 Mon Sep 17 00:00:00 2001 From: ElenaDiachenko Date: Tue, 16 Jan 2024 13:41:19 +0200 Subject: [PATCH] add plugin injections --- .../java/rnv_template/MainActivity.java.tpl | 8 +++++ .../java/rnv_template/MainActivity.java.tpl | 8 +++++ .../platforms/tvos/RNVApp/AppDelegate.h | 4 ++- .../platforms/tvos/RNVApp/AppDelegate.mm | 19 ++-------- .../tvos/RNVApp/LaunchScreen.storyboard | 36 ++++++++----------- .../java/rnv_template/MainActivity.java.tpl | 8 +++++ .../platforms/ios/RNVApp/AppDelegate.mm | 18 ---------- 7 files changed, 44 insertions(+), 57 deletions(-) diff --git a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl index 2fdae08c2f..7f494686e5 100644 --- a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl +++ b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl @@ -5,8 +5,16 @@ import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactActivityDelegate; +{{PLUGIN_ACTIVITY_IMPORTS}} + public class MainActivity extends ReactActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + {{PLUGIN_ON_CREATE}}; + {{INJECT_ON_CREATE}}; + } + /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. diff --git a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.java.tpl b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.java.tpl index 2fdae08c2f..7f494686e5 100644 --- a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.java.tpl +++ b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv_template/MainActivity.java.tpl @@ -5,8 +5,16 @@ import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactActivityDelegate; +{{PLUGIN_ACTIVITY_IMPORTS}} + public class MainActivity extends ReactActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + {{PLUGIN_ON_CREATE}}; + {{INJECT_ON_CREATE}}; + } + /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. diff --git a/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.h b/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.h index 5d2808256c..17e115ed43 100644 --- a/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.h +++ b/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.h @@ -1,6 +1,8 @@ #import #import -@interface AppDelegate : RCTAppDelegate +{{APPDELEGATE_H_IMPORTS}} + +@interface AppDelegate : RCTAppDelegate {{APPDELEGATE_H_EXTENSIONS}} @end diff --git a/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.mm b/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.mm index 1179262276..a43d1d6f07 100644 --- a/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.mm +++ b/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/AppDelegate.mm @@ -1,26 +1,11 @@ #import "AppDelegate.h" #import +{{APPDELEGATE_MM_IMPORTS}} @implementation AppDelegate -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.moduleName = @"RNVApp"; - // You can add your custom initial props in the dictionary below. - // They will be passed down to the ViewController used by React Native. - self.initialProps = @{}; +{{APPDELEGATE_METHODS}} - return [super application:application didFinishLaunchingWithOptions:launchOptions]; -} - -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -{ -#if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; -#else - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; -#endif -} @end diff --git a/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/LaunchScreen.storyboard b/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/LaunchScreen.storyboard index 4ab00c3d54..86d2e5dcdd 100644 --- a/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/LaunchScreen.storyboard +++ b/packages/engine-rn-tvos/templates/platforms/tvos/RNVApp/LaunchScreen.storyboard @@ -1,9 +1,9 @@ - - + + - + @@ -13,28 +13,19 @@ - + - - + + + - - - - - - + + + + @@ -44,4 +35,7 @@ - + + + + \ No newline at end of file diff --git a/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv_template/MainActivity.java.tpl b/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv_template/MainActivity.java.tpl index 2fdae08c2f..7f494686e5 100644 --- a/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv_template/MainActivity.java.tpl +++ b/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv_template/MainActivity.java.tpl @@ -5,8 +5,16 @@ import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactActivityDelegate; +{{PLUGIN_ACTIVITY_IMPORTS}} + public class MainActivity extends ReactActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + {{PLUGIN_ON_CREATE}}; + {{INJECT_ON_CREATE}}; + } + /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. diff --git a/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm b/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm index 3772d9e122..a43d1d6f07 100644 --- a/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm +++ b/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm @@ -7,23 +7,5 @@ @implementation AppDelegate {{APPDELEGATE_METHODS}} -// - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -// { -// self.moduleName = @"RNVApp"; -// // You can add your custom initial props in the dictionary below. -// // They will be passed down to the ViewController used by React Native. -// self.initialProps = @{}; - -// return [super application:application didFinishLaunchingWithOptions:launchOptions]; -// } - -// - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -// { -// #if DEBUG -// return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; -// #else -// return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; -// #endif -// } @end