Sha256: 94fac13c97edad9a5de1597af545bb68d0105364f96c5d0cf4c534e3f829b56c

Contents?: true

Size: 800 Bytes

Versions: 223

Compression:

Stored size: 800 Bytes

Contents

require_relative 'module'
require_relative 'frame_downloader'

module Frameit
  class Offsets
    # Returns the image offset needed for a certain device type
    def self.image_offset(screenshot)
      require 'json'

      unless @offsets_cache
        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_cache = JSON.parse(File.read(offsets_json_path))
      end

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

Version data entries

223 entries across 223 versions & 2 rubygems

Version Path
fastlane-2.130.0.beta.20190816200015 frameit/lib/frameit/offsets.rb
fastlane-2.130.0.beta.20190815200057 frameit/lib/frameit/offsets.rb
fastlane-2.130.0.beta.20190814200010 frameit/lib/frameit/offsets.rb
fastlane-2.129.0 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190813200016 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190811200106 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190810200059 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190809200051 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190808200013 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190807200122 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190806200055 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190805200019 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190804200053 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190803200103 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190802200057 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190731200035 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190730200040 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190729200106 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190728200052 frameit/lib/frameit/offsets.rb
fastlane-2.129.0.beta.20190727200032 frameit/lib/frameit/offsets.rb