Sha256: ce773644a7d919cbe799076307229ed06600050902ce02e595a4a9eb2468e0bd

Contents?: true

Size: 825 Bytes

Versions: 301

Compression:

Stored size: 825 Bytes

Contents

require_relative 'module'
require_relative 'frame_downloader'

module Frameit
  class Offsets
    # Returns the image offset needed for a certain device type for a given orientation
    # uses deliver to detect the screen size
    def self.image_offset(screenshot)
      require 'json'

      unless @offsets
        offsets_json_path = File.join(FrameDownloader.new.templates_path, "offsets.json")
        UI.user_error!("Could not find offsets.json file at path '#{offsets_json_path}'") unless File.exist?(offsets_json_path)
        @offsets = JSON.parse(File.read(offsets_json_path))
      end

      offset_value = @offsets["portrait"][screenshot.device_name]
      UI.error("Tried looking for offset information for 'portrait', #{screenshot.device_name}") unless offset_value
      return offset_value
    end
  end
end

Version data entries

301 entries across 301 versions & 1 rubygems

Version Path
fastlane-2.117.0.beta.20190215200101 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190214200107 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190213200055 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190212200112 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190211200054 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190210200028 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190209200055 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190208200116 frameit/lib/frameit/offsets.rb
fastlane-2.117.0.beta.20190207200055 frameit/lib/frameit/offsets.rb
fastlane-2.116.0 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190206200014 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190205200046 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190204200009 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190203200034 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190202200022 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190201200019 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190131200016 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190130200045 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190129200025 frameit/lib/frameit/offsets.rb
fastlane-2.116.0.beta.20190128200102 frameit/lib/frameit/offsets.rb