fastlane 2.130.0 → 2.135.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +64 -64
  3. data/cert/lib/cert/module.rb +2 -0
  4. data/cert/lib/cert/options.rb +6 -0
  5. data/cert/lib/cert/runner.rb +17 -11
  6. data/fastlane/lib/fastlane/action.rb +1 -1
  7. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  8. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +11 -3
  9. data/fastlane/lib/fastlane/actions/carthage.rb +7 -0
  10. data/fastlane/lib/fastlane/actions/cocoapods.rb +24 -2
  11. data/fastlane/lib/fastlane/actions/copy_artifacts.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/deploygate.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  14. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +26 -5
  15. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +26 -2
  16. data/fastlane/lib/fastlane/actions/download_dsyms.rb +34 -6
  17. data/fastlane/lib/fastlane/actions/download_from_play_store.rb +1 -1
  18. data/fastlane/lib/fastlane/actions/ensure_env_vars.rb +58 -0
  19. data/fastlane/lib/fastlane/actions/get_version_number.rb +12 -3
  20. data/fastlane/lib/fastlane/actions/gradle.rb +11 -1
  21. data/fastlane/lib/fastlane/actions/onesignal.rb +59 -29
  22. data/fastlane/lib/fastlane/actions/pod_push.rb +10 -1
  23. data/fastlane/lib/fastlane/actions/register_devices.rb +1 -1
  24. data/fastlane/lib/fastlane/actions/resign.rb +2 -2
  25. data/fastlane/lib/fastlane/actions/sonar.rb +16 -0
  26. data/fastlane/lib/fastlane/actions/testfairy.rb +1 -1
  27. data/fastlane/lib/fastlane/actions/update_fastlane.rb +9 -49
  28. data/fastlane/lib/fastlane/actions/update_keychain_access_groups.rb +94 -0
  29. data/fastlane/lib/fastlane/environment_printer.rb +9 -3
  30. data/fastlane/lib/fastlane/fast_file.rb +10 -4
  31. data/fastlane/lib/fastlane/helper/crashlytics_helper.rb +1 -1
  32. data/fastlane/lib/fastlane/lane_manager.rb +1 -1
  33. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +12 -2
  34. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -0
  35. data/fastlane/lib/fastlane/runner.rb +2 -2
  36. data/fastlane/lib/fastlane/setup/setup_android.rb +1 -1
  37. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +10 -3
  38. data/fastlane/lib/fastlane/swift_fastlane_function.rb +72 -3
  39. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +4 -0
  40. data/fastlane/lib/fastlane/version.rb +1 -1
  41. data/fastlane/swift/Actions.swift +4 -0
  42. data/fastlane/swift/Deliverfile.swift +1 -1
  43. data/fastlane/swift/DeliverfileProtocol.swift +121 -1
  44. data/fastlane/swift/Fastlane.swift +3932 -18
  45. data/fastlane/swift/Gymfile.swift +1 -1
  46. data/fastlane/swift/GymfileProtocol.swift +81 -1
  47. data/fastlane/swift/Matchfile.swift +1 -1
  48. data/fastlane/swift/MatchfileProtocol.swift +65 -1
  49. data/fastlane/swift/Plugins.swift +4 -0
  50. data/fastlane/swift/Precheckfile.swift +1 -1
  51. data/fastlane/swift/PrecheckfileProtocol.swift +15 -2
  52. data/fastlane/swift/Scanfile.swift +1 -1
  53. data/fastlane/swift/ScanfileProtocol.swift +109 -1
  54. data/fastlane/swift/Screengrabfile.swift +1 -1
  55. data/fastlane/swift/ScreengrabfileProtocol.swift +39 -2
  56. data/fastlane/swift/Snapshotfile.swift +1 -1
  57. data/fastlane/swift/SnapshotfileProtocol.swift +71 -1
  58. data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +3 -3
  59. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +1 -1
  60. data/fastlane_core/lib/fastlane_core/device_manager.rb +1 -1
  61. data/fastlane_core/lib/fastlane_core/helper.rb +1 -1
  62. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +1 -3
  63. data/fastlane_core/lib/fastlane_core/swag.rb +1 -1
  64. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +1 -1
  65. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +3 -2
  66. data/frameit/lib/frameit/screenshot.rb +4 -0
  67. data/{pilot/lib/pilot/.manager.rb.swp → gym/lib/gym/.module.rb.swp} +0 -0
  68. data/gym/lib/gym/runner.rb +33 -5
  69. data/match/lib/match/generator.rb +1 -0
  70. data/match/lib/match/importer.rb +2 -2
  71. data/match/lib/match/module.rb +2 -0
  72. data/match/lib/match/nuke.rb +5 -5
  73. data/match/lib/match/options.rb +17 -0
  74. data/match/lib/match/runner.rb +10 -6
  75. data/match/lib/match/storage/git_storage.rb +8 -2
  76. data/match/lib/match/storage/google_cloud_storage.rb +85 -33
  77. data/produce/lib/produce/service.rb +7 -1
  78. data/scan/lib/scan/error_handler.rb +9 -4
  79. data/scan/lib/scan/runner.rb +1 -1
  80. data/sigh/lib/assets/resign.sh +2 -2
  81. data/sigh/lib/sigh/runner.rb +13 -5
  82. data/snapshot/lib/snapshot/options.rb +5 -0
  83. data/snapshot/lib/snapshot/reports_generator.rb +3 -0
  84. data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
  85. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb +2 -2
  86. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +16 -1
  87. data/spaceship/lib/spaceship/client.rb +2 -2
  88. data/spaceship/lib/spaceship/connect_api/models/app.rb +6 -6
  89. data/spaceship/lib/spaceship/connect_api/models/build.rb +3 -3
  90. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +1 -1
  91. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +1 -1
  92. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +1 -1
  93. data/spaceship/lib/spaceship/connect_api/models/device.rb +1 -1
  94. data/spaceship/lib/spaceship/connect_api/models/profile.rb +1 -1
  95. data/spaceship/lib/spaceship/portal/provisioning_profile.rb +1 -1
  96. data/spaceship/lib/spaceship/tunes/app_version.rb +4 -0
  97. data/spaceship/lib/spaceship/tunes/application.rb +4 -0
  98. data/spaceship/lib/spaceship/tunes/iap_family_details.rb +10 -2
  99. data/spaceship/lib/spaceship/tunes/tunes_client.rb +25 -0
  100. data/supply/lib/supply.rb +23 -0
  101. data/{fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp → supply/lib/supply/.client.rb.swp} +0 -0
  102. data/supply/lib/supply/.options.rb.swp +0 -0
  103. data/supply/lib/supply/.uploader.rb.swp +0 -0
  104. data/supply/lib/supply/client.rb +101 -55
  105. data/supply/lib/supply/options.rb +49 -14
  106. data/supply/lib/supply/release_listing.rb +18 -0
  107. data/supply/lib/supply/setup.rb +42 -34
  108. data/supply/lib/supply/uploader.rb +168 -93
  109. metadata +54 -53
  110. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  111. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  112. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  113. data/spaceship/lib/spaceship/connect_api/.DS_Store +0 -0
@@ -619,8 +619,8 @@ module Spaceship
619
619
  def with_retry(tries = 5, &_block)
620
620
  return yield
621
621
  rescue \
622
- Faraday::Error::ConnectionFailed,
623
- Faraday::Error::TimeoutError, # New Faraday version: Faraday::TimeoutError => ex
622
+ Faraday::ConnectionFailed,
623
+ Faraday::TimeoutError,
624
624
  BadGatewayError,
625
625
  AppleTimeoutError,
626
626
  GatewayTimeoutError => ex
@@ -32,7 +32,7 @@ module Spaceship
32
32
 
33
33
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
34
34
  resps = Spaceship::ConnectAPI.get_apps(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
35
- return resps.map(&:to_models).flatten
35
+ return resps.flat_map(&:to_models)
36
36
  end
37
37
 
38
38
  def self.find(bundle_id)
@@ -54,7 +54,7 @@ module Spaceship
54
54
  filter[:apps] = id
55
55
 
56
56
  resps = Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
57
- return resps.map(&:to_models).flatten
57
+ return resps.flat_map(&:to_models)
58
58
  end
59
59
 
60
60
  #
@@ -66,7 +66,7 @@ module Spaceship
66
66
  filter[:app] = id
67
67
 
68
68
  resps = Spaceship::ConnectAPI.get_builds(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
69
- return resps.map(&:to_models).flatten
69
+ return resps.flat_map(&:to_models)
70
70
  end
71
71
 
72
72
  def get_build_deliveries(filter: {}, includes: nil, limit: nil, sort: nil)
@@ -74,7 +74,7 @@ module Spaceship
74
74
  filter[:app] = id
75
75
 
76
76
  resps = Spaceship::ConnectAPI.get_build_deliveries(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
77
- return resps.map(&:to_models).flatten
77
+ return resps.flat_map(&:to_models)
78
78
  end
79
79
 
80
80
  def get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
@@ -82,7 +82,7 @@ module Spaceship
82
82
  filter[:app] = id
83
83
 
84
84
  resps = Spaceship::ConnectAPI.get_beta_app_localizations(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
85
- return resps.map(&:to_models).flatten
85
+ return resps.flat_map(&:to_models)
86
86
  end
87
87
 
88
88
  def get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil)
@@ -90,7 +90,7 @@ module Spaceship
90
90
  filter[:app] = id
91
91
 
92
92
  resps = Spaceship::ConnectAPI.get_beta_groups(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
93
- return resps.map(&:to_models).flatten
93
+ return resps.flat_map(&:to_models)
94
94
  end
95
95
  end
96
96
  end
@@ -109,7 +109,7 @@ module Spaceship
109
109
  sort: sort,
110
110
  limit: limit
111
111
  ).all_pages
112
- models = resps.map(&:to_models).flatten
112
+ models = resps.flat_map(&:to_models)
113
113
 
114
114
  # Filtering after models are fetched since there is no way to do this in a query param filter
115
115
  if platform
@@ -138,7 +138,7 @@ module Spaceship
138
138
  sort: sort,
139
139
  limit: limit
140
140
  ).all_pages
141
- return resps.map(&:to_models).flatten
141
+ return resps.flat_map(&:to_models)
142
142
  end
143
143
 
144
144
  def get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil)
@@ -148,7 +148,7 @@ module Spaceship
148
148
  sort: sort,
149
149
  limit: limit
150
150
  ).all_pages
151
- return resps.map(&:to_models).flatten
151
+ return resps.flat_map(&:to_models)
152
152
  end
153
153
 
154
154
  def post_beta_app_review_submission
@@ -29,7 +29,7 @@ module Spaceship
29
29
  filter: { app: app_id, cfBundleShortVersionString: version, cfBundleVersion: build_number },
30
30
  limit: 1
31
31
  ).all_pages
32
- return resps.map(&:to_models).flatten
32
+ return resps.flat_map(&:to_models)
33
33
  end
34
34
  end
35
35
  end
@@ -35,7 +35,7 @@ module Spaceship
35
35
 
36
36
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
37
37
  resps = Spaceship::ConnectAPI.get_bundle_ids(filter: filter, includes: includes).all_pages
38
- return resps.map(&:to_models).flatten
38
+ return resps.flat_map(&:to_models)
39
39
  end
40
40
 
41
41
  def self.get(bundle_id_id: nil, includes: nil)
@@ -41,7 +41,7 @@ module Spaceship
41
41
 
42
42
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
43
43
  resps = Spaceship::ConnectAPI.get_certificates(filter: filter, includes: includes).all_pages
44
- return resps.map(&:to_models).flatten
44
+ return resps.flat_map(&:to_models)
45
45
  end
46
46
  end
47
47
  end
@@ -46,7 +46,7 @@ module Spaceship
46
46
 
47
47
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
48
48
  resps = Spaceship::ConnectAPI.get_devices(filter: filter, includes: includes).all_pages
49
- return resps.map(&:to_models).flatten
49
+ return resps.flat_map(&:to_models)
50
50
  end
51
51
  end
52
52
  end
@@ -53,7 +53,7 @@ module Spaceship
53
53
 
54
54
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
55
55
  resps = Spaceship::ConnectAPI.get_profiles(filter: filter, includes: includes).all_pages
56
- return resps.map(&:to_models).flatten
56
+ return resps.flat_map(&:to_models)
57
57
  end
58
58
  end
59
59
  end
@@ -457,7 +457,7 @@ module Spaceship
457
457
  devices.map(&:id),
458
458
  mac: mac?,
459
459
  sub_platform: tvos? ? 'tvOS' : nil,
460
- template_name: template_name
460
+ template_name: is_template_profile ? template.purpose_name : nil
461
461
  )
462
462
  end
463
463
 
@@ -192,6 +192,9 @@ module Spaceship
192
192
  # @return (Hash) Represents the trailers of this app version (read-only)
193
193
  attr_reader :trailers
194
194
 
195
+ # @return (Hash) A hash representing all in-app purchases that can get submitted with this version
196
+ attr_reader :in_app_purchases
197
+
195
198
  # @return (Hash) Represents the phased_release hash (read-only)
196
199
  # For now, please use the `toggle_phased_release` method and call `.save!`
197
200
  # as the API will probably change in the future
@@ -233,6 +236,7 @@ module Spaceship
233
236
  'supportsAppleWatch' => :supports_apple_watch,
234
237
  'versionId' => :version_id,
235
238
  'version.value' => :version,
239
+ 'submittableAddOns.value' => :in_app_purchases,
236
240
  'phasedRelease' => :phased_release,
237
241
 
238
242
  # GeoJson
@@ -158,6 +158,10 @@ module Spaceship
158
158
  client.get_resolution_center(apple_id, platform)
159
159
  end
160
160
 
161
+ def reply_resolution_center(app_id, platform, thread_id, version_id, version_number, from, message_body)
162
+ client.post_resolution_center(app_id, platform, thread_id, version_id, version_number, from, message_body)
163
+ end
164
+
161
165
  def ratings(version_id: '', storefront: '')
162
166
  attrs = client.get_ratings(apple_id, platform, version_id, storefront)
163
167
  attrs[:application] = self
@@ -9,12 +9,20 @@ module Spaceship
9
9
  # @return (String) the family name
10
10
  attr_accessor :name
11
11
 
12
- # @return (Intger) the Family Id
12
+ # @return (Intger) the family id
13
13
  attr_accessor :family_id
14
14
 
15
+ # @return (Array) all linked in-app purchases of this family
16
+ attr_accessor :linked_iaps
17
+
18
+ # @return (Intger) amount of linked in-app purchases of this family (read-only)
19
+ attr_accessor :iap_count
20
+
15
21
  attr_mapping({
16
22
  'id' => :family_id,
17
- 'name.value' => :name
23
+ 'name.value' => :name,
24
+ 'activeAddOns' => :linked_iaps,
25
+ 'totalActiveAddOns' => :iap_count
18
26
  })
19
27
 
20
28
  def versions=(value = {})
@@ -352,6 +352,31 @@ module Spaceship
352
352
  parse_response(r, 'data')
353
353
  end
354
354
 
355
+ def post_resolution_center(app_id, platform, thread_id, version_id, version_number, from, message_body)
356
+ r = request(:post) do |req|
357
+ req.url("ra/apps/#{app_id}/platforms/#{platform}/resolutionCenter")
358
+ req.body = {
359
+ appNotes: {
360
+ threads: [{
361
+ id: thread_id,
362
+ versionId: version_id,
363
+ version: version_number,
364
+ messages: [{
365
+ from: from,
366
+ date: DateTime.now.strftime('%Q'),
367
+ body: message_body,
368
+ tokens: []
369
+ }]
370
+ }]
371
+ }
372
+ }.to_json
373
+ req.headers['Content-Type'] = 'application/json'
374
+ end
375
+
376
+ data = parse_response(r, 'data')
377
+ handle_itc_response(data)
378
+ end
379
+
355
380
  def get_ratings(app_id, platform, version_id = '', storefront = '')
356
381
  # if storefront or version_id is empty api fails
357
382
  rating_url = "ra/apps/#{app_id}/platforms/#{platform}/reviews/summary"
@@ -3,6 +3,7 @@ require 'supply/options'
3
3
  require 'supply/client'
4
4
  require 'supply/listing'
5
5
  require 'supply/apk_listing'
6
+ require 'supply/release_listing'
6
7
  require 'supply/uploader'
7
8
  require 'supply/languages'
8
9
 
@@ -23,8 +24,30 @@ module Supply
23
24
 
24
25
  CHANGELOGS_FOLDER_NAME = "changelogs"
25
26
 
27
+ # https://developers.google.com/android-publisher/#publishing
28
+ module Tracks
29
+ PRODUCTION = "production"
30
+ BETA = "beta"
31
+ ALPHA = "alpha"
32
+ INTERNAL = "internal"
33
+
34
+ DEFAULTS = [PRODUCTION, BETA, ALPHA, INTERNAL]
35
+ DEFAULT = PRODUCTION
36
+ end
37
+
38
+ # https://developers.google.com/android-publisher/api-ref/edits/tracks
39
+ module ReleaseStatus
40
+ COMPLETED = "completed"
41
+ DRAFT = "draft"
42
+ HALTED = "halted"
43
+ IN_PROGRESS = "inProgress"
44
+
45
+ ALL = [COMPLETED, DRAFT, HALTED, IN_PROGRESS]
46
+ end
47
+
26
48
  Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
27
49
  UI = FastlaneCore::UI
50
+ Boolean = Fastlane::Boolean
28
51
  ROOT = Pathname.new(File.expand_path('../..', __FILE__))
29
52
  DESCRIPTION = "Command line tool for updating Android apps and their metadata on the Google Play Store".freeze
30
53
  end
@@ -1,6 +1,6 @@
1
1
  require 'googleauth'
2
- require 'google/apis/androidpublisher_v2'
3
- Androidpublisher = Google::Apis::AndroidpublisherV2
2
+ require 'google/apis/androidpublisher_v3'
3
+ AndroidPublisher = Google::Apis::AndroidpublisherV3
4
4
 
5
5
  require 'net/http'
6
6
 
@@ -96,8 +96,8 @@ module Supply
96
96
  end
97
97
 
98
98
  class Client < AbstractGoogleServiceClient
99
- SERVICE = Androidpublisher::AndroidPublisherService
100
- SCOPE = Androidpublisher::AUTH_ANDROIDPUBLISHER
99
+ SERVICE = AndroidPublisher::AndroidPublisherService
100
+ SCOPE = AndroidPublisher::AUTH_ANDROIDPUBLISHER
101
101
 
102
102
  # Editing something
103
103
  # Reference to the entry we're currently editing. Might be nil if don't have one open
@@ -176,7 +176,7 @@ module Supply
176
176
  def listings
177
177
  ensure_active_edit!
178
178
 
179
- result = call_google_api { client.list_listings(current_package_name, current_edit.id) }
179
+ result = call_google_api { client.list_edit_listings(current_package_name, current_edit.id) }
180
180
 
181
181
  return result.listings.map do |row|
182
182
  Listing.new(self, row.language, row)
@@ -188,7 +188,7 @@ module Supply
188
188
  ensure_active_edit!
189
189
 
190
190
  begin
191
- result = client.get_listing(
191
+ result = client.get_edit_listing(
192
192
  current_package_name,
193
193
  current_edit.id,
194
194
  language
@@ -205,7 +205,7 @@ module Supply
205
205
  def apks_version_codes
206
206
  ensure_active_edit!
207
207
 
208
- result = call_google_api { client.list_apks(current_package_name, current_edit.id) }
208
+ result = call_google_api { client.list_edit_apks(current_package_name, current_edit.id) }
209
209
 
210
210
  return Array(result.apks).map(&:version_code)
211
211
  end
@@ -219,23 +219,57 @@ module Supply
219
219
  return Array(result.bundles).map(&:version_code)
220
220
  end
221
221
 
222
- # Get a list of all apk listings (changelogs) - returns the list
223
- def apk_listings(apk_version_code)
222
+ def release_listings(version)
224
223
  ensure_active_edit!
225
224
 
226
- result = call_google_api do
227
- client.list_apk_listings(
228
- current_package_name,
229
- current_edit.id,
230
- apk_version_code
231
- )
225
+ # Verify that tracks have releases
226
+ filtered_tracks = tracks.select { |t| !t.releases.nil? && t.releases.any? { |r| r.name == version } }
227
+
228
+ if filtered_tracks.length > 1
229
+ # Production track takes precedence if version is present in multiple tracks
230
+ # E.g.: A release might've been promoted from Alpha/Beta track. This means the release will be present in two or more tracks
231
+ if filtered_tracks.any? { |t| t.track == Supply::Tracks::DEFAULT }
232
+ filtered_tracks = filtered_tracks.select { |t| t.track == Supply::Tracks::DEFAULT }
233
+ else
234
+ # E.g.: A release might be in both Alpha & Beta (not sure if this is possible, just catching if it ever happens), giving Beta precedence.
235
+ filtered_tracks = filtered_tracks.select { |t| t.track == Supply::Tracks::BETA }
236
+ end
237
+ end
238
+
239
+ filtered_track = filtered_tracks.first
240
+ if filtered_track.nil?
241
+ UI.user_error!("Unable to find version '#{version}' for '#{current_package_name}' in all tracks. Please double check the version number.")
242
+ return nil
243
+ else
244
+ UI.message("Found '#{version}' in '#{filtered_track.track}' track.")
245
+ end
246
+
247
+ filtered_release = filtered_track.releases.first { |r| r.name == version }
248
+
249
+ # Since we can release on Alpha/Beta without release notes.
250
+ if filtered_release.release_notes.nil?
251
+ UI.user_error!("Version '#{version}' for '#{current_package_name}' does not seem to have any release notes. Nothing to download.")
252
+ return nil
232
253
  end
233
254
 
234
- return (result.listings || []).map do |row|
235
- ApkListing.new(row.recent_changes, row.language, apk_version_code)
255
+ return filtered_release.release_notes.map do |row|
256
+ Supply::ReleaseListing.new(filtered_track, filtered_release.name, filtered_release.version_codes, row.language, row.text)
236
257
  end
237
258
  end
238
259
 
260
+ def latest_version(track)
261
+ latest_version = tracks.select { |t| t.track == Supply::Tracks::DEFAULT }.map(&:releases).flatten.max_by(&:name)
262
+
263
+ # Check if user specified '--track' option if version information from 'production' track is nil
264
+ if latest_version.nil? && track == Supply::Tracks::DEFAULT
265
+ UI.user_error!(%(Unable to find latest version information from "#{Supply::Tracks::DEFAULT}" track. Please specify track information by using the '--track' option.))
266
+ else
267
+ latest_version = tracks.select { |t| t.track == track }.map(&:releases).flatten.max_by(&:name)
268
+ end
269
+
270
+ return latest_version
271
+ end
272
+
239
273
  #####################################################
240
274
  # @!group Modifying data
241
275
  #####################################################
@@ -244,7 +278,7 @@ module Supply
244
278
  def update_listing_for_language(language: nil, title: nil, short_description: nil, full_description: nil, video: nil)
245
279
  ensure_active_edit!
246
280
 
247
- listing = Androidpublisher::Listing.new({
281
+ listing = AndroidPublisher::Listing.new({
248
282
  language: language,
249
283
  title: title,
250
284
  full_description: full_description,
@@ -253,7 +287,7 @@ module Supply
253
287
  })
254
288
 
255
289
  call_google_api do
256
- client.update_listing(
290
+ client.update_edit_listing(
257
291
  current_package_name,
258
292
  current_edit.id,
259
293
  language,
@@ -266,7 +300,7 @@ module Supply
266
300
  ensure_active_edit!
267
301
 
268
302
  result_upload = call_google_api do
269
- client.upload_apk(
303
+ client.upload_edit_apk(
270
304
  current_package_name,
271
305
  current_edit.id,
272
306
  upload_source: path_to_apk
@@ -306,29 +340,28 @@ module Supply
306
340
  return result_upload.version_code
307
341
  end
308
342
 
309
- # Updates the track for the provided version code(s)
310
- def update_track(track, rollout, apk_version_code)
343
+ # Get a list of all tracks - returns the list
344
+ def tracks(*tracknames)
311
345
  ensure_active_edit!
312
346
 
313
- track_version_codes = apk_version_code.kind_of?(Array) ? apk_version_code : [apk_version_code]
347
+ all_tracks = call_google_api { client.list_edit_tracks(current_package_name, current_edit.id) }.tracks
348
+
349
+ if tracknames.length > 0
350
+ all_tracks = all_tracks.select { |track| tracknames.include?(track.track) }
351
+ end
314
352
 
315
- # This change happened on 2018-04-24
316
- # rollout cannot be sent on any other track besides "rollout"
317
- # https://github.com/fastlane/fastlane/issues/12372
318
- rollout = nil unless track == "rollout"
353
+ return all_tracks
354
+ end
319
355
 
320
- track_body = Androidpublisher::Track.new({
321
- track: track,
322
- user_fraction: rollout,
323
- version_codes: track_version_codes
324
- })
356
+ def update_track(track_name, track_object)
357
+ ensure_active_edit!
325
358
 
326
359
  call_google_api do
327
- client.update_track(
360
+ client.update_edit_track(
328
361
  current_package_name,
329
362
  current_edit.id,
330
- track,
331
- track_body
363
+ track_name,
364
+ track_object
332
365
  )
333
366
  end
334
367
  end
@@ -338,33 +371,27 @@ module Supply
338
371
  ensure_active_edit!
339
372
 
340
373
  begin
341
- result = client.get_track(
374
+ result = client.get_edit_track(
342
375
  current_package_name,
343
376
  current_edit.id,
344
377
  track
345
378
  )
346
- return result.version_codes || []
379
+ return result.releases.flat_map(&:version_codes) || []
347
380
  rescue Google::Apis::ClientError => e
348
381
  return [] if e.status_code == 404 && e.to_s.include?("trackEmpty")
349
382
  raise
350
383
  end
351
384
  end
352
385
 
353
- def update_apk_listing_for_language(apk_listing)
386
+ def upload_changelogs(track, track_name)
354
387
  ensure_active_edit!
355
388
 
356
- apk_listing_object = Androidpublisher::ApkListing.new({
357
- language: apk_listing.language,
358
- recent_changes: apk_listing.recent_changes
359
- })
360
-
361
389
  call_google_api do
362
- client.update_apk_listing(
390
+ client.update_edit_track(
363
391
  current_package_name,
364
- current_edit.id,
365
- apk_listing.apk_version_code,
366
- apk_listing.language,
367
- apk_listing_object
392
+ self.current_edit.id,
393
+ track_name,
394
+ track
368
395
  )
369
396
  end
370
397
  end
@@ -373,12 +400,12 @@ module Supply
373
400
  ensure_active_edit!
374
401
 
375
402
  call_google_api do
376
- client.update_expansion_file(
403
+ client.update_edit_expansionfile(
377
404
  current_package_name,
378
405
  current_edit.id,
379
406
  apk_version_code,
380
407
  expansion_file_type,
381
- Google::Apis::AndroidpublisherV2::ExpansionFile.new(
408
+ AndroidPublisher::ExpansionFile.new(
382
409
  references_version: references_version,
383
410
  file_size: file_size
384
411
  )
@@ -394,7 +421,7 @@ module Supply
394
421
  ensure_active_edit!
395
422
 
396
423
  result = call_google_api do
397
- client.list_images(
424
+ client.list_edit_images(
398
425
  current_package_name,
399
426
  current_edit.id,
400
427
  language,
@@ -402,7 +429,26 @@ module Supply
402
429
  )
403
430
  end
404
431
 
405
- (result.images || []).map(&:url)
432
+ urls = (result.images || []).map(&:url)
433
+ images = urls.map do |url|
434
+ uri = URI.parse(url)
435
+ clean_url = [
436
+ uri.scheme,
437
+ uri.userinfo,
438
+ uri.host,
439
+ uri.port,
440
+ uri.path
441
+ ].join
442
+
443
+ UI.verbose("Initial URL received: '#{url}'")
444
+ UI.verbose("Removed params ('#{uri.query}') from the URL")
445
+ UI.verbose("URL after removing params: '#{clean_url}'")
446
+
447
+ full_url = "#{url}=s0" # '=s0' param ensures full image size is returned (https://github.com/fastlane/fastlane/pull/14322#issuecomment-473012462)
448
+ full_url
449
+ end
450
+
451
+ return images
406
452
  end
407
453
 
408
454
  # @param image_type (e.g. phoneScreenshots, sevenInchScreenshots, ...)
@@ -410,7 +456,7 @@ module Supply
410
456
  ensure_active_edit!
411
457
 
412
458
  call_google_api do
413
- client.upload_image(
459
+ client.upload_edit_image(
414
460
  current_package_name,
415
461
  current_edit.id,
416
462
  language,
@@ -425,7 +471,7 @@ module Supply
425
471
  ensure_active_edit!
426
472
 
427
473
  call_google_api do
428
- client.delete_all_images(
474
+ client.deleteall_edit_image(
429
475
  current_package_name,
430
476
  current_edit.id,
431
477
  language,
@@ -438,7 +484,7 @@ module Supply
438
484
  ensure_active_edit!
439
485
 
440
486
  call_google_api do
441
- client.upload_expansion_file(
487
+ client.upload_edit_expansionfile(
442
488
  current_package_name,
443
489
  current_edit.id,
444
490
  apk_version_code,