@@ -60,7 +60,7 @@ def self.exclude_i386_architecture_while_using_hermes(installer)
6060 . push ( installer . pods_project )
6161
6262
63- # Hermes does not support ` i386` architecture
63+ # Hermes does not support ' i386' architecture
6464 excluded_archs_default = ReactNativePodsUtils . has_pod ( installer , 'hermes-engine' ) ? "i386" : ""
6565
6666 projects . each do |project |
@@ -174,7 +174,7 @@ def self.apply_xcode_15_patch(installer, xcodebuild_manager: Xcodebuild)
174174 if self . is_using_xcode15_or_greter ( :xcodebuild_manager => xcodebuild_manager )
175175 self . add_value_to_setting_if_missing ( config , other_ld_flags_key , xcode15_compatibility_flags )
176176 else
177- self . remove_value_to_setting_if_present ( config , other_ld_flags_key , xcode15_compatibility_flags )
177+ self . remove_value_from_setting_if_present ( config , other_ld_flags_key , xcode15_compatibility_flags )
178178 end
179179 end
180180 project . save ( )
@@ -255,20 +255,26 @@ def self.safe_init(config, setting_name)
255255
256256 def self . add_value_to_setting_if_missing ( config , setting_name , value )
257257 old_config = config . build_settings [ setting_name ]
258- if !old_config . include? ( value )
259- config . build_settings [ setting_name ] << value
258+ if old_config . is_a? ( Array )
259+ old_config = old_config . join ( " " )
260+ end
261+
262+ trimmed_value = value . strip ( )
263+ if !old_config . include? ( trimmed_value )
264+ config . build_settings [ setting_name ] = "#{ old_config . strip ( ) } #{ trimmed_value } " . strip ( )
260265 end
261266 end
262267
263- def self . remove_value_to_setting_if_present ( config , setting_name , value )
268+ def self . remove_value_from_setting_if_present ( config , setting_name , value )
264269 old_config = config . build_settings [ setting_name ]
265- if old_config . include? ( value )
266- # Old config can be either an Array or a String
267- if old_config . is_a? ( Array )
268- old_config = old_config . join ( " " )
269- end
270- new_config = old_config . gsub ( value , "" )
271- config . build_settings [ setting_name ] = new_config
270+ if old_config . is_a? ( Array )
271+ old_config = old_config . join ( " " )
272+ end
273+
274+ trimmed_value = value . strip ( )
275+ if old_config . include? ( trimmed_value )
276+ new_config = old_config . gsub ( trimmed_value , "" )
277+ config . build_settings [ setting_name ] = new_config . strip ( )
272278 end
273279 end
274280
0 commit comments