Sha256: 70265f99b40f88a09bf368d990b605da6e87153e4de46191466374ca7f02ba08

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

module Spaceship
  module Tunes
    # internal to spaceship
    # Represents the common structure between application['versionSets'] and app_version['platform']
    class AppVersionCommon
      class << self
        def find_version_id(platform, is_live)
          version = platform[(is_live ? 'deliverableVersion' : 'inFlightVersion')]
          return nil unless version
          version['id']
        end

        def find_platform(versions, search_platform: nil)
          # We only support platforms that exist ATM
          search_platform = search_platform.to_sym if search_platform

          platform = versions.detect do |p|
            ['ios', 'osx', 'appletvos'].include?(p['platformString'])
          end

          raise "Could not find platform 'ios', 'osx' or 'appletvos'" unless platform

          # If your app has versions for both iOS and tvOS we will default to returning the iOS version for now.
          # This is intentional as we need to do more work to support apps that have hybrid versions.
          if versions.length > 1 && search_platform.nil?
            platform = versions.detect { |p| p['platformString'].to_sym == :ios }
          elsif !search_platform.nil?
            platform = versions.detect { |p| p['platformString'].to_sym == search_platform }
          end
          platform
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastlane_hotfix-2.165.1 spaceship/lib/spaceship/tunes/app_version_common.rb
fastlane_hotfix-2.165.0 spaceship/lib/spaceship/tunes/app_version_common.rb
fastlane_hotfix-2.187.0 spaceship/lib/spaceship/tunes/app_version_common.rb