fastlane 2.164.0 → 2.169.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -80
  3. data/cert/lib/cert/.options.rb.swp +0 -0
  4. data/cert/lib/cert/.runner.rb.swp +0 -0
  5. data/cert/lib/cert/options.rb +3 -3
  6. data/cert/lib/cert/runner.rb +2 -2
  7. data/deliver/lib/deliver/app_screenshot.rb +6 -2
  8. data/deliver/lib/deliver/loader.rb +136 -18
  9. data/deliver/lib/deliver/upload_metadata.rb +4 -10
  10. data/deliver/lib/deliver/upload_screenshots.rb +1 -64
  11. data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
  12. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/add_git_tag.rb +9 -2
  14. data/fastlane/lib/fastlane/actions/appledoc.rb +1 -1
  15. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +4 -0
  16. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  17. data/fastlane/lib/fastlane/actions/slather.rb +2 -2
  18. data/fastlane/lib/fastlane/actions/spm.rb +6 -0
  19. data/fastlane/lib/fastlane/actions/update_fastlane.rb +29 -8
  20. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -3
  21. data/fastlane/lib/fastlane/actions/xcode_install.rb +8 -5
  22. data/fastlane/lib/fastlane/cli_tools_distributor.rb +2 -2
  23. data/fastlane/lib/fastlane/features.rb +1 -1
  24. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -0
  25. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  26. data/fastlane/lib/fastlane/version.rb +1 -1
  27. data/fastlane/swift/Deliverfile.swift +1 -1
  28. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  29. data/fastlane/swift/Fastfile.swift +1 -1
  30. data/fastlane/swift/Fastlane.swift +56 -26
  31. data/fastlane/swift/Gymfile.swift +1 -1
  32. data/fastlane/swift/GymfileProtocol.swift +5 -1
  33. data/fastlane/swift/LaneFileProtocol.swift +2 -2
  34. data/fastlane/swift/MainProcess.swift +2 -0
  35. data/fastlane/swift/Matchfile.swift +1 -1
  36. data/fastlane/swift/MatchfileProtocol.swift +4 -4
  37. data/fastlane/swift/Precheckfile.swift +1 -1
  38. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  39. data/fastlane/swift/Runner.swift +1 -1
  40. data/fastlane/swift/Scanfile.swift +1 -1
  41. data/fastlane/swift/ScanfileProtocol.swift +9 -1
  42. data/fastlane/swift/Screengrabfile.swift +1 -1
  43. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  44. data/fastlane/swift/Snapshotfile.swift +1 -1
  45. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  46. data/fastlane/swift/SocketClient.swift +1 -1
  47. data/fastlane_core/lib/fastlane_core/cert_checker.rb +12 -7
  48. data/fastlane_core/lib/fastlane_core/helper.rb +10 -2
  49. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -3
  50. data/fastlane_core/lib/fastlane_core/provisioning_profile.rb +3 -1
  51. data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +8 -0
  52. data/gym/lib/gym/code_signing_mapping.rb +1 -1
  53. data/gym/lib/gym/generators/build_command_generator.rb +1 -0
  54. data/gym/lib/gym/options.rb +7 -1
  55. data/match/lib/match/.options.rb.swp +0 -0
  56. data/match/lib/match/module.rb +1 -1
  57. data/match/lib/match/nuke.rb +9 -5
  58. data/match/lib/match/options.rb +2 -2
  59. data/pilot/lib/pilot/build_manager.rb +9 -3
  60. data/scan/lib/scan/detect_values.rb +3 -1
  61. data/scan/lib/scan/module.rb +4 -0
  62. data/scan/lib/scan/options.rb +16 -1
  63. data/scan/lib/scan/runner.rb +2 -2
  64. data/scan/lib/scan/test_command_generator.rb +1 -0
  65. data/{match/lib/match/.commands_generator.rb.swp → sigh/lib/sigh/.options.rb.swp} +0 -0
  66. data/sigh/lib/sigh/runner.rb +2 -2
  67. data/snapshot/lib/assets/SnapshotHelper.swift +5 -1
  68. data/snapshot/lib/snapshot/test_command_generator.rb +1 -1
  69. data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
  70. data/snapshot/lib/snapshot/test_command_generator_xcode_8.rb +1 -1
  71. data/spaceship/lib/spaceship/client.rb +14 -0
  72. data/spaceship/lib/spaceship/connect_api.rb +2 -0
  73. data/spaceship/lib/spaceship/connect_api/client.rb +7 -4
  74. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +3 -2
  75. data/spaceship/lib/spaceship/connect_api/models/app.rb +139 -54
  76. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +16 -10
  77. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +8 -4
  78. data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +15 -11
  79. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +13 -9
  80. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +9 -7
  81. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +15 -11
  82. data/spaceship/lib/spaceship/connect_api/models/app_store_review_attachment.rb +7 -5
  83. data/spaceship/lib/spaceship/connect_api/models/app_store_review_detail.rb +6 -4
  84. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +55 -36
  85. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +21 -14
  86. data/spaceship/lib/spaceship/connect_api/models/app_store_version_submission.rb +3 -2
  87. data/spaceship/lib/spaceship/connect_api/models/beta_app_review_submission.rb +3 -2
  88. data/spaceship/lib/spaceship/connect_api/models/beta_feedback.rb +6 -4
  89. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +12 -2
  90. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +12 -8
  91. data/spaceship/lib/spaceship/connect_api/models/build.rb +24 -16
  92. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +3 -2
  93. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +9 -6
  94. data/spaceship/lib/spaceship/connect_api/models/bundle_id_capability.rb +6 -4
  95. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +12 -8
  96. data/spaceship/lib/spaceship/connect_api/models/custom_app_organization.rb +43 -0
  97. data/spaceship/lib/spaceship/connect_api/models/custom_app_user.rb +41 -0
  98. data/spaceship/lib/spaceship/connect_api/models/device.rb +6 -4
  99. data/spaceship/lib/spaceship/connect_api/models/idfa_declaration.rb +6 -4
  100. data/spaceship/lib/spaceship/connect_api/models/profile.rb +12 -8
  101. data/spaceship/lib/spaceship/connect_api/models/reset_ratings_request.rb +3 -2
  102. data/spaceship/lib/spaceship/connect_api/models/sandbox_tester.rb +9 -6
  103. data/spaceship/lib/spaceship/connect_api/models/territory.rb +3 -2
  104. data/spaceship/lib/spaceship/connect_api/models/user.rb +6 -4
  105. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +9 -6
  106. data/spaceship/lib/spaceship/connect_api/spaceship.rb +7 -4
  107. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
  108. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +71 -0
  109. data/spaceship/lib/spaceship/errors.rb +19 -0
  110. data/spaceship/lib/spaceship/tunes/iap_detail.rb +1 -1
  111. data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
  112. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +18 -6
  113. data/supply/lib/supply.rb +1 -1
  114. data/supply/lib/supply/options.rb +1 -1
  115. data/supply/lib/supply/uploader.rb +3 -2
  116. metadata +26 -22
  117. data/match/lib/match/.importer.rb.swp +0 -0
@@ -28,13 +28,15 @@ module Spaceship
28
28
  # API
29
29
  #
30
30
 
31
- def update(attributes: nil)
31
+ def update(client: nil, attributes: nil)
32
+ client ||= Spaceship::ConnectAPI
32
33
  attributes = reverse_attr_mapping(attributes)
33
- Spaceship::ConnectAPI.patch_idfa_declaration(idfa_declaration_id: id, attributes: attributes)
34
+ client.patch_idfa_declaration(idfa_declaration_id: id, attributes: attributes)
34
35
  end
35
36
 
36
- def delete!
37
- Spaceship::ConnectAPI.delete_idfa_declaration(idfa_declaration_id: id)
37
+ def delete!(client: nil)
38
+ client ||= Spaceship::ConnectAPI
39
+ client.delete_idfa_declaration(idfa_declaration_id: id)
38
40
  end
39
41
  end
40
42
  end
@@ -65,13 +65,15 @@ module Spaceship
65
65
  # API
66
66
  #
67
67
 
68
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
69
- resps = Spaceship::ConnectAPI.get_profiles(filter: filter, includes: includes).all_pages
68
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
69
+ client ||= Spaceship::ConnectAPI
70
+ resps = client.get_profiles(filter: filter, includes: includes).all_pages
70
71
  return resps.flat_map(&:to_models)
71
72
  end
72
73
 
73
- def self.create(name: nil, profile_type: nil, bundle_id_id: nil, certificate_ids: nil, device_ids: nil, template_name: nil)
74
- resp = Spaceship::ConnectAPI.post_profiles(
74
+ def self.create(client: nil, name: nil, profile_type: nil, bundle_id_id: nil, certificate_ids: nil, device_ids: nil, template_name: nil)
75
+ client ||= Spaceship::ConnectAPI
76
+ resp = client.post_profiles(
75
77
  bundle_id_id: bundle_id_id,
76
78
  certificates: certificate_ids,
77
79
  devices: device_ids,
@@ -84,13 +86,15 @@ module Spaceship
84
86
  return resp.to_models.first
85
87
  end
86
88
 
87
- def fetch_all_devices(filter: {}, includes: nil, sort: nil)
88
- resps = Spaceship::ConnectAPI.get_devices(profile_id: id, filter: filter, includes: includes).all_pages
89
+ def fetch_all_devices(client: nil, filter: {}, includes: nil, sort: nil)
90
+ client ||= Spaceship::ConnectAPI
91
+ resps = client.get_devices(profile_id: id, filter: filter, includes: includes).all_pages
89
92
  return resps.flat_map(&:to_models)
90
93
  end
91
94
 
92
- def delete!
93
- return Spaceship::ConnectAPI.delete_profile(profile_id: id)
95
+ def delete!(client: nil)
96
+ client ||= Spaceship::ConnectAPI
97
+ return client.delete_profile(profile_id: id)
94
98
  end
95
99
  end
96
100
  end
@@ -18,8 +18,9 @@ module Spaceship
18
18
  # API
19
19
  #
20
20
 
21
- def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
22
- Spaceship::ConnectAPI.delete_reset_ratings_request(reset_ratings_request_id: id)
21
+ def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
22
+ client ||= Spaceship::ConnectAPI
23
+ client.delete_reset_ratings_request(reset_ratings_request_id: id)
23
24
  end
24
25
  end
25
26
  end
@@ -36,12 +36,14 @@ module Spaceship
36
36
  # API
37
37
  #
38
38
 
39
- def self.all(filter: {}, includes: nil, limit: 2000, sort: nil)
40
- resps = Spaceship::ConnectAPI.get_sandbox_testers(filter: filter, includes: includes).all_pages
39
+ def self.all(client: nil, filter: {}, includes: nil, limit: 2000, sort: nil)
40
+ client ||= Spaceship::ConnectAPI
41
+ resps = client.get_sandbox_testers(filter: filter, includes: includes).all_pages
41
42
  return resps.flat_map(&:to_models)
42
43
  end
43
44
 
44
- def self.create(first_name: nil, last_name: nil, email: nil, password: nil, confirm_password: nil, secret_question: nil, secret_answer: nil, birth_date: nil, app_store_territory: nil)
45
+ def self.create(client: nil, first_name: nil, last_name: nil, email: nil, password: nil, confirm_password: nil, secret_question: nil, secret_answer: nil, birth_date: nil, app_store_territory: nil)
46
+ client ||= Spaceship::ConnectAPI
45
47
  attributes = {
46
48
  firstName: first_name,
47
49
  lastName: last_name,
@@ -53,11 +55,12 @@ module Spaceship
53
55
  birthDate: birth_date,
54
56
  appStoreTerritory: app_store_territory
55
57
  }
56
- return Spaceship::ConnectAPI.post_sandbox_tester(attributes: attributes).first
58
+ return client.post_sandbox_tester(attributes: attributes).first
57
59
  end
58
60
 
59
- def delete!
60
- Spaceship::ConnectAPI.delete_sandbox_tester(sandbox_tester_id: id)
61
+ def delete!(client: nil)
62
+ client ||= Spaceship::ConnectAPI
63
+ client.delete_sandbox_tester(sandbox_tester_id: id)
61
64
  end
62
65
  end
63
66
  end
@@ -18,8 +18,9 @@ module Spaceship
18
18
  # API
19
19
  #
20
20
 
21
- def self.all(filter: {}, includes: nil, limit: 180, sort: nil)
22
- resps = Spaceship::ConnectAPI.get_territories(filter: {}, includes: nil, limit: nil, sort: nil).all_pages
21
+ def self.all(client: nil, filter: {}, includes: nil, limit: 180, sort: nil)
22
+ client ||= Spaceship::ConnectAPI
23
+ resps = client.get_territories(filter: {}, includes: nil, limit: nil, sort: nil).all_pages
23
24
  return resps.flat_map(&:to_models)
24
25
  end
25
26
  end
@@ -38,13 +38,15 @@ module Spaceship
38
38
  # API
39
39
  #
40
40
 
41
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
42
- resps = Spaceship::ConnectAPI.get_users(filter: filter, includes: includes).all_pages
41
+ def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
42
+ client ||= Spaceship::ConnectAPI
43
+ resps = client.get_users(filter: filter, includes: includes).all_pages
43
44
  return resps.flat_map(&:to_models)
44
45
  end
45
46
 
46
- def self.find(email: nil, includes: nil)
47
- return all(filter: { email: email }, includes: includes)
47
+ def self.find(client: nil, email: nil, includes: nil)
48
+ client ||= Spaceship::ConnectAPI
49
+ return all(client: client, filter: { email: email }, includes: includes)
48
50
  end
49
51
  end
50
52
  end
@@ -42,17 +42,20 @@ module Spaceship
42
42
  # Managing invitations
43
43
  #
44
44
 
45
- def self.all(filter: {}, includes: nil, sort: nil)
46
- resps = Spaceship::ConnectAPI.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
45
+ def self.all(client: nil, filter: {}, includes: nil, sort: nil)
46
+ client ||= Spaceship::ConnectAPI
47
+ resps = client.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
47
48
  return resps.flat_map(&:to_models)
48
49
  end
49
50
 
50
- def self.find(email: nil, includes: nil)
51
- return all(filter: { email: email }, includes: includes)
51
+ def self.find(client: nil, email: nil, includes: nil)
52
+ client ||= Spaceship::ConnectAPI
53
+ return all(client: client, filter: { email: email }, includes: includes)
52
54
  end
53
55
 
54
- def delete!
55
- Spaceship::ConnectAPI.delete_user_invitation(user_invitation_id: id)
56
+ def delete!(client: nil)
57
+ client ||= Spaceship::ConnectAPI
58
+ client.delete_user_invitation(user_invitation_id: id)
56
59
  end
57
60
  end
58
61
  end
@@ -44,20 +44,23 @@ module Spaceship
44
44
 
45
45
  # Initializes client with Apple's App Store Connect JWT auth key.
46
46
  #
47
- # This method will automatically use the key id, issuer id, and filepath from environment
47
+ # This method will automatically use the arguments from environment
48
48
  # variables if not given.
49
49
  #
50
- # All three parameters are needed to authenticate.
50
+ # The key_id, issuer_id and either filepath or key are needed to authenticate.
51
51
  #
52
52
  # @param key_id (String) (optional): The key id
53
53
  # @param issuer_id (String) (optional): The issuer id
54
54
  # @param filepath (String) (optional): The filepath
55
+ # @param key (String) (optional): The key
56
+ # @param duration (Integer) (optional): How long this session should last
57
+ # @param in_house (Boolean) (optional): Whether this session is an Enterprise one
55
58
  #
56
59
  # @raise InvalidUserCredentialsError: raised if authentication failed
57
60
  #
58
61
  # @return (Spaceship::ConnectAPI::Client) The client the login method was called for
59
- def auth(key_id: nil, issuer_id: nil, filepath: nil)
60
- @client = ConnectAPI::Client.auth(key_id: key_id, issuer_id: issuer_id, filepath: filepath)
62
+ def auth(key_id: nil, issuer_id: nil, filepath: nil, key: nil, duration: nil, in_house: nil)
63
+ @client = ConnectAPI::Client.auth(key_id: key_id, issuer_id: issuer_id, filepath: filepath, key: key, duration: duration, in_house: in_house)
61
64
  end
62
65
 
63
66
  # Authenticates with Apple's web services. This method has to be called once
@@ -214,6 +214,18 @@ module Spaceship
214
214
  test_flight_request_client.post("betaGroups", body)
215
215
  end
216
216
 
217
+ def delete_beta_group(group_id: nil)
218
+ raise "group_id is nil" if group_id.nil?
219
+
220
+ test_flight_request_client.delete("betaGroups/#{group_id}")
221
+ end
222
+
223
+ def get_builds_for_beta_group(group_id: nil)
224
+ raise "group_id is nil" if group_id.nil?
225
+
226
+ test_flight_request_client.get("betaGroups/#{group_id}/builds")
227
+ end
228
+
217
229
  #
218
230
  # betaTesters
219
231
  #
@@ -890,6 +890,77 @@ module Spaceship
890
890
  tunes_request_client.post("appStoreVersionReleaseRequests", body)
891
891
  end
892
892
 
893
+ #
894
+ # customAppUsers
895
+ #
896
+
897
+ def get_custom_app_users(app_id: nil, filter: nil, includes: nil, limit: nil, sort: nil)
898
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
899
+ tunes_request_client.get("apps/#{app_id}/customAppUsers", params)
900
+ end
901
+
902
+ def post_custom_app_user(app_id: nil, apple_id: nil)
903
+ body = {
904
+ data: {
905
+ type: "customAppUsers",
906
+ attributes: {
907
+ appleId: apple_id
908
+ },
909
+ relationships: {
910
+ app: {
911
+ data: {
912
+ type: "apps",
913
+ id: app_id
914
+ }
915
+ }
916
+ }
917
+ }
918
+ }
919
+
920
+ tunes_request_client.post("customAppUsers", body)
921
+ end
922
+
923
+ def delete_custom_app_user(custom_app_user_id: nil)
924
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
925
+ tunes_request_client.delete("customAppUsers/#{custom_app_user_id}", params)
926
+ end
927
+
928
+ #
929
+ # customOrganizationUsers
930
+ #
931
+
932
+ def get_custom_app_organization(app_id: nil, filter: nil, includes: nil, limit: nil, sort: nil)
933
+ params = tunes_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
934
+ tunes_request_client.get("apps/#{app_id}/customAppOrganizations", params)
935
+ end
936
+
937
+ def post_custom_app_organization(app_id: nil, device_enrollment_program_id: nil, name: nil)
938
+ body = {
939
+ data: {
940
+ type: "customAppOrganizations",
941
+ attributes: {
942
+ deviceEnrollmentProgramId: device_enrollment_program_id,
943
+ name: name
944
+ },
945
+ relationships: {
946
+ app: {
947
+ data: {
948
+ type: "apps",
949
+ id: app_id
950
+ }
951
+ }
952
+ }
953
+ }
954
+ }
955
+
956
+ tunes_request_client.post("customAppOrganizations", body)
957
+ end
958
+
959
+ def delete_custom_app_organization(custom_app_organization_id: nil)
960
+ params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
961
+ tunes_request_client.delete("customAppOrganizations/#{custom_app_organization_id}", params)
962
+ end
963
+
893
964
  #
894
965
  # idfaDeclarations
895
966
  #
@@ -43,6 +43,25 @@ module Spaceship
43
43
  end
44
44
  end
45
45
 
46
+ # Raised when 429 is received from App Store Connect
47
+ class TooManyRequestsError < BasicPreferredInfoError
48
+ attr_reader :retry_after
49
+ attr_reader :rate_limit_user
50
+
51
+ def initialize(resp_hash)
52
+ headers = resp_hash[:response_headers] || {}
53
+ @retry_after = (headers['retry-after'] || 60).to_i
54
+ @rate_limit_user = headers['x-daiquiri-rate-limit-user']
55
+ message = 'Apple 429 detected'
56
+ message += " - #{rate_limit_user}" if rate_limit_user
57
+ super(message)
58
+ end
59
+
60
+ def show_github_issues
61
+ false
62
+ end
63
+ end
64
+
46
65
  class UnexpectedResponse < StandardError
47
66
  attr_reader :error_info
48
67
 
@@ -242,7 +242,7 @@ module Spaceship
242
242
  # @return ([Spaceship::Tunes::PricingInfo]) An array of pricing infos from the same tier
243
243
  def world_wide_pricing_info
244
244
  client
245
- .pricing_tiers
245
+ .pricing_tiers(application.apple_id)
246
246
  .find { |p| p.tier_stem == pricing_intervals.first[:tier].to_s }
247
247
  .pricing_info
248
248
  end
@@ -704,9 +704,9 @@ module Spaceship
704
704
  # ...
705
705
  # }, {
706
706
  # ...
707
- def pricing_tiers
707
+ def pricing_tiers(app_id)
708
708
  @pricing_tiers ||= begin
709
- r = request(:get, 'ra/apps/pricing/matrix')
709
+ r = request(:get, "ra/apps/#{app_id}/iaps/pricing/matrix")
710
710
  data = parse_response(r, 'data')['pricingTiers']
711
711
  data.map { |tier| Spaceship::Tunes::PricingTier.factory(tier) }
712
712
  end
@@ -134,18 +134,20 @@ module Spaceship
134
134
 
135
135
  phone_number = env_2fa_sms_default_phone_number
136
136
  phone_id = phone_id_from_number(response.body["trustedPhoneNumbers"], phone_number)
137
+ push_mode = push_mode_from_masked_number(response.body["trustedPhoneNumbers"], phone_number)
137
138
  # don't request sms if no trusted devices and env default is the only trusted number,
138
139
  # code was automatically sent
139
140
  should_request_code = !sms_automatically_sent(response)
140
141
  code_type = 'phone'
141
- body = request_two_factor_code_from_phone(phone_id, phone_number, code_length, should_request_code)
142
+ body = request_two_factor_code_from_phone(phone_id, phone_number, code_length, push_mode, should_request_code)
142
143
  elsif sms_automatically_sent(response) # sms fallback, code was automatically sent
143
144
  fallback_number = response.body["trustedPhoneNumbers"].first
144
145
  phone_number = fallback_number["numberWithDialCode"]
145
146
  phone_id = fallback_number["id"]
147
+ push_mode = fallback_number['pushMode']
146
148
 
147
149
  code_type = 'phone'
148
- body = request_two_factor_code_from_phone(phone_id, phone_number, code_length, false)
150
+ body = request_two_factor_code_from_phone(phone_id, phone_number, code_length, push_mode, false)
149
151
  elsif sms_fallback(response) # sms fallback but code wasn't sent bec > 1 phone number
150
152
  code_type = 'phone'
151
153
  body = request_two_factor_code_from_phone_choose(response.body["trustedPhoneNumbers"], code_length)
@@ -275,6 +277,15 @@ If it is, please open an issue at https://github.com/fastlane/fastlane/issues/ne
275
277
  end
276
278
  end
277
279
 
280
+ def push_mode_from_masked_number(phone_numbers, masked_number)
281
+ phone_numbers.each do |phone|
282
+ return phone['pushMode'] if phone['numberWithDialCode'] == masked_number
283
+ end
284
+
285
+ # If no pushMode was supplied, assume sms
286
+ return "sms"
287
+ end
288
+
278
289
  def request_two_factor_code_from_phone_choose(phone_numbers, code_length)
279
290
  puts("Please select a trusted phone number to send code to:")
280
291
 
@@ -283,18 +294,19 @@ If it is, please open an issue at https://github.com/fastlane/fastlane/issues/ne
283
294
  end
284
295
  chosen = choose_phone_number(available)
285
296
  phone_id = phone_id_from_masked_number(phone_numbers, chosen)
297
+ push_mode = push_mode_from_masked_number(phone_numbers, chosen)
286
298
 
287
- request_two_factor_code_from_phone(phone_id, chosen, code_length)
299
+ request_two_factor_code_from_phone(phone_id, chosen, code_length, push_mode)
288
300
  end
289
301
 
290
302
  # this is used in two places: after choosing a phone number and when a phone number is set via ENV var
291
- def request_two_factor_code_from_phone(phone_id, phone_number, code_length, should_request_code = true)
303
+ def request_two_factor_code_from_phone(phone_id, phone_number, code_length, push_mode = "sms", should_request_code = true)
292
304
  if should_request_code
293
305
  # Request code
294
306
  r = request(:put) do |req|
295
307
  req.url("https://idmsa.apple.com/appleauth/auth/verify/phone")
296
308
  req.headers['Content-Type'] = 'application/json'
297
- req.body = { "phoneNumber" => { "id" => phone_id }, "mode" => "sms" }.to_json
309
+ req.body = { "phoneNumber" => { "id" => phone_id }, "mode" => push_mode }.to_json
298
310
  update_request_headers(req)
299
311
  end
300
312
 
@@ -307,7 +319,7 @@ If it is, please open an issue at https://github.com/fastlane/fastlane/issues/ne
307
319
 
308
320
  code = ask_for_2fa_code("Please enter the #{code_length} digit code you received at #{phone_number}:")
309
321
 
310
- return { "securityCode" => { "code" => code.to_s }, "phoneNumber" => { "id" => phone_id }, "mode" => "sms" }.to_json
322
+ return { "securityCode" => { "code" => code.to_s }, "phoneNumber" => { "id" => phone_id }, "mode" => push_mode }.to_json
311
323
  end
312
324
 
313
325
  def store_session
@@ -16,7 +16,7 @@ module Supply
16
16
  end
17
17
 
18
18
  AVAILABLE_METADATA_FIELDS = %w(title short_description full_description video)
19
- IMAGES_TYPES = %w(featureGraphic icon promoGraphic tvBanner)
19
+ IMAGES_TYPES = %w(featureGraphic icon tvBanner) # https://developers.google.com/android-publisher/api-ref/rest/v3/AppImageType
20
20
  SCREENSHOT_TYPES = %w(phoneScreenshots sevenInchScreenshots tenInchScreenshots tvScreenshots wearScreenshots)
21
21
 
22
22
  IMAGES_FOLDER_NAME = "images"
@@ -49,7 +49,7 @@ module Supply
49
49
  end),
50
50
  FastlaneCore::ConfigItem.new(key: :rollout,
51
51
  short_option: "-r",
52
- description: "The percentage of the user fraction when uploading to the rollout track",
52
+ description: "The percentage of the user fraction when uploading to the rollout track (setting to 1 will complete the rollout)",
53
53
  optional: true,
54
54
  verify_block: proc do |value|
55
55
  min = 0.0
@@ -192,9 +192,10 @@ module Supply
192
192
  release = releases.first
193
193
  track_to = client.tracks(Supply.config[:track_promote_to]).first
194
194
 
195
- if Supply.config[:rollout]
195
+ rollout = (Supply.config[:rollout] || 0).to_f
196
+ if rollout > 0 && rollout < 1
196
197
  release.status = Supply::ReleaseStatus::IN_PROGRESS
197
- release.user_fraction = Supply.config[:rollout]
198
+ release.user_fraction = rollout
198
199
  else
199
200
  release.status = Supply::ReleaseStatus::COMPLETED
200
201
  release.user_fraction = nil