Class: AppParser::Apk
- Inherits:
-
Object
show all
- Includes:
- AppIcon
- Defined in:
- lib/app_parser/apk.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from AppIcon
#icon, #largest_icon, #smallest_icon, #sorted_icons
Constructor Details
#initialize(file_name) ⇒ Apk
Returns a new instance of Apk.
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/app_parser/apk.rb', line 9
def initialize(file_name)
@apk = Android::Apk.new(file_name)
@icons = @apk.icon.each_with_object([]) do |(name, data), obj|
tempfile = Tempfile.new(File.basename(name))
tempfile.binmode
tempfile.write(data)
tempfile.close size = ImageSize.path(tempfile.path).size
obj << { dimensions: size, file_name: name }
tempfile.unlink
end
end
|
Instance Attribute Details
#icons ⇒ Object
Returns the value of attribute icons.
7
8
9
|
# File 'lib/app_parser/apk.rb', line 7
def icons
@icons
end
|
Instance Method Details
#bundle_id ⇒ Object
39
40
41
|
# File 'lib/app_parser/apk.rb', line 39
def bundle_id
@apk.manifest.package_name
end
|
#display_name ⇒ Object
35
36
37
|
# File 'lib/app_parser/apk.rb', line 35
def display_name
@apk.resource.find("@string/app_name")
end
|
#icon_data(file_name) ⇒ Object
51
52
53
|
# File 'lib/app_parser/apk.rb', line 51
def icon_data(file_name)
@apk.icon.find { |name, _data| name == file_name }.try(:last)
end
|
#ipad_icons ⇒ Object
59
60
61
|
# File 'lib/app_parser/apk.rb', line 59
def ipad_icons
[]
end
|
#iphone_icons ⇒ Object
55
56
57
|
# File 'lib/app_parser/apk.rb', line 55
def iphone_icons
[]
end
|
#os ⇒ Object
23
24
25
|
# File 'lib/app_parser/apk.rb', line 23
def os
"android"
end
|
#provisioned_devices ⇒ Object
43
44
45
|
# File 'lib/app_parser/apk.rb', line 43
def provisioned_devices
[]
end
|
#provisions_all_devices ⇒ Object
47
48
49
|
# File 'lib/app_parser/apk.rb', line 47
def provisions_all_devices
false
end
|
#version ⇒ Object
27
28
29
|
# File 'lib/app_parser/apk.rb', line 27
def version
@apk.manifest.version_code.to_s
end
|
#version_string ⇒ Object
31
32
33
|
# File 'lib/app_parser/apk.rb', line 31
def version_string
@apk.manifest.version_name
end
|