Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(icon-patcher): also set CFBundleIconName #11

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/fastlane/plugin/act/helper/icon_patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def self.patch(archive, iconset_path, delete_old_iconset)
icons.map { |i| i[:name] }.uniq.each_with_index do |key, index|
plist_buddy.exec("Add #{icons_plist_key}:#{index} string #{key}")
end

icon_filename = File.basename(iconset_path)
icon_excluding_file_type = icon_filename.split('.')[0]
icon_name_plist_key = ":CFBundleIcons#{idiom_suffix}:CFBundlePrimaryIcon:CFBundleIconName"
plist_buddy.exec("Add #{icon_name_plist_key} string #{icon_excluding_file_type}")
end

archive.replace(plist_path)
Expand Down Expand Up @@ -88,6 +93,7 @@ def self.delete_icons(archive, plist_buddy, delete_old_iconset)
plist_buddy.exec "Delete #{icon_list_key}"
end
end

end
end
end
14 changes: 14 additions & 0 deletions spec/act_action_ipa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@
expect(result).to eql(["Blue29x29", "Blue40x40"])
end


it 'sets the Icon Name to be the same as the iconset' do
Fastlane::Actions::ActAction.run(
archive_path: @ipa_file,
iconset: "example/Blue.appiconset"
)

result = [
invoke_plistbuddy("Print :CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconName", "Payload/Example.app/Info.plist")
]

expect(result).to eql(["Blue"])
end

# TODO: More tests for other idioms (ie. iPad icons). These are supported, but there's no tests yet

it 'ignores :plist_file option' do
Expand Down
15 changes: 15 additions & 0 deletions spec/act_action_xcarchive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,19 @@
expect(result).to eql(["Blue29x29", "Blue40x40"])
end

it 'sets the Icon Name to be the same as the iconset' do
Fastlane::Actions::ActAction.run(
archive_path: @archive_path,
iconset: "example/Blue.appiconset"
)

result = [
invoke_plistbuddy("Print :CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconName", "Products/Applications/Example.app/Info.plist")
]

expect(result).to eql(["Blue"])
end

# TODO: More tests for other idioms (ie. iPad icons). These are supported, but there's no tests yet

it 'ignores :plist_file option' do
Expand All @@ -190,6 +203,8 @@
end
end

context 'providing an iconma'

def invoke_plistbuddy(command, plist)
return `/usr/libexec/PlistBuddy -c "#{command}" #{@archive_path.shellescape}/#{plist.shellescape}`.strip
end
Expand Down