Skip to content

Commit 88b5b89

Browse files
committed
Avoid node moves by using in-place replace
1 parent 1fbd208 commit 88b5b89

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,16 @@ def self.merge_string_node(main_strings_xml, library, lib_string_node)
6262
return :found if lib_string_node =~ main_string_node
6363

6464
# The string needs an update
65-
result = :updated
6665
if main_string_node.attr('tools:ignore').nil?
67-
# It can be updated, so remove the current one and move ahead
68-
main_string_node.remove
69-
break
66+
# No `tools:ignore` attribute; completely replace existing main string node with lib's one
67+
add_xml_attributes!(lib_string_node, library)
68+
main_string_node.replace lib_string_node
7069
else
71-
# It has the tools:ignore flag, so update the content without touching the other attributes
72-
main_string_node.content = string_content
70+
# Has the `tools:ignore` flag; update the content without touching the other existing attributes
7371
add_xml_attributes!(main_string_node, library)
74-
return result
72+
main_string_node.content = string_content
7573
end
74+
return :updated
7675
end
7776
end
7877

0 commit comments

Comments
 (0)