Class: AppInfo::AAB
Overview
Constant Summary
collapse
- BASE_PATH =
'base'
- BASE_MANIFEST =
"#{BASE_PATH}/manifest/AndroidManifest.xml"
- BASE_RESOURCES =
"#{BASE_PATH}/resources.pb"
Helper::HumanFileSize::FILE_SIZE_UNITS
Instance Attribute Summary
Attributes inherited from File
#file, #logger
Instance Method Summary
collapse
Methods inherited from Android
#automotive?, #certificates, #contents, #device, #manufacturer, #platform, #signatures, #signs, #size, #tablet?, #television?, #watch?
#file_to_human_size, #number_to_human_size
Methods inherited from File
#device, #format, #initialize, #manufacturer, #not_implemented_error!, #platform, #size
Constructor Details
This class inherits a constructor from AppInfo::File
Instance Method Details
69
70
71
|
# File 'lib/app_info/aab.rb', line 69
def activities
@activities ||= manifest.activities
end
|
#clear! ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
|
# File 'lib/app_info/aab.rb', line 174
def clear!
return unless @contents
FileUtils.rm_rf(@contents)
@aab = nil
@contents = nil
@icons = nil
@app_path = nil
@info = nil
end
|
79
80
81
|
# File 'lib/app_info/aab.rb', line 79
def components
@components ||= manifest.components.transform_values
end
|
#deep_links ⇒ String
21
|
# File 'lib/app_info/aab.rb', line 21
def_delegators :manifest, :version_name, :deep_links, :schemes
|
#each_file ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/app_info/aab.rb', line 83
def each_file
zip.each do |entry|
next unless entry.file?
yield entry.name, @zip.read(entry)
end
end
|
#entry(name, base_path: BASE_PATH) ⇒ Object
98
99
100
101
102
103
|
# File 'lib/app_info/aab.rb', line 98
def entry(name, base_path: BASE_PATH)
entry = @zip.find_entry(::File.join(base_path, name))
raise NotFoundError, "'#{name}'" if entry.nil?
entry
end
|
#icons(exclude: nil) ⇒ Array<Hash{Symbol => String, Array<Integer>}>
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/app_info/aab.rb', line 153
def icons(exclude: nil)
@icons ||= manifest.icons.each_with_object([]) do |res, obj|
path = res.value
filename = ::File.basename(path)
filepath = ::File.join(contents, ::File.dirname(path))
file = ::File.join(filepath, filename)
FileUtils.mkdir_p(filepath)
binary_data = read_file(path)
::File.write(file, binary_data, encoding: Encoding::BINARY)
obj << {
name: filename,
file: file,
dimensions: ImageSize.path(file).size
}
end
(@icons, exclude: exclude)
end
|
#min_sdk_version ⇒ String
Also known as:
min_os_version
44
45
46
|
# File 'lib/app_info/aab.rb', line 44
def min_sdk_version
manifest.uses_sdk.min_sdk_version
end
|
#name ⇒ String
39
40
41
|
# File 'lib/app_info/aab.rb', line 39
def name
manifest.label
end
|
#package_name ⇒ String
Also known as:
identifier, bundle_id
26
27
28
|
# File 'lib/app_info/aab.rb', line 26
def package_name
manifest.package
end
|
#read_file(name, base_path: BASE_PATH) ⇒ Object
91
92
93
94
95
96
|
# File 'lib/app_info/aab.rb', line 91
def read_file(name, base_path: BASE_PATH)
content = @zip.read(entry(name, base_path: base_path))
return parse_binary_xml(content) if xml_file?(name)
content
end
|
#schemes ⇒ String
21
|
# File 'lib/app_info/aab.rb', line 21
def_delegators :manifest, :version_name, :deep_links, :schemes
|
74
75
76
|
# File 'lib/app_info/aab.rb', line 74
def services
@services ||= manifest.services
end
|
#target_sdk_version ⇒ String
50
51
52
|
# File 'lib/app_info/aab.rb', line 50
def target_sdk_version
manifest.uses_sdk.target_sdk_version
end
|
#use_features ⇒ Array<String>
55
56
57
58
59
|
# File 'lib/app_info/aab.rb', line 55
def use_features
return [] unless manifest.respond_to?(:uses_feature)
@use_features ||= manifest&.uses_feature&.map(&:name)
end
|
#use_permissions ⇒ Array<String>
62
63
64
65
66
|
# File 'lib/app_info/aab.rb', line 62
def use_permissions
return [] unless manifest.respond_to?(:uses_permission)
@use_permissions ||= manifest&.uses_permission&.map(&:name)
end
|
#version_code ⇒ String
Also known as:
build_version
33
34
35
|
# File 'lib/app_info/aab.rb', line 33
def version_code
manifest.version_code.to_s
end
|
#version_name ⇒ String
Also known as:
release_version
21
|
# File 'lib/app_info/aab.rb', line 21
def_delegators :manifest, :version_name, :deep_links, :schemes
|
#zip ⇒ Zip::File
187
188
189
|
# File 'lib/app_info/aab.rb', line 187
def zip
@zip ||= Zip::File.open(@file)
end
|