Method: Deliver::AppScreenshotValidator.validate

Defined in:
deliver/lib/deliver/app_screenshot_validator.rb

.validate(screenshot, errors) ⇒ Boolean

Validate a screenshot and inform an error message via ‘errors` parameter. `errors` is mutated to append the messages and each message should contain the corresponding path to let users know which file is throwing the error.

Parameters:

Returns:

  • (Boolean)

    true if given screenshot is valid



44
45
46
47
48
49
50
51
52
53
54
55
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 44

def self.validate(screenshot, errors)
  # Given screenshot will be diagnosed and errors found are accumulated
  errors_found = []

  validate_screen_size(screenshot, errors_found)
  validate_device_type(screenshot, errors_found)
  validate_file_extension_and_format(screenshot, errors_found)

  # Merge errors found into given errors array
  errors_found.each { |error| errors.push(error) }
  errors_found.empty?
end