fastlane 2.202.0 → 2.212.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -98
  3. data/cert/lib/cert/runner.rb +15 -7
  4. data/deliver/lib/deliver/app_screenshot.rb +18 -0
  5. data/deliver/lib/deliver/options.rb +6 -2
  6. data/deliver/lib/deliver/runner.rb +76 -29
  7. data/deliver/lib/deliver/upload_price_tier.rb +3 -1
  8. data/deliver/lib/deliver/upload_screenshots.rb +1 -1
  9. data/fastlane/lib/assets/AppfileTemplate +1 -1
  10. data/fastlane/lib/assets/AppfileTemplate.swift +1 -1
  11. data/fastlane/lib/fastlane/actions/badge.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/danger.rb +14 -0
  14. data/fastlane/lib/fastlane/actions/docs/build_app.md +5 -5
  15. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +19 -2
  16. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/run_tests.md +1 -1
  18. data/fastlane/lib/fastlane/actions/get_version_number.rb +1 -1
  19. data/fastlane/lib/fastlane/actions/git_commit.rb +4 -6
  20. data/fastlane/lib/fastlane/actions/import_certificate.rb +1 -1
  21. data/fastlane/lib/fastlane/actions/pod_lib_lint.rb +1 -1
  22. data/fastlane/lib/fastlane/actions/pod_push.rb +19 -1
  23. data/fastlane/lib/fastlane/actions/read_podspec.rb +1 -1
  24. data/fastlane/lib/fastlane/actions/run_tests.rb +11 -9
  25. data/fastlane/lib/fastlane/actions/setup_ci.rb +13 -4
  26. data/fastlane/lib/fastlane/actions/trainer.rb +2 -2
  27. data/fastlane/lib/fastlane/actions/update_code_signing_settings.rb +14 -4
  28. data/fastlane/lib/fastlane/actions/update_info_plist.rb +1 -1
  29. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +10 -1
  30. data/fastlane/lib/fastlane/actions/upload_symbols_to_sentry.rb +1 -1
  31. data/fastlane/lib/fastlane/actions/verify_build.rb +1 -1
  32. data/fastlane/lib/fastlane/actions/xcode_install.rb +5 -1
  33. data/fastlane/lib/fastlane/actions/xcode_select.rb +1 -1
  34. data/fastlane/lib/fastlane/actions/xcodebuild.rb +8 -2
  35. data/fastlane/lib/fastlane/actions/xcodes.rb +152 -0
  36. data/fastlane/lib/fastlane/actions/xcversion.rb +10 -15
  37. data/fastlane/lib/fastlane/cli_tools_distributor.rb +5 -0
  38. data/fastlane/lib/fastlane/commands_generator.rb +2 -1
  39. data/fastlane/lib/fastlane/fast_file.rb +18 -5
  40. data/fastlane/lib/fastlane/features.rb +3 -0
  41. data/fastlane/lib/fastlane/helper/xcodes_helper.rb +28 -0
  42. data/fastlane/lib/fastlane/helper/xcversion_helper.rb +0 -9
  43. data/fastlane/lib/fastlane/lane_manager.rb +1 -1
  44. data/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +1 -1
  45. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +5 -1
  46. data/fastlane/lib/fastlane/setup/setup_ios.rb +1 -1
  47. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +1 -1
  48. data/fastlane/lib/fastlane/swift_lane_manager.rb +11 -3
  49. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +54 -1
  50. data/fastlane/lib/fastlane/tools.rb +16 -0
  51. data/fastlane/lib/fastlane/version.rb +1 -1
  52. data/fastlane/swift/Actions.swift +1 -1
  53. data/fastlane/swift/Appfile.swift +2 -2
  54. data/fastlane/swift/ArgumentProcessor.swift +1 -1
  55. data/fastlane/swift/Atomic.swift +150 -0
  56. data/fastlane/swift/ControlCommand.swift +1 -1
  57. data/fastlane/swift/Deliverfile.swift +2 -2
  58. data/fastlane/swift/DeliverfileProtocol.swift +8 -4
  59. data/fastlane/swift/Fastlane.swift +363 -184
  60. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +30 -20
  61. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/xcshareddata/xcschemes/FastlaneRunner.xcscheme +1 -1
  62. data/fastlane/swift/Gymfile.swift +2 -2
  63. data/fastlane/swift/GymfileProtocol.swift +7 -3
  64. data/fastlane/swift/LaneFileProtocol.swift +2 -2
  65. data/fastlane/swift/MainProcess.swift +3 -3
  66. data/fastlane/swift/Matchfile.swift +2 -2
  67. data/fastlane/swift/MatchfileProtocol.swift +21 -5
  68. data/fastlane/swift/OptionalConfigValue.swift +1 -1
  69. data/fastlane/swift/Plugins.swift +1 -1
  70. data/fastlane/swift/Precheckfile.swift +2 -2
  71. data/fastlane/swift/PrecheckfileProtocol.swift +3 -3
  72. data/fastlane/swift/RubyCommand.swift +1 -1
  73. data/fastlane/swift/RubyCommandable.swift +1 -1
  74. data/fastlane/swift/Runner.swift +10 -2
  75. data/fastlane/swift/RunnerArgument.swift +1 -1
  76. data/fastlane/swift/Scanfile.swift +2 -2
  77. data/fastlane/swift/ScanfileProtocol.swift +11 -3
  78. data/fastlane/swift/Screengrabfile.swift +2 -2
  79. data/fastlane/swift/ScreengrabfileProtocol.swift +3 -3
  80. data/fastlane/swift/Snapshotfile.swift +2 -2
  81. data/fastlane/swift/SnapshotfileProtocol.swift +4 -4
  82. data/fastlane/swift/SocketClient.swift +9 -5
  83. data/fastlane/swift/SocketClientDelegateProtocol.swift +2 -2
  84. data/fastlane/swift/SocketResponse.swift +1 -1
  85. data/fastlane/swift/formatting/Brewfile.lock.json +42 -24
  86. data/fastlane/swift/main.swift +1 -1
  87. data/fastlane/swift/upgrade_manifest.json +1 -1
  88. data/fastlane_core/README.md +1 -0
  89. data/fastlane_core/lib/fastlane_core/cert_checker.rb +79 -17
  90. data/fastlane_core/lib/fastlane_core/device_manager.rb +5 -1
  91. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +335 -20
  92. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -0
  93. data/fastlane_core/lib/fastlane_core/project.rb +19 -2
  94. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +4 -2
  95. data/frameit/lib/frameit/device.rb +1 -1
  96. data/frameit/lib/frameit/device_types.rb +9 -0
  97. data/frameit/lib/frameit/frame_downloader.rb +1 -1
  98. data/gym/lib/gym/generators/build_command_generator.rb +1 -0
  99. data/gym/lib/gym/options.rb +7 -0
  100. data/match/lib/match/change_password.rb +2 -0
  101. data/match/lib/match/commands_generator.rb +2 -1
  102. data/match/lib/match/encryption/openssl.rb +1 -1
  103. data/match/lib/match/encryption.rb +3 -0
  104. data/match/lib/match/generator.rb +1 -0
  105. data/match/lib/match/importer.rb +10 -1
  106. data/match/lib/match/migrate.rb +4 -3
  107. data/match/lib/match/module.rb +54 -2
  108. data/match/lib/match/nuke.rb +36 -47
  109. data/match/lib/match/options.rb +22 -1
  110. data/match/lib/match/runner.rb +25 -6
  111. data/match/lib/match/setup.rb +1 -1
  112. data/match/lib/match/spaceship_ensure.rb +4 -2
  113. data/match/lib/match/storage/gitlab/client.rb +102 -0
  114. data/match/lib/match/storage/gitlab/secure_file.rb +65 -0
  115. data/match/lib/match/storage/gitlab_secure_files.rb +182 -0
  116. data/match/lib/match/storage/google_cloud_storage.rb +7 -6
  117. data/match/lib/match/storage/s3_storage.rb +3 -3
  118. data/match/lib/match/storage.rb +4 -0
  119. data/match/lib/match/table_printer.rb +2 -1
  120. data/match/lib/match/utils.rb +15 -2
  121. data/pem/lib/pem/manager.rb +1 -1
  122. data/pilot/lib/pilot/build_manager.rb +33 -13
  123. data/pilot/lib/pilot/options.rb +6 -1
  124. data/scan/lib/scan/detect_values.rb +6 -0
  125. data/scan/lib/scan/options.rb +16 -1
  126. data/scan/lib/scan/runner.rb +33 -14
  127. data/scan/lib/scan/test_command_generator.rb +7 -1
  128. data/sigh/lib/sigh/download_all.rb +14 -2
  129. data/sigh/lib/sigh/module.rb +3 -1
  130. data/sigh/lib/sigh/options.rb +5 -0
  131. data/sigh/lib/sigh/runner.rb +12 -2
  132. data/snapshot/lib/assets/SnapshotHelper.swift +3 -3
  133. data/snapshot/lib/snapshot/options.rb +1 -1
  134. data/snapshot/lib/snapshot/reports_generator.rb +1 -0
  135. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +9 -2
  136. data/spaceship/lib/spaceship/client.rb +36 -25
  137. data/spaceship/lib/spaceship/connect_api/api_client.rb +10 -5
  138. data/spaceship/lib/spaceship/connect_api/models/actor.rb +26 -0
  139. data/spaceship/lib/spaceship/connect_api/models/app.rb +7 -5
  140. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +5 -0
  141. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +5 -0
  142. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +1 -1
  143. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +27 -10
  144. data/spaceship/lib/spaceship/connect_api/models/build_bundle.rb +9 -0
  145. data/spaceship/lib/spaceship/connect_api/models/build_bundle_file_sizes.rb +34 -0
  146. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +2 -1
  147. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +1 -0
  148. data/spaceship/lib/spaceship/connect_api/models/device.rb +47 -4
  149. data/spaceship/lib/spaceship/connect_api/models/profile.rb +4 -0
  150. data/spaceship/lib/spaceship/connect_api/models/resolution_center_message.rb +29 -0
  151. data/spaceship/lib/spaceship/connect_api/models/resolution_center_thread.rb +67 -0
  152. data/spaceship/lib/spaceship/connect_api/models/review_rejection.rb +19 -0
  153. data/spaceship/lib/spaceship/connect_api/models/review_submission.rb +13 -0
  154. data/spaceship/lib/spaceship/connect_api/models/user.rb +5 -0
  155. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +19 -0
  156. data/spaceship/lib/spaceship/connect_api/response.rb +10 -6
  157. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +33 -2
  158. data/spaceship/lib/spaceship/connect_api/token.rb +5 -2
  159. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +41 -8
  160. data/spaceship/lib/spaceship/connect_api.rb +6 -0
  161. data/spaceship/lib/spaceship/errors.rb +34 -0
  162. data/spaceship/lib/spaceship/hashcash.rb +52 -0
  163. data/spaceship/lib/spaceship/portal/certificate.rb +4 -3
  164. data/spaceship/lib/spaceship/tunes/app_ratings.rb +6 -6
  165. data/spaceship/lib/spaceship/tunes/iap_families.rb +1 -1
  166. data/spaceship/lib/spaceship/tunes/tunes.rb +0 -1
  167. data/spaceship/lib/spaceship/tunes/tunes_client.rb +79 -21
  168. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +11 -3
  169. data/spaceship/lib/spaceship.rb +1 -0
  170. data/supply/lib/supply/client.rb +2 -7
  171. data/trainer/lib/assets/junit.xml.erb +9 -1
  172. data/trainer/lib/trainer/junit_generator.rb +2 -2
  173. data/trainer/lib/trainer/options.rb +1 -1
  174. data/trainer/lib/trainer/test_parser.rb +25 -3
  175. metadata +36 -33
  176. data/deliver/lib/deliver/.runner.rb.swp +0 -0
  177. data/deliver/lib/deliver/.submit_for_review.rb.swp +0 -0
  178. data/fastlane/lib/.DS_Store +0 -0
  179. data/fastlane/lib/fastlane/.DS_Store +0 -0
  180. data/fastlane/lib/fastlane/actions/.DS_Store +0 -0
  181. data/spaceship/lib/spaceship/connect_api/models/.app.rb.swp +0 -0
  182. data/spaceship/lib/spaceship/connect_api/testflight/.testflight.rb.swp +0 -0
  183. data/spaceship/lib/spaceship/tunes/user_detail.rb +0 -15
  184. data/trainer/lib/.DS_Store +0 -0
@@ -47,6 +47,11 @@ module Sigh
47
47
  is_string: false,
48
48
  short_option: "-f",
49
49
  default_value: false),
50
+ FastlaneCore::ConfigItem.new(key: :include_mac_in_profiles,
51
+ env_name: "SIGH_INCLUDE_MAC_IN_PROFILES",
52
+ description: "Include Apple Silicon Mac devices in provisioning profiles for iOS/iPadOS apps",
53
+ is_string: false,
54
+ default_value: false),
50
55
  FastlaneCore::ConfigItem.new(key: :app_identifier,
51
56
  short_option: "-a",
52
57
  env_name: "SIGH_APP_IDENTIFIER",
@@ -82,10 +82,12 @@ module Sigh
82
82
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_DEVELOPMENT if Sigh.config[:development]
83
83
  when "macos"
84
84
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_STORE
85
+ @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_INHOUSE if Spaceship::ConnectAPI.client.in_house?
85
86
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DEVELOPMENT if Sigh.config[:development]
86
87
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DIRECT if Sigh.config[:developer_id]
87
88
  when "catalyst"
88
89
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_STORE
90
+ @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_INHOUSE if Spaceship::ConnectAPI.client.in_house?
89
91
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DEVELOPMENT if Sigh.config[:development]
90
92
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DIRECT if Sigh.config[:developer_id]
91
93
  end
@@ -251,7 +253,13 @@ module Sigh
251
253
  ]
252
254
  elsif profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DIRECT || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DIRECT
253
255
  types = [
254
- Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION
256
+ Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION,
257
+ Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION_G2
258
+ ]
259
+ elsif profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_INHOUSE || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_INHOUSE
260
+ # Enterprise accounts don't have access to Apple Distribution certificates
261
+ types = [
262
+ Spaceship::ConnectAPI::Certificate::CertificateType::MAC_APP_DISTRIBUTION
255
263
  ]
256
264
  else
257
265
  types = [
@@ -281,7 +289,9 @@ module Sigh
281
289
  when 'macos', 'catalyst'
282
290
  [Spaceship::ConnectAPI::Device::DeviceClass::MAC]
283
291
  end
284
-
292
+ if Sigh.config[:platform].to_s == 'ios' && Sigh.config[:include_mac_in_profiles]
293
+ device_classes += [Spaceship::ConnectAPI::Device::DeviceClass::APPLE_SILICON_MAC]
294
+ end
285
295
  if Spaceship::ConnectAPI.token
286
296
  return Spaceship::ConnectAPI::Device.all.select do |device|
287
297
  device_classes.include?(device.device_class)
@@ -165,7 +165,7 @@ open class Snapshot: NSObject {
165
165
  }
166
166
 
167
167
  let screenshot = XCUIScreen.main.screenshot()
168
- #if os(iOS)
168
+ #if os(iOS) && !targetEnvironment(macCatalyst)
169
169
  let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image
170
170
  #else
171
171
  let image = screenshot.image
@@ -181,7 +181,7 @@ open class Snapshot: NSObject {
181
181
 
182
182
  let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")
183
183
  #if swift(<5.0)
184
- UIImagePNGRepresentation(image)?.write(to: path, options: .atomic)
184
+ try UIImagePNGRepresentation(image)?.write(to: path, options: .atomic)
185
185
  #else
186
186
  try image.pngData()?.write(to: path, options: .atomic)
187
187
  #endif
@@ -306,4 +306,4 @@ private extension CGFloat {
306
306
 
307
307
  // Please don't remove the lines below
308
308
  // They are used to detect outdated configuration files
309
- // SnapshotHelperVersion [1.27]
309
+ // SnapshotHelperVersion [1.29]
@@ -133,7 +133,7 @@ module Snapshot
133
133
  is_string: false),
134
134
  FastlaneCore::ConfigItem.new(key: :override_status_bar_arguments,
135
135
  env_name: 'SNAPSHOT_OVERRIDE_STATUS_BAR_ARGUMENTS',
136
- description: "Fully customize the status bar by setting each option here. See `xcrun simctl status_bar --help`",
136
+ description: "Fully customize the status bar by setting each option here. Requires `override_status_bar` to be set to `true`. See `xcrun simctl status_bar --help`",
137
137
  optional: true,
138
138
  type: String),
139
139
  FastlaneCore::ConfigItem.new(key: :localize_simulator,
@@ -132,6 +132,7 @@ module Snapshot
132
132
  'iPad Pro (12.9-inch)' => 'iPad Pro (12.9-inch)',
133
133
  'iPad Pro (12.9 inch)' => 'iPad Pro (12.9-inch)', # iOS 10.3.1 simulator
134
134
  'iPad Pro' => 'iPad Pro (12.9-inch)', # iOS 9.3 simulator
135
+ 'iPod touch (7th generation)' => 'iPod touch (7th generation)',
135
136
  'Apple TV 1080p' => 'Apple TV',
136
137
  'Apple TV 4K (at 1080p)' => 'Apple TV 4K (at 1080p)',
137
138
  'Apple TV 4K' => 'Apple TV 4K',
@@ -94,7 +94,11 @@ module Snapshot
94
94
  device_udid = TestCommandGenerator.device_udid(device_type)
95
95
 
96
96
  UI.message("Launch Simulator #{device_type}")
97
- Helper.backticks("xcrun instruments -w #{device_udid} &> /dev/null")
97
+ if FastlaneCore::Helper.xcode_at_least?("13")
98
+ Helper.backticks("open -a Simulator.app --args -CurrentDeviceUDID #{device_udid} &> /dev/null")
99
+ else
100
+ Helper.backticks("xcrun instruments -w #{device_udid} &> /dev/null")
101
+ end
98
102
 
99
103
  paths.each do |path|
100
104
  UI.message("Adding '#{path}'")
@@ -131,7 +135,10 @@ module Snapshot
131
135
  if arguments.nil? || arguments.empty?
132
136
  # The time needs to be passed as ISO8601 so the simulator formats it correctly
133
137
  time = Time.new(2007, 1, 9, 9, 41, 0)
134
- arguments = "--time #{time.iso8601} --dataNetwork wifi --wifiMode active --wifiBars 3 --cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100"
138
+
139
+ # If you don't override the operator name, you'll get "Carrier" in the status bar on no-notch devices such as iPhone 8. Pass an empty string to blank it out.
140
+
141
+ arguments = "--time #{time.iso8601} --dataNetwork wifi --wifiMode active --wifiBars 3 --cellularMode active --operatorName '' --cellularBars 4 --batteryState charged --batteryLevel 100"
135
142
  end
136
143
 
137
144
  Helper.backticks("xcrun simctl status_bar #{device_udid} override #{arguments} &> /dev/null")
@@ -18,6 +18,7 @@ require_relative 'tunes/errors'
18
18
  require_relative 'globals'
19
19
  require_relative 'provider'
20
20
  require_relative 'stats_middleware'
21
+ require_relative 'hashcash'
21
22
 
22
23
  Faraday::Utils.default_params_encoder = Faraday::FlatParamsEncoder
23
24
 
@@ -70,10 +71,10 @@ module Spaceship
70
71
 
71
72
  # @return (Array) A list of all available teams
72
73
  def teams
73
- user_details_data['associatedAccounts'].sort_by do |team|
74
+ user_details_data['availableProviders'].sort_by do |team|
74
75
  [
75
- team['contentProvider']['name'],
76
- team['contentProvider']['contentProviderId']
76
+ team['name'],
77
+ team['providerId']
77
78
  ]
78
79
  end
79
80
  end
@@ -124,8 +125,8 @@ module Spaceship
124
125
  # "userName"=>"detlef@krausefx.com"}
125
126
  def user_details_data
126
127
  return @_cached_user_details if @_cached_user_details
127
- r = request(:get, '/WebObjects/iTunesConnect.woa/ra/user/detail')
128
- @_cached_user_details = parse_response(r, 'data')
128
+ r = request(:get, "https://appstoreconnect.apple.com/olympus/v1/session")
129
+ @_cached_user_details = parse_response(r)
129
130
  end
130
131
 
131
132
  # @return (String) The currently selected Team ID
@@ -135,7 +136,7 @@ module Spaceship
135
136
  if teams.count > 1
136
137
  puts("The current user is in #{teams.count} teams. Pass a team ID or call `select_team` to choose a team. Using the first one for now.")
137
138
  end
138
- @current_team_id ||= user_details_data['sessionToken']['contentProviderId']
139
+ @current_team_id ||= user_details_data['provider']['providerId']
139
140
  end
140
141
 
141
142
  # Set a new team ID which will be used from now on
@@ -144,12 +145,11 @@ module Spaceship
144
145
  # following confusing error message
145
146
  #
146
147
  # invalid content provider id
147
- #
148
148
  available_teams = teams.collect do |team|
149
149
  {
150
- team_id: (team["contentProvider"] || {})["contentProviderId"],
151
- public_team_id: (team["contentProvider"] || {})["contentProviderPublicId"],
152
- team_name: (team["contentProvider"] || {})["name"]
150
+ team_id: team["providerId"],
151
+ public_team_id: team["publicProviderId"],
152
+ team_name: team["name"]
153
153
  }
154
154
  end
155
155
 
@@ -163,21 +163,10 @@ module Spaceship
163
163
  end
164
164
 
165
165
  response = request(:post) do |req|
166
- req.url("https://appstoreconnect.apple.com/olympus/v1/providerSwitchRequests")
167
- req.body = {
168
- "data": {
169
- "type": "providerSwitchRequests",
170
- "relationships": {
171
- "provider": {
172
- "data": {
173
- "type": "providers",
174
- "id": result[:public_team_id]
175
- }
176
- }
177
- }
178
- }
179
- }.to_json
166
+ req.url("https://appstoreconnect.apple.com/olympus/v1/session")
167
+ req.body = { "provider": { "providerId": result[:team_id] } }.to_json
180
168
  req.headers['Content-Type'] = 'application/json'
169
+ req.headers['X-Requested-With'] = 'olympus-ui'
181
170
  end
182
171
 
183
172
  handle_itc_response(response.body)
@@ -502,6 +491,12 @@ module Spaceship
502
491
  modified_cookie.gsub!(unescaped_important_cookie, escaped_important_cookie)
503
492
  end
504
493
 
494
+ # Fixes issue https://github.com/fastlane/fastlane/issues/21071
495
+ # On 2023-02-23, Apple added a custom implementation
496
+ # of hashcash to their auth flow
497
+ # hashcash = nil
498
+ hashcash = self.fetch_hashcash
499
+
505
500
  response = request(:post) do |req|
506
501
  req.url("https://idmsa.apple.com/appleauth/auth/signin")
507
502
  req.body = data.to_json
@@ -510,6 +505,7 @@ module Spaceship
510
505
  req.headers['X-Apple-Widget-Key'] = self.itc_service_key
511
506
  req.headers['Accept'] = 'application/json, text/javascript'
512
507
  req.headers["Cookie"] = modified_cookie if modified_cookie
508
+ req.headers["X-Apple-HC"] = hashcash if hashcash
513
509
  end
514
510
  rescue UnauthorizedAccessError
515
511
  raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username."
@@ -546,7 +542,7 @@ module Spaceship
546
542
  raise AppleIDAndPrivacyAcknowledgementNeeded.new, "Need to acknowledge to Apple's Apple ID and Privacy statement. " \
547
543
  "Please manually log into https://appleid.apple.com (or https://appstoreconnect.apple.com) to acknowledge the statement. " \
548
544
  "Your account might also be asked to upgrade to 2FA. " \
549
- "Set SPACESHIP_SKIP_2FA_UPGRADE=1 for fastlane to automaticaly bypass 2FA upgrade if possible."
545
+ "Set SPACESHIP_SKIP_2FA_UPGRADE=1 for fastlane to automatically bypass 2FA upgrade if possible."
550
546
  elsif (response['Set-Cookie'] || "").include?("itctx")
551
547
  raise "Looks like your Apple ID is not enabled for App Store Connect, make sure to be able to login online"
552
548
  else
@@ -557,6 +553,21 @@ module Spaceship
557
553
  end
558
554
  # rubocop:enable Metrics/PerceivedComplexity
559
555
 
556
+ def fetch_hashcash
557
+ response = request(:get, "https://idmsa.apple.com/appleauth/auth/signin?widgetKey=#{self.itc_service_key}")
558
+ headers = response.headers
559
+
560
+ bits = headers["X-Apple-HC-Bits"]
561
+ challenge = headers["X-Apple-HC-Challenge"]
562
+
563
+ if bits.nil? || challenge.nil?
564
+ puts("Unable to find 'X-Apple-HC-Bits' and 'X-Apple-HC-Challenge' to make hashcash")
565
+ return nil
566
+ end
567
+
568
+ return Spaceship::Hashcash.make(bits: bits, challenge: challenge)
569
+ end
570
+
560
571
  # Get the `itctx` from the new (22nd May 2017) API endpoint "olympus"
561
572
  # Update (29th March 2019) olympus migrates to new appstoreconnect API
562
573
  def fetch_olympus_session
@@ -157,8 +157,6 @@ module Spaceship
157
157
  end
158
158
 
159
159
  def with_asc_retry(tries = 5, &_block)
160
- tries = 1 if Object.const_defined?("SpecHelper")
161
-
162
160
  response = yield
163
161
 
164
162
  status = response.status if response
@@ -170,9 +168,16 @@ module Spaceship
170
168
 
171
169
  return response
172
170
  rescue UnauthorizedAccessError => error
173
- # Catch unathorized access and re-raising
174
- # There is no need to try again
175
- raise error
171
+ tries -= 1
172
+ puts(error) if Spaceship::Globals.verbose?
173
+ if tries.zero?
174
+ raise error
175
+ else
176
+ msg = "Token has expired or has been revoked! Trying to refresh..."
177
+ puts(msg) if Spaceship::Globals.verbose?
178
+ @token.refresh!
179
+ retry
180
+ end
176
181
  rescue TimeoutRetryError => error
177
182
  tries -= 1
178
183
  puts(error) if Spaceship::Globals.verbose?
@@ -0,0 +1,26 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class Actor
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :actor_type
8
+ attr_accessor :user_first_name
9
+ attr_accessor :user_last_name
10
+ attr_accessor :user_email
11
+ attr_accessor :api_key_id
12
+
13
+ attr_mapping({
14
+ actorType: 'actor_type',
15
+ userFirstName: 'user_first_name',
16
+ userLastName: 'user_last_name',
17
+ userEmail: 'user_email',
18
+ apiKeyId: 'api_key_id'
19
+ })
20
+
21
+ def self.type
22
+ return 'actors'
23
+ end
24
+ end
25
+ end
26
+ end
@@ -101,10 +101,12 @@ module Spaceship
101
101
  return client.get_app(app_id: app_id, includes: includes).first
102
102
  end
103
103
 
104
- def update(client: nil, attributes: nil, app_price_tier_id: nil, territory_ids: nil)
104
+ # Updates app attributes, price tier and availability of an app in territories
105
+ # Check Tunes patch_app method for explanation how to use territory_ids parameter with allow_removing_from_sale to remove app from sale
106
+ def update(client: nil, attributes: nil, app_price_tier_id: nil, territory_ids: nil, allow_removing_from_sale: false)
105
107
  client ||= Spaceship::ConnectAPI
106
108
  attributes = reverse_attr_mapping(attributes)
107
- return client.patch_app(app_id: id, attributes: attributes, app_price_tier_id: app_price_tier_id, territory_ids: territory_ids)
109
+ return client.patch_app(app_id: id, attributes: attributes, app_price_tier_id: app_price_tier_id, territory_ids: territory_ids, allow_removing_from_sale: allow_removing_from_sale)
108
110
  end
109
111
 
110
112
  #
@@ -362,9 +364,8 @@ module Spaceship
362
364
  def get_build_deliveries(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
363
365
  client ||= Spaceship::ConnectAPI
364
366
  filter ||= {}
365
- filter[:app] = id
366
367
 
367
- resps = client.get_build_deliveries(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
368
+ resps = client.get_build_deliveries(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
368
369
  return resps.flat_map(&:to_models)
369
370
  end
370
371
 
@@ -436,7 +437,8 @@ module Spaceship
436
437
  filter = {
437
438
  state: [
438
439
  Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::WAITING_FOR_REVIEW,
439
- Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::IN_REVIEW
440
+ Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::IN_REVIEW,
441
+ Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::UNRESOLVED_ISSUES
440
442
  ].join(","),
441
443
  platform: platform
442
444
  }
@@ -1,4 +1,5 @@
1
1
  require_relative '../model'
2
+ require_relative '../../errors'
2
3
  module Spaceship
3
4
  class ConnectAPI
4
5
  class AppInfoLocalization
@@ -32,11 +33,15 @@ module Spaceship
32
33
  client ||= Spaceship::ConnectAPI
33
34
  attributes = reverse_attr_mapping(attributes)
34
35
  client.patch_app_info_localization(app_info_localization_id: id, attributes: attributes)
36
+ rescue
37
+ raise Spaceship::AppStoreLocalizationError, @locale
35
38
  end
36
39
 
37
40
  def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
38
41
  client ||= Spaceship::ConnectAPI
39
42
  client.delete_app_info_localization(app_info_localization_id: id)
43
+ rescue
44
+ raise Spaceship::AppStoreLocalizationError, @locale
40
45
  end
41
46
  end
42
47
  end
@@ -17,6 +17,7 @@ module Spaceship
17
17
  APP_IPHONE_55 = "APP_IPHONE_55"
18
18
  APP_IPHONE_58 = "APP_IPHONE_58"
19
19
  APP_IPHONE_65 = "APP_IPHONE_65"
20
+ APP_IPHONE_67 = "APP_IPHONE_67"
20
21
 
21
22
  APP_IPAD_97 = "APP_IPAD_97"
22
23
  APP_IPAD_105 = "APP_IPAD_105"
@@ -29,6 +30,7 @@ module Spaceship
29
30
  IMESSAGE_APP_IPHONE_55 = "IMESSAGE_APP_IPHONE_55"
30
31
  IMESSAGE_APP_IPHONE_58 = "IMESSAGE_APP_IPHONE_58"
31
32
  IMESSAGE_APP_IPHONE_65 = "IMESSAGE_APP_IPHONE_65"
33
+ IMESSAGE_APP_IPHONE_67 = "IMESSAGE_APP_IPHONE_67"
32
34
 
33
35
  IMESSAGE_APP_IPAD_97 = "IMESSAGE_APP_IPAD_97"
34
36
  IMESSAGE_APP_IPAD_105 = "IMESSAGE_APP_IPAD_105"
@@ -50,6 +52,7 @@ module Spaceship
50
52
  IMESSAGE_APP_IPHONE_55,
51
53
  IMESSAGE_APP_IPHONE_58,
52
54
  IMESSAGE_APP_IPHONE_65,
55
+ IMESSAGE_APP_IPHONE_67,
53
56
 
54
57
  IMESSAGE_APP_IPAD_97,
55
58
  IMESSAGE_APP_IPAD_105,
@@ -65,6 +68,7 @@ module Spaceship
65
68
  APP_IPHONE_55,
66
69
  APP_IPHONE_58,
67
70
  APP_IPHONE_65,
71
+ APP_IPHONE_67,
68
72
 
69
73
  APP_IPAD_97,
70
74
  APP_IPAD_105,
@@ -77,6 +81,7 @@ module Spaceship
77
81
  IMESSAGE_APP_IPHONE_55,
78
82
  IMESSAGE_APP_IPHONE_58,
79
83
  IMESSAGE_APP_IPHONE_65,
84
+ IMESSAGE_APP_IPHONE_67,
80
85
 
81
86
  IMESSAGE_APP_IPAD_97,
82
87
  IMESSAGE_APP_IPAD_105,
@@ -112,7 +112,7 @@ module Spaceship
112
112
 
113
113
  # @deprecated
114
114
  def fetch_age_rating_declaration(client: nil)
115
- raise 'AppStoreVersion no longer as AgeRatingDeclaration as of App Store Connect API 1.3 - Use AppInfo instead'
115
+ raise 'AppStoreVersion no longer has AgeRatingDeclaration as of App Store Connect API 1.3 - Use AppInfo instead'
116
116
  end
117
117
 
118
118
  #
@@ -1,6 +1,7 @@
1
1
  require_relative '../model'
2
2
  require_relative './app_preview_set'
3
3
  require_relative './app_screenshot_set'
4
+ require_relative '../../errors'
4
5
 
5
6
  module Spaceship
6
7
  class ConnectAPI
@@ -19,16 +20,16 @@ module Spaceship
19
20
  attr_accessor :app_preview_sets
20
21
 
21
22
  attr_mapping({
22
- "description" => "description",
23
- "locale" => "locale",
24
- "keywords" => "keywords",
25
- "marketingUrl" => "marketing_url",
26
- "promotionalText" => "promotional_text",
27
- "supportUrl" => "support_url",
28
- "whatsNew" => "whats_new",
29
-
30
- "appScreenshotSets" => "app_screenshot_sets",
31
- "appPreviewSets" => "app_preview_sets"
23
+ "description" => "description",
24
+ "locale" => "locale",
25
+ "keywords" => "keywords",
26
+ "marketingUrl" => "marketing_url",
27
+ "promotionalText" => "promotional_text",
28
+ "supportUrl" => "support_url",
29
+ "whatsNew" => "whats_new",
30
+
31
+ "appScreenshotSets" => "app_screenshot_sets",
32
+ "appPreviewSets" => "app_preview_sets"
32
33
  })
33
34
 
34
35
  def self.type
@@ -43,23 +44,31 @@ module Spaceship
43
44
  client ||= Spaceship::ConnectAPI
44
45
  resp = client.get_app_store_version_localization(app_store_version_localization_id: app_store_version_localization_id, filter: filter, includes: includes, limit: limit, sort: sort)
45
46
  return resp.to_models
47
+ rescue
48
+ raise Spaceship::AppStoreLocalizationError, @locale
46
49
  end
47
50
 
48
51
  def self.all(client: nil, app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
49
52
  client ||= Spaceship::ConnectAPI
50
53
  resp = client.get_app_store_version_localizations(app_store_version_id: app_store_version_id, filter: filter, includes: includes, limit: limit, sort: sort)
51
54
  return resp.to_models
55
+ rescue
56
+ raise Spaceship::AppStoreLocalizationError, @locale
52
57
  end
53
58
 
54
59
  def update(client: nil, attributes: nil)
55
60
  client ||= Spaceship::ConnectAPI
56
61
  attributes = reverse_attr_mapping(attributes)
57
62
  client.patch_app_store_version_localization(app_store_version_localization_id: id, attributes: attributes)
63
+ rescue
64
+ raise Spaceship::AppStoreLocalizationError, @locale
58
65
  end
59
66
 
60
67
  def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
61
68
  client ||= Spaceship::ConnectAPI
62
69
  client.delete_app_store_version_localization(app_store_version_localization_id: id)
70
+ rescue
71
+ raise Spaceship::AppStoreLocalizationError, @locale
63
72
  end
64
73
 
65
74
  #
@@ -71,12 +80,16 @@ module Spaceship
71
80
  filter ||= {}
72
81
  filter["appStoreVersionLocalization"] = id
73
82
  return Spaceship::ConnectAPI::AppPreviewSet.all(client: client, filter: filter, includes: includes, limit: limit, sort: sort)
83
+ rescue
84
+ raise Spaceship::AppStoreAppPreviewError, @locale
74
85
  end
75
86
 
76
87
  def create_app_preview_set(client: nil, attributes: nil)
77
88
  client ||= Spaceship::ConnectAPI
78
89
  resp = client.post_app_preview_set(app_store_version_localization_id: id, attributes: attributes)
79
90
  return resp.to_models.first
91
+ rescue
92
+ raise Spaceship::AppStoreAppPreviewError, @locale
80
93
  end
81
94
 
82
95
  #
@@ -86,12 +99,16 @@ module Spaceship
86
99
  def get_app_screenshot_sets(client: nil, filter: {}, includes: "appScreenshots", limit: nil, sort: nil)
87
100
  client ||= Spaceship::ConnectAPI
88
101
  return Spaceship::ConnectAPI::AppScreenshotSet.all(client: client, app_store_version_localization_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
102
+ rescue
103
+ raise Spaceship::AppStoreScreenshotError, @locale
89
104
  end
90
105
 
91
106
  def create_app_screenshot_set(client: nil, attributes: nil)
92
107
  client ||= Spaceship::ConnectAPI
93
108
  resp = client.post_app_screenshot_set(app_store_version_localization_id: id, attributes: attributes)
94
109
  return resp.to_models.first
110
+ rescue
111
+ raise Spaceship::AppStoreScreenshotError, @locale
95
112
  end
96
113
  end
97
114
  end
@@ -1,4 +1,5 @@
1
1
  require_relative '../model'
2
+ require_relative './build_bundle_file_sizes'
2
3
  module Spaceship
3
4
  class ConnectAPI
4
5
  class BuildBundle
@@ -54,6 +55,14 @@ module Spaceship
54
55
  def self.type
55
56
  return "buildBundles"
56
57
  end
58
+
59
+ #
60
+ # API
61
+ #
62
+
63
+ def build_bundle_file_sizes(client: nil)
64
+ @build_bundle_file_sizes ||= BuildBundleFileSizes.all(client: client, build_bundle_id: id)
65
+ end
57
66
  end
58
67
  end
59
68
  end
@@ -0,0 +1,34 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class BuildBundleFileSizes
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :device_model
8
+ attr_accessor :os_version
9
+ attr_accessor :download_bytes
10
+ attr_accessor :install_bytes
11
+
12
+ attr_mapping({
13
+ "deviceModel" => "device_model",
14
+ "osVersion" => "os_version",
15
+ "downloadBytes" => "download_bytes",
16
+ "installBytes" => "install_bytes"
17
+ })
18
+
19
+ def self.type
20
+ return "buildBundleFileSizes"
21
+ end
22
+
23
+ #
24
+ # API
25
+ #
26
+
27
+ def self.all(client: nil, build_bundle_id: nil, limit: 30)
28
+ client ||= Spaceship::ConnectAPI
29
+ resps = client.get_build_bundles_build_bundle_file_sizes(build_bundle_id: build_bundle_id).all_pages
30
+ resps.flat_map(&:to_models)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -27,7 +27,8 @@ module Spaceship
27
27
  def self.all(client: nil, app_id: nil, version: nil, build_number: nil)
28
28
  client ||= Spaceship::ConnectAPI
29
29
  resps = client.get_build_deliveries(
30
- filter: { app: app_id, cfBundleShortVersionString: version, cfBundleVersion: build_number },
30
+ app_id: app_id,
31
+ filter: { cfBundleShortVersionString: version, cfBundleVersion: build_number },
31
32
  limit: 1
32
33
  ).all_pages
33
34
  return resps.flat_map(&:to_models)
@@ -41,6 +41,7 @@ module Spaceship
41
41
  MAC_APP_DEVELOPMENT = "MAC_APP_DEVELOPMENT"
42
42
  DEVELOPER_ID_KEXT = "DEVELOPER_ID_KEXT"
43
43
  DEVELOPER_ID_APPLICATION = "DEVELOPER_ID_APPLICATION"
44
+ DEVELOPER_ID_APPLICATION_G2 = "DEVELOPER_ID_APPLICATION_G2"
44
45
 
45
46
  # As of 2021-11-09, this is only available with Apple ID auth
46
47
  DEVELOPER_ID_INSTALLER = "DEVELOPER_ID_INSTALLER"