Class: Spaceship::Tunes::DisplayFamily

Inherits:
Object
  • Object
show all
Defined in:
spaceship/lib/spaceship/tunes/display_family.rb

Overview

A definition of different styled displays used by devices that App Store Connect supports storing screenshots. Display styles often only vary based on screen resolution however other aspects of a displays physical appearance are also factored (i.e if the home indicator is provided via a hardware button or a software interface).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#friendly_category_nameObject

The user friendly category for this definition (i.e iPhone, Apple TV or Desktop).


25
26
27
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 25

def friendly_category_name
  @friendly_category_name
end

#friendly_nameObject

The user friendly name of this definition.

Source: Media Manager in App Store Connect.


21
22
23
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 21

def friendly_name
  @friendly_name
end

#messages_picture_typeObject

Similar to `picture_type`, but for iMessage screenshots.


43
44
45
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 43

def messages_picture_type
  @messages_picture_type
end

#nameObject

The display family name from the App Store Connect API that is used when uploading or listing screenshots. This value is then assigned to the Spaceship::Tunes::AppScreenshot#device_type attribute.


16
17
18
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 16

def name
  @name
end

#picture_typeObject

An internal identifier for the same device definition used in the DUClient.

Source: You can find this by uploading an image in App Store Connect using your browser and then look for the X-Apple-Upload-Validation-RuleSets value in the uploads request headers.


40
41
42
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 40

def picture_type
  @picture_type
end

#screenshot_resolutionsObject

An array of supported screen resolutions (in pixels) that are supported for the associated device.

Source: help.apple.com/app-store-connect/#/devd274dd925


31
32
33
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 31

def screenshot_resolutions
  @screenshot_resolutions
end

Class Method Details

.allObject

All DisplayFamily types currently supported by App Store Connect.


60
61
62
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 60

def self.all
  lookup.values
end

.find(name) ⇒ Object

Finds a DisplayFamily definition.

Parameters:

  • name (Symbol|String)

    The name of the display family being searched for.

Returns:

  • DisplayFamily object matching the given name.


54
55
56
57
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 54

def self.find(name)
  name = name.to_sym if name.kind_of?(String)
  lookup[name]
end

.lookupObject


66
67
68
69
70
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 66

def self.lookup
  return @lookup if defined?(@lookup)
  display_families = JSON.parse(File.read(File.join(Spaceship::ROOT, "lib", "assets", "displayFamilies.json")))
  @lookup ||= display_families.map { |data| [data["name"].to_sym, DisplayFamily.new(data)] }.to_h
end

Instance Method Details

#messages_supported?Boolean

Identifies if the device definition supports iMessage screenshots.

Returns:

  • (Boolean)

46
47
48
# File 'spaceship/lib/spaceship/tunes/display_family.rb', line 46

def messages_supported?
  true unless messages_picture_type.nil?
end