diff options
| author | Jon Petersson <jon.petersson@mullvad.net> | 2025-07-02 14:34:21 +0200 |
|---|---|---|
| committer | Jon Petersson <jon.petersson@mullvad.net> | 2025-07-02 14:34:21 +0200 |
| commit | 560e3ce728718bebefee79ccc059ff6e9c2fbbba (patch) | |
| tree | ecd1806d9d044de4f80691895ee8a1355d4c554e | |
| parent | 7c7f001f9054bfda2052b1b0ef37427c95e470b0 (diff) | |
| parent | ad2187af30f9f100c8115d4c5e5cba4330f9097c (diff) | |
| download | mullvadvpn-560e3ce728718bebefee79ccc059ff6e9c2fbbba.tar.xz mullvadvpn-560e3ce728718bebefee79ccc059ff6e9c2fbbba.zip | |
Merge branch 'fix-brightness-of-icons-and-texts-ios-1136'
| -rw-r--r-- | graphics/README.md | 7 | ||||
| -rw-r--r-- | ios/README.md | 11 | ||||
| -rwxr-xr-x | ios/convert-assets.rb | 208 |
3 files changed, 0 insertions, 226 deletions
diff --git a/graphics/README.md b/graphics/README.md index 683ad2a2a7..786260f28f 100644 --- a/graphics/README.md +++ b/graphics/README.md @@ -45,13 +45,6 @@ following command: rsvg-convert ./icon-square.svg -w 512 -h 512 -o ../android/app/src/main/play/listings/en-US/graphics/icon/icon.png ``` -#### iOS - -`icon-square.svg` is used to generate the app icon for iOS. To regenerate the assets run: -``` -ios/convert-assets.rb --app-icon -``` - ### `icon-android.svg` & `icon-android-mono.svg` The icon `icon-android.svg` is used for Android adaptive icon. The icon converted to diff --git a/ios/README.md b/ios/README.md index bf05b8fd60..e3e3df14fa 100644 --- a/ios/README.md +++ b/ios/README.md @@ -87,17 +87,6 @@ Whenever we want to start adding translations for real, this script can be resurrected from the git history if we deem it to be the best path forward. Look for `ios/requirements.txt`. -## Icons and assets - -For a general overview of icons and graphics read [the graphics readme](../graphics/README.md). - -To copy graphical assets from the desktop GUI and generate iOS assets, run: -```bash -ios/convert-assets.rb --app-icon -ios/convert-assets.rb --import-desktop-assets -ios/convert-assets.rb --additional-assets -``` - ## Cached relays The script `relays-prebuild.sh` runs on each Xcode build and will download and cache a list of relays if it is not already present for a given configuration. diff --git a/ios/convert-assets.rb b/ios/convert-assets.rb deleted file mode 100755 index b2dea9c83f..0000000000 --- a/ios/convert-assets.rb +++ /dev/null @@ -1,208 +0,0 @@ -#!/usr/bin/ruby - -require 'optparse' - -SCRIPT_DIR = File.expand_path(File.dirname(__FILE__)) -ROOT_DIR = File.dirname(SCRIPT_DIR) - -# assets catalogue root -XCASSETS_DIR = File.join(SCRIPT_DIR, "MullvadVPN/Supporting Files/Assets.xcassets") - -# graphical assets sources -APPICON_PATH = File.join(ROOT_DIR, "graphics/icon-square.svg") -ADDITIONAL_ASSETS_DIR = File.join(SCRIPT_DIR, "AdditionalAssets") - -# app icon output -XCASSETS_APPICON_PATH = File.join(XCASSETS_DIR, "AppIcon.appiconset/AppIcon.png") -XCASSETS_APPICON_SIZE = 1024 - -ICON_ASSETS_DIR = File.join( - ROOT_DIR, - "desktop/packages/mullvad-vpn/assets/icons" -) -ICON_ASSETS = [ - 'icon-account-circle.svg', - 'icon-add-circle.svg', - 'icon-alert-circle.svg', - 'icon-checkmark-circle.svg', - 'icon-checkmark.svg', - 'icon-chevron-down-circle.svg', - 'icon-chevron-down.svg', - 'icon-chevron-left-circle.svg', - 'icon-chevron-left.svg', - 'icon-chevron-right-circle.svg', - 'icon-chevron-right.svg', - 'icon-chevron-up-circle.svg', - 'icon-chevron-up.svg', - 'icon-copy.svg', - 'icon-cross-circle.svg', - 'icon-cross.svg', - 'icon-edit-circle.svg', - 'icon-external.svg', - 'icon-filter-circle.svg', - 'icon-grabber.svg', - 'icon-hide.svg', - 'icon-info-circle.svg', - 'icon-more-horizontal-circle.svg', - 'icon-more-horizontal.svg', - 'icon-more-vertical-circle.svg', - 'icon-more-vertical.svg', - 'icon-reconnect.svg', - 'icon-remove-circle.svg', - 'icon-search-circle.svg', - 'icon-search.svg', - 'icon-settings-filled.svg', - 'icon-show.svg', -] - -IMAGE_ASSETS_DIR = File.join( - ROOT_DIR, - "desktop/packages/mullvad-vpn/assets/images" -) -IMAGE_ASSETS = [ - "daita-off-illustration.svg", - "daita-on-illustration.svg", - "location-marker-secure.svg", - "location-marker-unsecure.svg", - "multihop-illustration.svg", - "negative.svg", - "positive.svg", - "spinner.svg", -] - -# graphical assets to resize. -RESIZE_ASSETS = { - "icon-info-circle.svg" => ["icon-info-circle.svg", 18, 18], - "icon-checkmark.svg" => ["icon-checkmark-sml.svg", 16, 16] -} - -# Additional assets generated from SVG -> vector PDF -ADDITIONAL_ASSETS = [ - "DefaultButton.svg", - "SuccessButton.svg", - "DangerButton.svg", - "TranslucentDangerButton.svg", - "TranslucentNeutralButton.svg", - "TranslucentDangerSplitLeftButton.svg", - "TranslucentDangerSplitRightButton.svg", - "IconBackTransitionMask.svg" -] - -# SVG conversion tool environment variables. -SVG_CONVERT_ENVIRONMENT_VARIABLES = { - # Fix PDF "CreationDate" for reproducible output - "SOURCE_DATE_EPOCH" => "1596022781" -} - -# Fix DPI at 72 to produce the same size assets as defined in SVG files (in pixels) -SVG_CONVERT_DEFAULT_OPTIONS = ["--dpi-x=72", "--dpi-y=72"] - -# Functions -def generate_graphical_assets(assets, asset_dir) - for asset_name in assets do - svg_file = File.join(asset_dir, asset_name) - image_name = pascal_case(File.basename(svg_file, ".svg")) - output_dir = File.join(XCASSETS_DIR, "#{image_name}.imageset") - - if !Dir.exists?(output_dir) - puts "Create directory #{output_dir}" - Dir.mkdir(output_dir) - end - - output_file = File.join(output_dir, "#{image_name}.pdf") - - puts "Convert #{svg_file} -> #{output_file}" - rsvg_convert("--format=pdf", svg_file, "--output", output_file) - end -end - -def generate_resized_assets() - RESIZE_ASSETS.each do |asset_name, resize_options| - (new_asset_name, width, height) = resize_options - - svg_file = File.join(ICON_ASSETS_DIR, asset_name) - image_name = pascal_case(File.basename(new_asset_name, ".svg")) - output_dir = File.join(XCASSETS_DIR, "#{image_name}.imageset") - - if !Dir.exists?(output_dir) - puts "Create directory #{output_dir}" - Dir.mkdir(output_dir) - end - - output_file = File.join(output_dir, "#{image_name}.pdf") - - puts "Convert and resize #{svg_file} -> #{output_file} (#{width} x #{height})" - rsvg_convert("--width=#{width}", "--height=#{height}", "--format=pdf", svg_file, "--output", output_file) - end -end - -def generate_app_icon() - image_name = File.basename(XCASSETS_APPICON_PATH, ".png") - puts "Generate #{image_name} -> #{XCASSETS_APPICON_PATH}" - rsvg_convert("--width=#{XCASSETS_APPICON_SIZE}", "--height=#{XCASSETS_APPICON_SIZE}", "--format=png", APPICON_PATH, "--output", XCASSETS_APPICON_PATH) -end - -def generate_additional_assets() - for asset_name in ADDITIONAL_ASSETS do - svg_file = File.join(ADDITIONAL_ASSETS_DIR, asset_name) - image_name = File.basename(svg_file, ".svg") - output_dir = File.join(XCASSETS_DIR, "#{image_name}.imageset") - output_file = File.join(output_dir, "#{image_name}.pdf") - - if !Dir.exists?(output_dir) - puts "Create directory #{output_dir}" - Dir.mkdir(output_dir) - end - - puts "Generate #{image_name} -> #{output_file}" - rsvg_convert("--format=pdf", svg_file, "--output", output_file) - end -end - -def rsvg_convert(*args) - command = ["rsvg-convert", *SVG_CONVERT_DEFAULT_OPTIONS, *args] - system(SVG_CONVERT_ENVIRONMENT_VARIABLES, *command) -end - -def pascal_case(str) - return str.split('-').collect(&:capitalize).join -end - -def command?(name) - `which #{name}` - $?.success? -end - -# Check requirements - -if !command?("rsvg-convert") - puts "rsvg-convert is not installed." - exit -end - -# Parse program arguments - -ARGV << '-h' if ARGV.empty? - -OptionParser.new do |opts| - opts.banner = "Usage: convert-assets.rb [options]" - - opts.on("--app-icon", "Generate application icon assets") do |v| - generate_app_icon - end - - opts.on("--import-desktop-assets", "Import assets from the desktop app") do |v| - generate_graphical_assets(ICON_ASSETS, ICON_ASSETS_DIR) - generate_graphical_assets(IMAGE_ASSETS, IMAGE_ASSETS_DIR) - generate_resized_assets - end - - opts.on("--additional-assets", "Generate additional assets") do |v| - generate_additional_assets - end - - opts.on_tail("-h", "--help", "Show this message") do - puts opts - exit - end -end.parse! |
