Class: Flappy::Parser::Apk

Inherits:
Object show all
Includes:
Common
Defined in:
lib/flappy/util/parser/apk.rb

Instance Method Summary collapse

Methods included from Common

#generate_tmp_icon

Constructor Details

#initialize(path) ⇒ Apk

Returns a new instance of Apk.



10
11
12
# File 'lib/flappy/util/parser/apk.rb', line 10

def initialize(path)
  @apk = ::Android::Apk.new(path)
end

Instance Method Details

#basic_infoObject



22
23
24
25
26
27
28
29
30
# File 'lib/flappy/util/parser/apk.rb', line 22

def basic_info
  @basic_info ||= {
    type:       'android',
    identifier: @apk.manifest.package_name,
    name:       @apk.label,
    build:      @apk.manifest.version_code.to_s,
    version:    @apk.manifest.version_name.to_s
  }
end

#full_info(options) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/flappy/util/parser/apk.rb', line 14

def full_info(options)
  if options.fetch(:full_info, false)
    basic_info.merge!(icons: tmp_icons)
  end

  basic_info
end

#tmp_iconsObject



33
34
35
36
37
38
39
# File 'lib/flappy/util/parser/apk.rb', line 33

def tmp_icons
  begin
    @apk.icon.map { |_, data| generate_tmp_icon(data, :apk) }
  rescue
    []
  end
end