@@ -231,115 +231,3 @@ RCTFatalExceptionHandler RCTGetFatalExceptionHandler(void)
231
231
{
232
232
return RCTCurrentFatalExceptionHandler;
233
233
}
234
-
235
- // MARK: - New Architecture Validation - Enable Reporting
236
-
237
- #if RCT_ONLY_NEW_ARCHITECTURE_EXPERIMENTAL_DO_NOT_USE
238
- static RCTNotAllowedValidation minValidationLevel = RCTNotAllowedInBridgeless;
239
- #else
240
- static RCTNotAllowedValidation minValidationLevel = RCTNotAllowedValidationDisabled;
241
- #endif
242
-
243
- __attribute__ ((used)) RCT_EXTERN void RCTNewArchitectureSetMinValidationLevel (RCTNotAllowedValidation level)
244
- {
245
- #if RCT_ONLY_NEW_ARCHITECTURE_EXPERIMENTAL_DO_NOT_USE
246
- // Cannot disable the reporting in this mode.
247
- #else
248
- minValidationLevel = level;
249
- #endif
250
- }
251
-
252
- // MARK: - New Architecture Validation - Private
253
-
254
- static BOOL shouldEnforceValidation (RCTNotAllowedValidation type)
255
- {
256
- return type >= minValidationLevel;
257
- }
258
-
259
- static NSString *stringDescribingContext (id context)
260
- {
261
- if ([context isKindOfClass: NSString .class]) {
262
- return context;
263
- } else if (context) {
264
- Class klass = [context class ];
265
- if (klass) {
266
- return NSStringFromClass (klass);
267
- }
268
- }
269
- return @" uncategorized" ;
270
- }
271
-
272
- static NSString *validationMessage (RCTNotAllowedValidation type, id context, NSString *extra)
273
- {
274
- NSString *notAllowedType;
275
- switch (type) {
276
- case RCTNotAllowedValidationDisabled:
277
- RCTAssert (0 , @" RCTNotAllowedValidationDisabled not a validation type." );
278
- return nil ;
279
- case RCTNotAllowedInFabricWithoutLegacy:
280
- notAllowedType = @" Fabric" ;
281
- break ;
282
- case RCTNotAllowedInBridgeless:
283
- notAllowedType = @" Bridgeless" ;
284
- break ;
285
- }
286
-
287
- return
288
- [NSString stringWithFormat: @" [ReactNative Architecture][NotAllowedIn%@ ] Unexpectedly reached code path in %@ . %@ " ,
289
- notAllowedType,
290
- stringDescribingContext (context),
291
- extra ?: @" " ];
292
- }
293
-
294
- static void
295
- newArchitectureValidationInternal (RCTLogLevel level, RCTNotAllowedValidation type, id context, NSString *extra)
296
- {
297
- if (!shouldEnforceValidation (type)) {
298
- return ;
299
- }
300
-
301
- NSString *msg = validationMessage (type, context, extra);
302
- if (msg) {
303
- switch (level) {
304
- case RCTLogLevelInfo:
305
- RCTLogInfo (@" %@ " , msg);
306
- break ;
307
- case RCTLogLevelError:
308
- RCTLogError (@" %@ " , msg);
309
- break ;
310
- case RCTLogLevelFatal:
311
- RCTAssert (0 , @" %@ " , msg);
312
- break ;
313
- default :
314
- RCTAssert (0 , @" New architecture validation is only for info, error, and fatal levels." );
315
- }
316
- }
317
- }
318
-
319
- // MARK: - New Architecture Validation - Public
320
-
321
- void RCTEnforceNewArchitectureValidation (RCTNotAllowedValidation type, id context, NSString *extra)
322
- {
323
- newArchitectureValidationInternal (RCTLogLevelFatal, type, context, extra);
324
- }
325
-
326
- void RCTErrorNewArchitectureValidation (RCTNotAllowedValidation type, id context, NSString *extra)
327
- {
328
- #if RCT_ONLY_NEW_ARCHITECTURE_EXPERIMENTAL_DO_NOT_USE
329
- newArchitectureValidationInternal (RCTLogLevelFatal, type, context, extra);
330
- #else
331
- newArchitectureValidationInternal (RCTLogLevelError, type, context, extra);
332
- #endif
333
- }
334
-
335
- void RCTLogNewArchitectureValidation (RCTNotAllowedValidation type, id context, NSString *extra)
336
- {
337
- newArchitectureValidationInternal (RCTLogLevelInfo, type, context, extra);
338
- }
339
-
340
- void RCTNewArchitectureValidationPlaceholder (RCTNotAllowedValidation type, id context, NSString *extra)
341
- {
342
- #if RCT_ONLY_NEW_ARCHITECTURE_EXPERIMENTAL_DO_NOT_USE
343
- newArchitectureValidationInternal (RCTLogLevelInfo, type, context, extra);
344
- #endif
345
- }
0 commit comments