diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2022-08-24 09:15:21 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2022-08-24 09:15:21 +0200 |
| commit | 7f8a9b7b54eb240d2b21f65d987388d40730d6bd (patch) | |
| tree | ce82c07779d6a98d89ff5505aaa0d76e2517072a | |
| parent | 7a65cc69bdf1bb44dc1734f1351ec4f1a536818b (diff) | |
| parent | 3ec1248199f9834ec18cd6f3a6cf8281744f5de3 (diff) | |
| download | mullvadvpn-7f8a9b7b54eb240d2b21f65d987388d40730d6bd.tar.xz mullvadvpn-7f8a9b7b54eb240d2b21f65d987388d40730d6bd.zip | |
Merge branch 'add-small-tick'
| -rw-r--r-- | ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/Contents.json | 16 | ||||
| -rw-r--r-- | ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/IconTickSml.pdf | bin | 0 -> 1043 bytes | |||
| -rw-r--r-- | ios/MullvadVPN/SettingsCell.swift | 13 | ||||
| -rwxr-xr-x | ios/convert-assets.rb | 28 |
4 files changed, 44 insertions, 13 deletions
diff --git a/ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/Contents.json b/ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/Contents.json new file mode 100644 index 0000000000..10a4cd7580 --- /dev/null +++ b/ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "filename" : "IconTickSml.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true, + "template-rendering-intent" : "template" + } +} diff --git a/ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/IconTickSml.pdf b/ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/IconTickSml.pdf Binary files differnew file mode 100644 index 0000000000..4359e0ae34 --- /dev/null +++ b/ios/MullvadVPN/Assets.xcassets/IconTickSml.imageset/IconTickSml.pdf diff --git a/ios/MullvadVPN/SettingsCell.swift b/ios/MullvadVPN/SettingsCell.swift index 16f48a1628..99fe94d4d7 100644 --- a/ios/MullvadVPN/SettingsCell.swift +++ b/ios/MullvadVPN/SettingsCell.swift @@ -23,7 +23,7 @@ enum SettingsDisclosureType { case .externalLink: return UIImage(named: "IconExtlink") case .tick: - return .iconTickSmall + return UIImage(named: "IconTickSml") } } } @@ -169,14 +169,3 @@ class SettingsCell: UITableViewCell { contentView.frame = contentView.frame.inset(by: contentInset) } } - -private extension UIImage { - static let iconTickSmall: UIImage? = { - guard let image = UIImage(named: "IconTick") else { return nil } - let size = CGSize(width: 16, height: 16) - return UIGraphicsImageRenderer(size: size).image { context in - let rect = CGRect(origin: .zero, size: size) - image.draw(in: rect) - } - }() -} diff --git a/ios/convert-assets.rb b/ios/convert-assets.rb index d576722b52..7898fca99c 100755 --- a/ios/convert-assets.rb +++ b/ios/convert-assets.rb @@ -36,9 +36,14 @@ GRAPHICAL_ASSETS = [ "icon-close-sml.svg", "icon-copy.svg", "icon-obscure.svg", - "icon-unobscure.svg" + "icon-unobscure.svg", ] +# graphical assets to resize. +RESIZE_ASSETS = { + "icon-tick.svg" => ["icon-tick-sml.svg", 16, 16], +} + # App icon sizes APP_ICON_SIZES = [ # iphone-notification 20pt at 2x, 3x @@ -110,6 +115,26 @@ def generate_graphical_assets() 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(GRAPHICAL_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})" + system(SVG_CONVERT_ENVIRONMENT_VARIABLES, "rsvg-convert", "--width=#{width}", "--height=#{height}", "--format=pdf", svg_file, "--output", output_file) + end +end + def genereate_app_icon() for (icon_name, nominal_size, *retina_scales) in APP_ICON_SIZES do for retina_scale in retina_scales do @@ -173,6 +198,7 @@ OptionParser.new do |opts| opts.on("--import-desktop-assets", "Import assets from the desktop app") do |v| generate_graphical_assets + generate_resized_assets end opts.on("--additional-assets", "Generate additional assets") do |v| |
