10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/fastlane/plugin/appicon/helper/appicon_helper.rb', line 10
def self.get_needed_icons(devices, needed_icons, is_android = false, custom_sizes = {})
icons = []
devices.each do |device|
needed_icons[device].each do |scale, sizes|
sizes.each do |size|
if size.kind_of?(Array)
size, role, subtype = size
end
if is_android
width, height = size.split('x').map { |v| v.to_f }
else
width, height = size.split('x').map { |v| v.to_f * scale.to_i }
end
icons << {
'width' => width,
'height' => height,
'size' => size,
'device' => device.to_s.gsub('_', '-'),
'scale' => scale,
'role' => role,
'subtype' => subtype
}
end
end
end
custom_sizes.each do |path, size|
path = path.to_s
width, height = size.split('x').map { |v| v.to_f }
icons << {
'width' => width,
'height' => height,
'size' => size,
'basepath' => File.dirname(path),
'filename' => File.basename(path)
}
end
icons = icons.sort_by {|value| value['width']} .reverse
end
|