iKenndac / Tofu

An easy-to-use two-factor authentication app for iOS
https://tofuauth.com
ISC License
502 stars 64 forks source link

Add icon for Uber #68

Closed ghost closed 3 years ago

ghost commented 3 years ago

Added an icon for Uber.

The original png added to IssuerIcons/ has 3500x3500, as opposed to 1024x1024 as asked in the description. So, if you want to change that, just comment and I will make another commit.

Furthermore, why not let Linux users use imagemagick conversion instead of sips? I don't have a Mac and used the following code to do the conversion, which outputs the exact same result, or a better image:

convert "$file" -resize 192 "${imageset}${name}@3x.png" >/dev/null
convert "$file" -resize 128 "${imageset}${name}@2x.png" >/dev/null
convert "$file" -resize 64 "${imageset}${name}.png" >/dev/null

Edit: updated the code markdown because I forgot to use it Edit 2: made some changes to improve the readability

ghost commented 3 years ago

My version of GenerateIssuerIconAssets.sh for reference:

#!/usr/bin/env bash
set -euo pipefail

get_name() {
  echo $1 | sed -E 's:.+/(.+)\.png:\1:'
}

write_json() {
  # JSON copied from Xcode output
  cat << EOF > "$2"
{
  "images" : [
    {
      "idiom" : "universal",
      "filename" : "${1}.png",
      "scale" : "1x"
    },
    {
      "idiom" : "universal",
      "filename" : "${1}@2x.png",
      "scale" : "2x"
    },
    {
      "idiom" : "universal",
      "filename" : "${1}@3x.png",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}
EOF
}

cd "$(dirname "$0")"
for file in ./IssuerIcons/*.png; do
  name="$(get_name $file)"
  echo "Generating icon for ${name}"
  imageset="./Tofu/Assets.xcassets/${name}.imageset/"
  mkdir -p "$imageset"
  convert "$file" -resize 192 "${imageset}${name}@3x.png" >/dev/null
  convert "$file" -resize 128 "${imageset}${name}@2x.png" >/dev/null
  convert "$file" -resize 64 "${imageset}${name}.png" >/dev/null
  write_json "$name" "${imageset}Contents.json"
done
calleluks commented 3 years ago

Hey @robozatiTemp, thanks so much for the icon and sorry for not getting back to you earlier.

The reason we use sips is that it is installed by default on macOS, which is required to build the app. Always using sips means we can re-generate all icons without creating binary diffs for unchanged icons.

I really appreciate your contribution and the icon looks great but I will close this PR in favor of #71 since that also includes an Uber icon and is up to date with the current master.