Sha256: 42851c662b9efce945595469627047807bcf85c5830e21c883f1d897754d45e9

Contents?: true

Size: 828 Bytes

Versions: 15

Compression:

Stored size: 828 Bytes

Contents

# encoding: utf-8

require_relative './common'

module FIR
  module Parser
    class Apk
      include Parser::Common

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

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

        basic_info
      end

      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

      # @apk.icon is a hash, { icon_name: icon_binary_data }
      def tmp_icons
        @apk.icon.map { |_, data| generate_tmp_icon(data, :apk) }
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fir-cli-1.4.9 lib/fir/util/parser/apk.rb
fir-cli-1.4.8 lib/fir/util/parser/apk.rb
fir-cli-1.4.7 lib/fir/util/parser/apk.rb
fir-cli-1.4.6 lib/fir/util/parser/apk.rb
fir-cli-1.4.5 lib/fir/util/parser/apk.rb
fir-cli-1.4.4 lib/fir/util/parser/apk.rb
fir-cli-1.4.3 lib/fir/util/parser/apk.rb
fir-cli-1.4.2 lib/fir/util/parser/apk.rb
fir-cli-1.4.1 lib/fir/util/parser/apk.rb
fir-cli-1.4.0 lib/fir/util/parser/apk.rb
fir-cli-1.3.9 lib/fir/util/parser/apk.rb
fir-cli-1.3.8 lib/fir/util/parser/apk.rb
fir-cli-1.3.7 lib/fir/util/parser/apk.rb
fir-cli-1.3.6 lib/fir/util/parser/apk.rb
fir-cli-1.3.5 lib/fir/util/parser/apk.rb