Last active
February 9, 2021 01:08
-
-
Save FanchenBao/3977b1a0616f14893feda7f24fe06851 to your computer and use it in GitHub Desktop.
Source code 02 used in medium article "Make Fastlane Snapshot Work with React Native"
This file contains hidden or 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
#!/bin/bash | |
# This script is used to resize the screenshot produced by fastlane screenshot | |
# to its appropriate size acceptable by App Store Connect | |
# DEFAULTS | |
IPHONE_11="1284x2778" | |
IPHONE_8_PLUS="1242x2208" | |
IPAD_PRO_3RD="2048x2732" | |
IPAD_PRO_2ND="2048x2732" | |
# See https://unix.stackexchange.com/questions/9496/looping-through-files-with-spaces-in-the-names | |
# about how to deal with empty white spaces in file name when using `find`. | |
# Note that the solution chosen here is not the best one recommended. This is | |
# because I cannot get the best solution to work. | |
OIFS="$IFS" | |
IFS=$'\n' | |
for file in $(find 'screenshots/en-US' -type f -name "$DEVICE-*_framed.png") | |
do | |
case "$DEVICE" in | |
'iPhone 11') | |
magick $file -resize $IPHONE_11 $file | |
;; | |
'iPhone 8 Plus') | |
magick $file -resize $IPHONE_8_PLUS $file | |
;; | |
'iPad Pro (12.9-inch) (2nd generation)') | |
magick $file -resize $IPAD_PRO_2ND $file | |
;; | |
'iPad Pro (12.9-inch) (3rd generation)') | |
magick $file -resize $IPAD_PRO_3RD $file | |
;; | |
*) | |
echo "This line should NOT be printed!" | |
;; | |
esac | |
done | |
IFS="$OIFS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment