Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate bundle IDs and drawing of version and branch on icon, taken from KZBootstrap
- Loading branch information
1 parent
07f504f
commit a54cb39
Showing
18 changed files
with
212 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.08 KB
...Gallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-120-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.08 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-120.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.71 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-152.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.4 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-29-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.03 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-40.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.4 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-58-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.4 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-58.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.36 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-76.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.63 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-80-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.63 KB
PoseGallery/PoseGallery/resources/Images.xcassets/AppIcon.appiconset/icon-80.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# script_tag_icon.sh | ||
# from iconVersioning.h, https://github.com/krzysztofzablocki/KZBootstrap | ||
# | ||
|
||
export PATH=/opt/local/bin/:/opt/local/sbin:$PATH:/usr/local/bin: | ||
|
||
convertPath=`which convert` | ||
echo ${convertPath} | ||
if [[ ! -f ${convertPath} || -z ${convertPath} ]]; then | ||
echo "WARNING: Skipping Icon versioning, you need to install ImageMagick and ghostscript (fonts) first, you can use brew to simplify process: | ||
brew install imagemagick | ||
brew install ghostscript" | ||
exit 0; | ||
fi | ||
|
||
git=`sh /etc/profile; which git` | ||
build_num=`"$git" rev-list --all |wc -l` | ||
branch=`"$git" rev-parse --abbrev-ref HEAD` | ||
commit=`"$git" rev-parse --short HEAD` | ||
#version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}"` | ||
version=${PRODUCT_VERSION_STRING} | ||
|
||
#DIR="${BASH_SOURCE%/*}" | ||
#if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi | ||
#. "$DIR/buildNumber.sh" | ||
|
||
branch="${branch}->${BUNDLE_DISPLAY_NAME_SUFFIX}" | ||
|
||
#SRCROOT=.. | ||
#CONFIGURATION_BUILD_DIR=. | ||
#UNLOCALIZED_RESOURCES_FOLDER_PATH=. | ||
|
||
#commit="3783bab" | ||
#branch="master" | ||
#version="3.4" | ||
#build_num="9999" | ||
|
||
shopt -s extglob | ||
build_num="${build_num##*( )}" | ||
shopt -u extglob | ||
caption="${version} ($build_num)\n${branch}\n${commit}" | ||
echo $caption | ||
|
||
function abspath() { pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null; } | ||
|
||
function processIcon() { | ||
base_file=$1 | ||
|
||
cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" | ||
base_path=`find . -name ${base_file}` | ||
|
||
real_path=$( abspath "${base_path}" ) | ||
echo "base path ${real_path}" | ||
|
||
if [[ ! -f ${base_path} || -z ${base_path} ]]; then | ||
return; | ||
fi | ||
|
||
# TODO: if they are the same we need to fix it by introducing temp | ||
target_file=`basename $base_path` | ||
target_path="${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${target_file}" | ||
|
||
base_tmp_normalizedFileName="${base_file%.*}-normalized.${base_file##*.}" | ||
base_tmp_path=`dirname $base_path` | ||
base_tmp_normalizedFilePath="${base_tmp_path}/${base_tmp_normalizedFileName}" | ||
|
||
stored_original_file="${base_tmp_normalizedFilePath}-tmp" | ||
if [[ -f ${stored_original_file} ]]; then | ||
echo "found previous file at path ${stored_original_file}, using it as base" | ||
mv "${stored_original_file}" "${base_path}" | ||
fi | ||
|
||
if [ $CONFIGURATION = "Release" ]; then | ||
cp "${base_path}" "$target_path" | ||
return 0; | ||
fi | ||
|
||
echo "Reverting optimized PNG to normal" | ||
# Normalize | ||
echo "xcrun -sdk iphoneos pngcrush -revert-iphone-optimizations -q ${base_path} ${base_tmp_normalizedFilePath}" | ||
xcrun -sdk iphoneos pngcrush -revert-iphone-optimizations -q "${base_path}" "${base_tmp_normalizedFilePath}" | ||
|
||
# move original pngcrush png to tmp file | ||
echo "moving pngcrushed png file at ${base_path} to ${stored_original_file}" | ||
#rm "$base_path" | ||
mv "$base_path" "${stored_original_file}" | ||
|
||
# Rename normalized png's filename to original one | ||
echo "Moving normalized png file to original one ${base_tmp_normalizedFilePath} to ${base_path}" | ||
mv "${base_tmp_normalizedFilePath}" "${base_path}" | ||
|
||
width=`identify -format %w ${base_path}` | ||
height=`identify -format %h ${base_path}` | ||
band_height=$((($height * 47) / 100)) | ||
band_position=$(($height - $band_height)) | ||
text_position=$(($band_position - 3)) | ||
point_size=$(((13 * $width) / 100)) | ||
|
||
echo "Image dimensions ($width x $height) - band height $band_height @ $band_position - point size $point_size" | ||
|
||
# | ||
# blur band and text | ||
# | ||
convert ${base_path} -blur 10x8 /tmp/blurred.png | ||
convert /tmp/blurred.png -gamma 0 -fill white -draw "rectangle 0,$band_position,$width,$height" /tmp/mask.png | ||
convert -size ${width}x${band_height} xc:none -fill 'rgba(0,0,0,0.2)' -draw "rectangle 0,0,$width,$band_height" /tmp/labels-base.png | ||
convert -background none -size ${width}x${band_height} -pointsize $point_size -fill white -gravity center -gravity South caption:"$caption" /tmp/labels.png | ||
|
||
convert ${base_path} /tmp/blurred.png /tmp/mask.png -composite /tmp/temp.png | ||
|
||
rm /tmp/blurred.png | ||
rm /tmp/mask.png | ||
|
||
# | ||
# compose final image | ||
# | ||
filename=New${base_file} | ||
convert /tmp/temp.png /tmp/labels-base.png -geometry +0+$band_position -composite /tmp/labels.png -geometry +0+$text_position -geometry +${w}-${h} -composite "${target_path}" | ||
|
||
# clean up | ||
rm /tmp/temp.png | ||
rm /tmp/labels-base.png | ||
rm /tmp/labels.png | ||
|
||
echo "Overlayed ${target_path}" | ||
} | ||
|
||
icon_count=`/usr/libexec/PlistBuddy -c "Print CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconFiles" "${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}" | wc -l` | ||
last_icon_index=$((${icon_count} - 2)) | ||
|
||
i=0 | ||
while [ $i -lt $last_icon_index ]; do | ||
icon=`/usr/libexec/PlistBuddy -c "Print CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconFiles:$i" "${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}"` | ||
|
||
if [[ $icon == *.png ]] || [[ $icon == *.PNG ]] | ||
then | ||
processIcon $icon | ||
else | ||
processIcon "${icon}.png" | ||
processIcon "${icon}@2x.png" | ||
fi | ||
let i=i+1 | ||
done | ||
|
||
# Workaround to fix issue#16 to use wildcard * to actually find the file | ||
# Only 72x72 and 76x76 that we need for ipad app icons | ||
processIcon "AppIcon72x72~ipad*" | ||
processIcon "AppIcon72x72@2x~ipad*" | ||
processIcon "AppIcon76x76~ipad*" | ||
processIcon "AppIcon76x76@2x~ipad*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters