Sha256: beaa452f97ff59ae8400b4c2bda8f782d9e6925b1d57c05318816829456d7934

Contents?: true

Size: 1.6 KB

Versions: 21

Compression:

Stored size: 1.6 KB

Contents

require 'fastimage'

module Deliver
  class ItunesConnect < FastlaneCore::ItunesConnect
    # Uploading a new full size app icon

    def upload_apple_watch_app_icon!(app, path)
      path = File.expand_path(path)
      raise "Could not find watch app icon at path '#{path}'".red unless File.exists?path

      size = FastImage.size(path)
      raise "Watch App icon must have the resolution of 1024x1024px".red unless (size[0] == 1024 and size[1] == 1024)

      # Remove alpha channel
      Helper.log.info "Removing alpha channel from provided Watch App Icon (iTunes Connect requirement)".green
      
      `sips -s format bmp '#{path}' &> /dev/null ` # &> /dev/null since there is warning because of the extension
      `sips -s format png '#{path}'`

      begin
        verify_app(app)
        open_app_page(app)

        Helper.log.info "Starting upload of new watch app icon".green

        evaluate_script("$('.ico.icon-chevron-animate-open-close.close').click()") # delete button
        evaluate_script("$('.appversionicon.watchIcon > .ios7-style-icon').prev().click()") # delete button
        evaluate_script("$('[style-class=\"appversionicon watchIcon rounded\"] [itc-launch-filechooser] + input').attr('id', 'deliverFileUploadInputWatch')") # set div
        evaluate_script("URL = webkitURL; URL.createObjectURL = function(){return 'blob:abc'}"); # shim URL
        page.attach_file("deliverFileUploadInputWatch", path) # add file

        sleep 10

        click_on "Save"

        Helper.log.info "Finished uploading the new watch app icon".green
      rescue => ex
        error_occured(ex)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
deliver-0.13.5 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.13.4 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.13.3 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.13.2 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.13.1 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.13.0 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.12.1 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.12.0 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.11.5 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.11.4 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.11.3 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.11.2 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.11.1 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.11.1.beta lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.11.0 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.10.0 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.9.4 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.9.3 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.9.2 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb
deliver-0.9.1 lib/deliver/itunes_connect/itunes_connect_apple_watch_app_icon.rb