Skip to content

Commit

Permalink
Updated Fastlane build pipeline to replace the ownCloud app name in X…
Browse files Browse the repository at this point in the history
…CStrings CFBundleDisplayName, instead of the no longer existing InfoPlist.strings file.
  • Loading branch information
hosy committed Sep 23, 2024
1 parent a6ef9f7 commit 4b7e377
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,30 @@ end
set_info_plist_value(path: "ownCloud Action Extension/Info.plist", key: "CFBundleDisplayName", value: "Save to " + appName)
set_info_plist_value(path: "ownCloud Action Extension/Info.plist", key: "CFBundleName", value: appName)

sh("sed -i '' '/\"CFBundleDisplayName\" =/s/ownCloud/#{appName}/' '../ownCloud Action Extension/en.lproj/InfoPlist.strings'")
sh("sed -i '' '/\"CFBundleDisplayName\" =/s/ownCloud/#{appName}/' '../ownCloud Action Extension/de.lproj/InfoPlist.strings'")
# Read InfoPlist.xcstrings JSON content from the file
json_file_path = "../ownCloud Action Extension/InfoPlist.xcstrings"
json_content = File.read(json_file_path)
json_data = JSON.parse(json_content)

# Update the CFBundleDisplayName value for all localizations
if json_data["strings"] && json_data["strings"]["CFBundleDisplayName"]
UI.message("CFBundleDisplayName key found, updating values...")

json_data["strings"]["CFBundleDisplayName"]["localizations"].each do |locale, localization_data|
old_value = localization_data["stringUnit"]["value"]

# Replace "ownCloud" with appName
new_value = old_value.gsub("ownCloud", appName)
localization_data["stringUnit"]["value"] = new_value
end
else
UI.error("CFBundleDisplayName key not found in the JSON data!")
end

# Write the updated JSON back to the file
File.open(json_file_path, "w") do |f|
f.write(JSON.pretty_generate(json_data))
end

update_app_identifier(
xcodeproj: "ownCloud.xcodeproj",
Expand Down

0 comments on commit 4b7e377

Please sign in to comment.