|
1 | 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
|
2 | 2 |
|
3 |
| -exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m (SDK 43+) 1`] = ` |
4 |
| -"// This AppDelegate template is used in Expo SDK 43 and newer |
| 3 | +exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m (SDK 43) 1`] = ` |
| 4 | +"// This AppDelegate template is used in Expo SDK 43 |
5 | 5 | // It is (nearly) identical to the pure template used when
|
6 | 6 | // creating a bare React Native app (without Expo)
|
7 | 7 |
|
@@ -94,6 +94,147 @@ static void InitializeFlipper(UIApplication *application) {
|
94 | 94 | "
|
95 | 95 | `;
|
96 | 96 |
|
| 97 | +exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m with Expo ReactDelegate support (SDK 44+) 1`] = ` |
| 98 | +"// This AppDelegate prebuild template is used in Expo SDK 44+ |
| 99 | +// It has the RCTBridge to be created by Expo ReactDelegate |
| 100 | +
|
| 101 | +#import \\"AppDelegate.h\\" |
| 102 | +@import Firebase; |
| 103 | +
|
| 104 | +#import <React/RCTBridge.h> |
| 105 | +#import <React/RCTBundleURLProvider.h> |
| 106 | +#import <React/RCTRootView.h> |
| 107 | +#import <React/RCTLinkingManager.h> |
| 108 | +#import <React/RCTConvert.h> |
| 109 | +
|
| 110 | +#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>) |
| 111 | +#import <FlipperKit/FlipperClient.h> |
| 112 | +#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h> |
| 113 | +#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h> |
| 114 | +#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h> |
| 115 | +#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h> |
| 116 | +#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h> |
| 117 | +
|
| 118 | +static void InitializeFlipper(UIApplication *application) { |
| 119 | + FlipperClient *client = [FlipperClient sharedClient]; |
| 120 | + SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; |
| 121 | + [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; |
| 122 | + [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; |
| 123 | + [client addPlugin:[FlipperKitReactPlugin new]]; |
| 124 | + [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; |
| 125 | + [client start]; |
| 126 | +} |
| 127 | +#endif |
| 128 | +
|
| 129 | +@implementation AppDelegate |
| 130 | +
|
| 131 | +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| 132 | +{ |
| 133 | +#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>) |
| 134 | + InitializeFlipper(application); |
| 135 | +#endif |
| 136 | + |
| 137 | +// @generated begin @react-native-firebase/app-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-ecd111c37e49fdd1ed6354203cd6b1e2a38cccda |
| 138 | +[FIRApp configure]; |
| 139 | +// @generated end @react-native-firebase/app-didFinishLaunchingWithOptions |
| 140 | + RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions]; |
| 141 | + RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@\\"main\\" initialProperties:nil]; |
| 142 | + rootView.backgroundColor = [UIColor whiteColor]; |
| 143 | + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; |
| 144 | + UIViewController *rootViewController = [self.reactDelegate createRootViewController]; |
| 145 | + rootViewController.view = rootView; |
| 146 | + self.window.rootViewController = rootViewController; |
| 147 | + [self.window makeKeyAndVisible]; |
| 148 | +
|
| 149 | + [super application:application didFinishLaunchingWithOptions:launchOptions]; |
| 150 | +
|
| 151 | + return YES; |
| 152 | + } |
| 153 | +
|
| 154 | +- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge |
| 155 | +{ |
| 156 | + // If you'd like to export some custom RCTBridgeModules, add them here! |
| 157 | + return @[]; |
| 158 | +} |
| 159 | +
|
| 160 | +- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { |
| 161 | + #ifdef DEBUG |
| 162 | + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\\"index\\" fallbackResource:nil]; |
| 163 | + #else |
| 164 | + return [[NSBundle mainBundle] URLForResource:@\\"main\\" withExtension:@\\"jsbundle\\"]; |
| 165 | + #endif |
| 166 | +} |
| 167 | +
|
| 168 | +// Linking API |
| 169 | +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { |
| 170 | + return [RCTLinkingManager application:application openURL:url options:options]; |
| 171 | +} |
| 172 | +
|
| 173 | +// Universal Links |
| 174 | +- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { |
| 175 | + return [RCTLinkingManager application:application |
| 176 | + continueUserActivity:userActivity |
| 177 | + restorationHandler:restorationHandler]; |
| 178 | +} |
| 179 | +
|
| 180 | +@end |
| 181 | +" |
| 182 | +`; |
| 183 | +
|
| 184 | +exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m with fallback regex (if the original one fails) 1`] = ` |
| 185 | +"// This AppDelegate template is modified to have RCTBridge |
| 186 | +// created in some non-standard way or not created at all. |
| 187 | +// This should trigger the fallback regex in iOS AppDelegate Expo plugin. |
| 188 | +
|
| 189 | +// some parts omitted to be short |
| 190 | +
|
| 191 | +#import \\"AppDelegate.h\\" |
| 192 | +@import Firebase; |
| 193 | +
|
| 194 | +#import <React/RCTBridge.h> |
| 195 | +#import <React/RCTBundleURLProvider.h> |
| 196 | +#import <React/RCTRootView.h> |
| 197 | +#import <React/RCTLinkingManager.h> |
| 198 | +#import <React/RCTConvert.h> |
| 199 | +
|
| 200 | +@implementation AppDelegate |
| 201 | +
|
| 202 | +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| 203 | +{ |
| 204 | +// @generated begin @react-native-firebase/app-didFinishLaunchingWithOptions-fallback - expo prebuild (DO NOT MODIFY) sync-ecd111c37e49fdd1ed6354203cd6b1e2a38cccda |
| 205 | +[FIRApp configure]; |
| 206 | +// @generated end @react-native-firebase/app-didFinishLaunchingWithOptions-fallback |
| 207 | +
|
| 208 | +// The generated code should appear above ^^^ |
| 209 | +#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>) |
| 210 | + InitializeFlipper(application); |
| 211 | +#endif |
| 212 | + |
| 213 | + // the line below is malfolmed not to be matched by the Expo plugin regex |
| 214 | + // RCTBridge* briddge = [RCTBridge new]; |
| 215 | + RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:briddge moduleName:@\\"main\\" initialProperties:nil]; |
| 216 | + id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@\\"RCTRootViewBackgroundColor\\"]; |
| 217 | + if (rootViewBackgroundColor != nil) { |
| 218 | + rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor]; |
| 219 | + } else { |
| 220 | + rootView.backgroundColor = [UIColor whiteColor]; |
| 221 | + } |
| 222 | +
|
| 223 | + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; |
| 224 | + UIViewController *rootViewController = [UIViewController new]; |
| 225 | + rootViewController.view = rootView; |
| 226 | + self.window.rootViewController = rootViewController; |
| 227 | + [self.window makeKeyAndVisible]; |
| 228 | +
|
| 229 | + [super application:application didFinishLaunchingWithOptions:launchOptions]; |
| 230 | +
|
| 231 | + return YES; |
| 232 | + } |
| 233 | +
|
| 234 | +@end |
| 235 | +" |
| 236 | +`; |
| 237 | +
|
97 | 238 | exports[`Config Plugin iOS Tests tests changes made to old AppDelegate.m (SDK 42) 1`] = `
|
98 | 239 | "// This AppDelegate prebuild template is used in Expo SDK 42 and older
|
99 | 240 | // It expects the old react-native-unimodules architecture (UM* prefix)
|
|
0 commit comments