Class: AppInfo::Protobuf::Manifest

Inherits:
Node
  • Object
show all
Defined in:
lib/app_info/protobuf/manifest.rb

Overview

AAB Protobuf Manifest

Defined Under Namespace

Classes: Data, IntentFilter

Constant Summary collapse

COMPONENTS =
%w[activity activity-alias service receiver provider application].freeze

Instance Attribute Summary

Attributes inherited from Node

#attributes, #children, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helper::GenerateClass

#create_class, #define_instance_method

Constructor Details

This class inherits a constructor from AppInfo::Protobuf::Base

Class Method Details

.parse(io, resources = nil) ⇒ Object



115
116
117
118
# File 'lib/app_info/protobuf/manifest.rb', line 115

def self.parse(io, resources = nil)
  doc = Aapt::Pb::XmlNode.decode(io)
  new(doc, resources)
end

Instance Method Details

#activitiesObject



136
137
138
# File 'lib/app_info/protobuf/manifest.rb', line 136

def activities
  application.respond_to?(:activity) ? application.activity : []
end

#componentsObject



130
131
132
133
134
# File 'lib/app_info/protobuf/manifest.rb', line 130

def components
  application.children.select do |name, _|
    COMPONENTS.include?(name.downcase)
  end
end


148
149
150
# File 'lib/app_info/protobuf/manifest.rb', line 148

def deep_links
  intent_filters(search: :deep_links)
end

#iconsObject



144
145
146
# File 'lib/app_info/protobuf/manifest.rb', line 144

def icons
  @resources.find(application.icon)
end

#label(locale: '') ⇒ Object



126
127
128
# File 'lib/app_info/protobuf/manifest.rb', line 126

def label(locale: '')
  @resources.find(application.label, locale: locale).value || application.label
end

#package_nameObject



122
123
124
# File 'lib/app_info/protobuf/manifest.rb', line 122

def package_name
  @package_name ||= package
end

#schemesObject



152
153
154
# File 'lib/app_info/protobuf/manifest.rb', line 152

def schemes
  intent_filters(search: :schemes)
end

#servicesObject



140
141
142
# File 'lib/app_info/protobuf/manifest.rb', line 140

def services
  application.respond_to?(:service) ? application.service : []
end