File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
packages/react-native/scripts Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -396,6 +396,42 @@ def self.set_imagemanager_search_path(target_installation_result)
396
396
] )
397
397
end
398
398
399
+ def self . get_plist_paths_from ( user_project )
400
+ info_plists = user_project
401
+ . products
402
+ . select { |p |
403
+ p . name &.end_with? ( 'Info.plist' )
404
+ }
405
+ return info_plists
406
+ end
407
+
408
+ def self . update_ats_in_plist ( plistPaths , parent )
409
+ plistPaths . each do |plistPath |
410
+ fullPlistPath = File . join ( parent , plistPath . path )
411
+ plist = Xcodeproj ::Plist . read_from_path ( fullPlistPath )
412
+ ats_configs = {
413
+ "NSAllowsArbitraryLoads" => false ,
414
+ "NSAllowsLocalNetworking" => true ,
415
+ }
416
+ if plist . nil?
417
+ plist = {
418
+ "NSAppTransportSecurity" => ats_configs
419
+ }
420
+ else
421
+ plist [ "NSAppTransportSecurity" ] = ats_configs
422
+ end
423
+ Xcodeproj ::Plist . write_to_path ( plist , fullPlistPath )
424
+ end
425
+ end
426
+
427
+ def self . apply_ats_config ( installer )
428
+ user_project = installer . aggregate_targets
429
+ . map { |t | t . user_project }
430
+ . first
431
+ plistPaths = self . get_plist_paths_from ( user_project )
432
+ self . update_ats_in_plist ( plistPaths , user_project . path . parent )
433
+ end
434
+
399
435
def self . react_native_pods
400
436
return [
401
437
"DoubleConversion" ,
Original file line number Diff line number Diff line change @@ -246,6 +246,7 @@ def react_native_post_install(
246
246
ReactNativePodsUtils . set_node_modules_user_settings ( installer , react_native_path )
247
247
ReactNativePodsUtils . apply_flags_for_fabric ( installer , fabric_enabled : fabric_enabled )
248
248
ReactNativePodsUtils . apply_xcode_15_patch ( installer )
249
+ ReactNativePodsUtils . apply_ats_config ( installer )
249
250
250
251
NewArchitectureHelper . set_clang_cxx_language_standard_if_needed ( installer )
251
252
is_new_arch_enabled = ENV [ 'RCT_NEW_ARCH_ENABLED' ] == "1"
You can’t perform that action at this time.
0 commit comments