fastlane 2.150.0.rc3 → 2.150.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/deliver/lib/deliver/upload_screenshots.rb +28 -8
- data/fastlane/lib/fastlane/version.rb +1 -1
- data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +89 -52
- data/spaceship/lib/spaceship/connect_api/file_uploader.rb +42 -10
- data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +1 -1
- data/spaceship/lib/spaceship/connect_api/models/app.rb +8 -3
- data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
- data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +62 -10
- data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +2 -2
- data/spaceship/lib/spaceship/connect_api/models/app_review_attachment.rb +18 -28
- data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +32 -36
- data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +1 -0
- data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f736bd9272a03db4f9c52dcb3f3cbe1cc21b3f78221a8a27849a0801ad791177
|
4
|
+
data.tar.gz: 61ea559625a0a4fd290774205aecfec2754b7f7a6f4264a3775b51145fd6169e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769baf252715d93327440d48a152c53bd5f532741f5d9118e04cc09433b1fcd654d0d68973d8c0376e979fda909f0264e6f9e61e9dd66d4d9dacc5027f4ba87b
|
7
|
+
data.tar.gz: 3ee6471846ffcdd74dc4e953822aed04fd05caf5ad03ee1f242d486a3197c66168fda158b9b417831b3221e8782b039bda4d59016653be9416c977691d24effb
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spaceship/tunes/tunes'
|
2
|
+
require 'digest/md5'
|
2
3
|
|
3
4
|
require_relative 'app_screenshot'
|
4
5
|
require_relative 'module'
|
@@ -91,6 +92,10 @@ module Deliver
|
|
91
92
|
localizations = version.get_app_store_version_localizations
|
92
93
|
end
|
93
94
|
|
95
|
+
upload_screenshots(screenshots_per_language, localizations)
|
96
|
+
end
|
97
|
+
|
98
|
+
def upload_screenshots(screenshots_per_language, localizations)
|
94
99
|
# Upload screenshots
|
95
100
|
indized = {} # per language and device type
|
96
101
|
|
@@ -114,7 +119,13 @@ module Deliver
|
|
114
119
|
app_screenshot_sets_map[app_screenshot_set.screenshot_display_type] = app_screenshot_set
|
115
120
|
|
116
121
|
# Set initial screnshot count
|
117
|
-
indized[localization.locale][app_screenshot_set.screenshot_display_type] ||=
|
122
|
+
indized[localization.locale][app_screenshot_set.screenshot_display_type] ||= {
|
123
|
+
count: app_screenshot_set.app_screenshots.size,
|
124
|
+
checksums: []
|
125
|
+
}
|
126
|
+
|
127
|
+
checksums = app_screenshot_set.app_screenshots.map(&:source_file_checksum).uniq
|
128
|
+
indized[localization.locale][app_screenshot_set.screenshot_display_type][:checksums] = checksums
|
118
129
|
end
|
119
130
|
|
120
131
|
UI.message("Uploading #{screenshots_for_language.length} screenshots for language #{language}")
|
@@ -133,21 +144,30 @@ module Deliver
|
|
133
144
|
})
|
134
145
|
app_screenshot_sets_map[display_type] = set
|
135
146
|
|
136
|
-
indized[localization.locale][set.screenshot_display_type] =
|
147
|
+
indized[localization.locale][set.screenshot_display_type] = {
|
148
|
+
count: 0,
|
149
|
+
checksums: []
|
150
|
+
}
|
137
151
|
end
|
138
152
|
|
139
|
-
index = indized[localization.locale][set.screenshot_display_type]
|
153
|
+
index = indized[localization.locale][set.screenshot_display_type][:count]
|
140
154
|
|
141
155
|
if index >= 10
|
142
|
-
UI.error("Too many screenshots found for device '#{screenshot.
|
156
|
+
UI.error("Too many screenshots found for device '#{screenshot.device_type}' in '#{screenshot.language}', skipping this one (#{screenshot.path})")
|
143
157
|
next
|
144
158
|
end
|
145
159
|
|
146
|
-
|
160
|
+
bytes = File.binread(screenshot.path)
|
161
|
+
checksum = Digest::MD5.hexdigest(bytes)
|
162
|
+
duplicate = indized[localization.locale][set.screenshot_display_type][:checksums].include?(checksum)
|
147
163
|
|
148
|
-
|
149
|
-
|
150
|
-
|
164
|
+
if duplicate
|
165
|
+
UI.message("Previous uploaded. Skipping '#{screenshot.path}'...")
|
166
|
+
else
|
167
|
+
indized[localization.locale][set.screenshot_display_type][:count] += 1
|
168
|
+
UI.message("Uploading '#{screenshot.path}'...")
|
169
|
+
set.upload_screenshot(path: screenshot.path)
|
170
|
+
end
|
151
171
|
end
|
152
172
|
end
|
153
173
|
UI.success("Successfully uploaded screenshots to App Store Connect")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Fastlane
|
2
|
-
VERSION = '2.150.0.
|
2
|
+
VERSION = '2.150.0.rc4'.freeze
|
3
3
|
DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
|
4
4
|
MINIMUM_XCODE_RELEASE = "7.0".freeze
|
5
5
|
RUBOCOP_REQUIREMENT = '0.49.1'.freeze
|
@@ -239,64 +239,101 @@ module FastlaneCore
|
|
239
239
|
# escaping problems in its accompanying shell script.
|
240
240
|
class JavaTransporterExecutor < TransporterExecutor
|
241
241
|
def build_upload_command(username, password, source = "/tmp", provider_short_name = "")
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
242
|
+
if Helper.mac? && Helper.xcode_at_least?(11)
|
243
|
+
[
|
244
|
+
'xcrun iTMSTransporter',
|
245
|
+
'-m upload',
|
246
|
+
"-u #{username.shellescape}",
|
247
|
+
"-p #{password.shellescape}",
|
248
|
+
"-f #{source.shellescape}",
|
249
|
+
additional_upload_parameters, # that's here, because the user might overwrite the -t option
|
250
|
+
'-k 100000',
|
251
|
+
("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
|
252
|
+
'2>&1' # cause stderr to be written to stdout
|
253
|
+
].compact.join(' ') # compact gets rid of the possibly nil ENV value
|
254
|
+
else
|
255
|
+
[
|
256
|
+
Helper.transporter_java_executable_path.shellescape,
|
257
|
+
"-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}",
|
258
|
+
'-XX:NewSize=2m',
|
259
|
+
'-Xms32m',
|
260
|
+
'-Xmx1024m',
|
261
|
+
'-Xms1024m',
|
262
|
+
'-Djava.awt.headless=true',
|
263
|
+
'-Dsun.net.http.retryPost=false',
|
264
|
+
java_code_option,
|
265
|
+
'-m upload',
|
266
|
+
"-u #{username.shellescape}",
|
267
|
+
"-p #{password.shellescape}",
|
268
|
+
"-f #{source.shellescape}",
|
269
|
+
additional_upload_parameters, # that's here, because the user might overwrite the -t option
|
270
|
+
'-k 100000',
|
271
|
+
("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
|
272
|
+
'2>&1' # cause stderr to be written to stdout
|
273
|
+
].compact.join(' ') # compact gets rid of the possibly nil ENV value
|
274
|
+
end
|
261
275
|
end
|
262
276
|
|
263
277
|
def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "")
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
'
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
278
|
+
if Helper.mac? && Helper.xcode_at_least?(11)
|
279
|
+
[
|
280
|
+
'xcrun iTMSTransporter',
|
281
|
+
'-m lookupMetadata',
|
282
|
+
"-u #{username.shellescape}",
|
283
|
+
"-p #{password.shellescape}",
|
284
|
+
"-apple_id #{apple_id.shellescape}",
|
285
|
+
"-destination #{destination.shellescape}",
|
286
|
+
("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
|
287
|
+
'2>&1' # cause stderr to be written to stdout
|
288
|
+
].compact.join(' ')
|
289
|
+
else
|
290
|
+
[
|
291
|
+
Helper.transporter_java_executable_path.shellescape,
|
292
|
+
"-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}",
|
293
|
+
'-XX:NewSize=2m',
|
294
|
+
'-Xms32m',
|
295
|
+
'-Xmx1024m',
|
296
|
+
'-Xms1024m',
|
297
|
+
'-Djava.awt.headless=true',
|
298
|
+
'-Dsun.net.http.retryPost=false',
|
299
|
+
java_code_option,
|
300
|
+
'-m lookupMetadata',
|
301
|
+
"-u #{username.shellescape}",
|
302
|
+
"-p #{password.shellescape}",
|
303
|
+
"-apple_id #{apple_id.shellescape}",
|
304
|
+
"-destination #{destination.shellescape}",
|
305
|
+
("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
|
306
|
+
'2>&1' # cause stderr to be written to stdout
|
307
|
+
].compact.join(' ')
|
308
|
+
end
|
282
309
|
end
|
283
310
|
|
284
311
|
def build_provider_ids_command(username, password)
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
312
|
+
if Helper.mac? && Helper.xcode_at_least?(11)
|
313
|
+
[
|
314
|
+
'xcrun iTMSTransporter',
|
315
|
+
'-m provider',
|
316
|
+
"-u #{username.shellescape}",
|
317
|
+
"-p #{password.shellescape}",
|
318
|
+
'2>&1' # cause stderr to be written to stdout
|
319
|
+
].compact.join(' ')
|
320
|
+
else
|
321
|
+
[
|
322
|
+
Helper.transporter_java_executable_path.shellescape,
|
323
|
+
"-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}",
|
324
|
+
'-XX:NewSize=2m',
|
325
|
+
'-Xms32m',
|
326
|
+
'-Xmx1024m',
|
327
|
+
'-Xms1024m',
|
328
|
+
'-Djava.awt.headless=true',
|
329
|
+
'-Dsun.net.http.retryPost=false',
|
330
|
+
java_code_option,
|
331
|
+
'-m provider',
|
332
|
+
"-u #{username.shellescape}",
|
333
|
+
"-p #{password.shellescape}",
|
334
|
+
'2>&1' # cause stderr to be written to stdout
|
335
|
+
].compact.join(' ')
|
336
|
+
end
|
300
337
|
end
|
301
338
|
|
302
339
|
def java_code_option
|
@@ -2,10 +2,12 @@ require 'faraday' # HTTP Client
|
|
2
2
|
require 'faraday-cookie_jar'
|
3
3
|
require 'faraday_middleware'
|
4
4
|
|
5
|
+
require 'spaceship/globals'
|
6
|
+
|
5
7
|
module Spaceship
|
6
8
|
class ConnectAPI
|
7
9
|
module FileUploader
|
8
|
-
def self.upload(
|
10
|
+
def self.upload(upload_operations, bytes)
|
9
11
|
# {
|
10
12
|
# "method": "PUT",
|
11
13
|
# "url": "https://some-url-apple-gives-us",
|
@@ -19,17 +21,47 @@ module Spaceship
|
|
19
21
|
# ]
|
20
22
|
# }
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
upload_operations.each_with_index do |upload_operation, index|
|
25
|
+
headers = {}
|
26
|
+
upload_operation["requestHeaders"].each do |hash|
|
27
|
+
headers[hash["name"]] = hash["value"]
|
28
|
+
end
|
29
|
+
|
30
|
+
offset = upload_operation["offset"]
|
31
|
+
length = upload_operation["length"]
|
32
|
+
|
33
|
+
puts("Uploading file (part #{index + 1})...") if Spaceship::Globals.verbose?
|
34
|
+
with_retry do
|
35
|
+
client.send(
|
36
|
+
upload_operation["method"].downcase,
|
37
|
+
upload_operation["url"],
|
38
|
+
bytes[offset, length],
|
39
|
+
headers
|
40
|
+
)
|
41
|
+
end
|
25
42
|
end
|
43
|
+
puts("Uploading complete!") if Spaceship::Globals.verbose?
|
44
|
+
end
|
26
45
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
46
|
+
def self.with_retry(tries = 5, &_block)
|
47
|
+
tries = 1 if Object.const_defined?("SpecHelper")
|
48
|
+
response = yield
|
49
|
+
|
50
|
+
tries -= 1
|
51
|
+
|
52
|
+
unless (200...300).cover?(response.status)
|
53
|
+
msg = "Received status of #{response.status}! Retrying after 3 seconds (remaining: #{tries})..."
|
54
|
+
raise msg
|
55
|
+
end
|
56
|
+
|
57
|
+
return response
|
58
|
+
rescue => error
|
59
|
+
puts(error) if Spaceship::Globals.verbose?
|
60
|
+
if tries.zero?
|
61
|
+
raise "Failed to upload file after retries... Received #{response.status}"
|
62
|
+
else
|
63
|
+
retry
|
64
|
+
end
|
33
65
|
end
|
34
66
|
|
35
67
|
def self.client
|
@@ -82,10 +82,13 @@ module Spaceship
|
|
82
82
|
Spaceship::ConnectAPI::AppInfo::AppStoreState::PREPARE_FOR_SUBMISSION,
|
83
83
|
Spaceship::ConnectAPI::AppInfo::AppStoreState::DEVELOPER_REJECTED,
|
84
84
|
Spaceship::ConnectAPI::AppInfo::AppStoreState::REJECTED,
|
85
|
-
Spaceship::ConnectAPI::AppInfo::AppStoreState::METADATA_REJECTED
|
85
|
+
Spaceship::ConnectAPI::AppInfo::AppStoreState::METADATA_REJECTED,
|
86
|
+
Spaceship::ConnectAPI::AppInfo::AppStoreState::WAITING_FOR_REVIEW,
|
87
|
+
Spaceship::ConnectAPI::AppInfo::AppStoreState::INVALID_BINARY
|
86
88
|
]
|
87
89
|
|
88
|
-
|
90
|
+
filter = { app: id }
|
91
|
+
resp = Spaceship::ConnectAPI.get_app_infos(filter: filter)
|
89
92
|
return resp.to_models.select do |model|
|
90
93
|
states.include?(model.app_store_state)
|
91
94
|
end.first
|
@@ -144,7 +147,9 @@ module Spaceship
|
|
144
147
|
Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PREPARE_FOR_SUBMISSION,
|
145
148
|
Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REJECTED,
|
146
149
|
Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::REJECTED,
|
147
|
-
Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::METADATA_REJECTED
|
150
|
+
Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::METADATA_REJECTED,
|
151
|
+
Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::WAITING_FOR_REVIEW,
|
152
|
+
Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::INVALID_BINARY
|
148
153
|
].join(","),
|
149
154
|
platform: platform
|
150
155
|
}
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require_relative '../model'
|
2
2
|
require_relative '../file_uploader'
|
3
|
+
require 'spaceship/globals'
|
4
|
+
|
5
|
+
require 'digest/md5'
|
3
6
|
|
4
7
|
module Spaceship
|
5
8
|
class ConnectAPI
|
@@ -34,39 +37,88 @@ module Spaceship
|
|
34
37
|
return "appPreviews"
|
35
38
|
end
|
36
39
|
|
40
|
+
def complete?
|
41
|
+
(asset_delivery_state || {})["state"] == "COMPLETE"
|
42
|
+
end
|
43
|
+
|
37
44
|
#
|
38
45
|
# API
|
39
46
|
#
|
40
47
|
|
41
|
-
def self.
|
48
|
+
def self.get(app_preview_id: nil)
|
49
|
+
Spaceship::ConnectAPI.get_app_preview(app_preview_id: app_preview_id).first
|
50
|
+
end
|
51
|
+
|
52
|
+
# Creates an AppPreview in an AppPreviewSet
|
53
|
+
# Setting the optional frame_time_code will force polling until video is done processing
|
54
|
+
# @param app_preview_set_id The AppPreviewSet id
|
55
|
+
# @param path The path of the file
|
56
|
+
# @param frame_time_code The time code for the preview still frame (ex: "00:00:07:01")
|
57
|
+
def self.create(app_preview_set_id: nil, path: nil, frame_time_code: nil)
|
42
58
|
require 'faraday'
|
43
59
|
|
44
60
|
filename = File.basename(path)
|
45
61
|
filesize = File.size(path)
|
46
|
-
|
62
|
+
bytes = File.binread(path)
|
47
63
|
|
48
64
|
post_attributes = {
|
49
65
|
fileSize: filesize,
|
50
66
|
fileName: filename
|
51
67
|
}
|
52
68
|
|
53
|
-
|
69
|
+
# Create placeholder
|
70
|
+
preview = Spaceship::ConnectAPI.post_app_preview(
|
54
71
|
app_preview_set_id: app_preview_set_id,
|
55
72
|
attributes: post_attributes
|
56
73
|
).to_models.first
|
57
74
|
|
58
|
-
|
59
|
-
|
75
|
+
# Upload the file
|
76
|
+
upload_operations = preview.upload_operations
|
77
|
+
Spaceship::ConnectAPI::FileUploader.upload(upload_operations, bytes)
|
60
78
|
|
79
|
+
# Update file uploading complete
|
61
80
|
patch_attributes = {
|
62
81
|
uploaded: true,
|
63
|
-
sourceFileChecksum:
|
82
|
+
sourceFileChecksum: Digest::MD5.hexdigest(bytes)
|
64
83
|
}
|
65
84
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
85
|
+
begin
|
86
|
+
preview = Spaceship::ConnectAPI.patch_app_preview(
|
87
|
+
app_preview_id: preview.id,
|
88
|
+
attributes: patch_attributes
|
89
|
+
).to_models.first
|
90
|
+
rescue => error
|
91
|
+
puts("Failed to patch app preview. Update may have gone through so verifying") if Spaceship::Globals.verbose?
|
92
|
+
|
93
|
+
preview = Spaceship::ConnectAPI::AppPreview.get(app_preview_id: preview.id)
|
94
|
+
raise error unless preview.complete?
|
95
|
+
end
|
96
|
+
|
97
|
+
# Poll for video processing completion to set still frame time
|
98
|
+
unless frame_time_code.nil?
|
99
|
+
loop do
|
100
|
+
unless preview.video_url.nil?
|
101
|
+
puts("Preview processing complete!") if Spaceship::Globals.verbose?
|
102
|
+
preview = preview.update(attributes: {
|
103
|
+
previewFrameTimeCode: frame_time_code
|
104
|
+
})
|
105
|
+
puts("Updated preview frame time code!") if Spaceship::Globals.verbose?
|
106
|
+
break
|
107
|
+
end
|
108
|
+
|
109
|
+
sleep_time = 30
|
110
|
+
puts("Waiting #{sleep_time} seconds before checking status of processing...") if Spaceship::Globals.verbose?
|
111
|
+
sleep(sleep_time)
|
112
|
+
|
113
|
+
preview = Spaceship::ConnectAPI::AppPreview.get(app_preview_id: preview.id)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
preview
|
118
|
+
end
|
119
|
+
|
120
|
+
def update(attributes: nil)
|
121
|
+
Spaceship::ConnectAPI.patch_app_preview(app_preview_id: id, attributes: attributes)
|
70
122
|
end
|
71
123
|
|
72
124
|
def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
|
@@ -63,8 +63,8 @@ module Spaceship
|
|
63
63
|
return resp.to_models
|
64
64
|
end
|
65
65
|
|
66
|
-
def upload_preview(path: nil)
|
67
|
-
return Spaceship::ConnectAPI::AppPreview.create(app_preview_set_id: id, path: path)
|
66
|
+
def upload_preview(path: nil, frame_time_code: nil)
|
67
|
+
return Spaceship::ConnectAPI::AppPreview.create(app_preview_set_id: id, path: path, frame_time_code: frame_time_code)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -1,4 +1,7 @@
|
|
1
1
|
require_relative '../model'
|
2
|
+
require_relative '../file_uploader'
|
3
|
+
require 'digest/md5'
|
4
|
+
|
2
5
|
module Spaceship
|
3
6
|
class ConnectAPI
|
4
7
|
class AppReviewAttachment
|
@@ -31,46 +34,33 @@ module Spaceship
|
|
31
34
|
|
32
35
|
filename = File.basename(path)
|
33
36
|
filesize = File.size(path)
|
34
|
-
|
37
|
+
bytes = File.binread(path)
|
35
38
|
|
36
39
|
post_attributes = {
|
37
40
|
fileSize: filesize,
|
38
41
|
fileName: filename
|
39
42
|
}
|
40
43
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
# "length": 57365,
|
47
|
-
# "offset": 0,
|
48
|
-
# "requestHeaders": [
|
49
|
-
# {
|
50
|
-
# "name": "Content-Type",
|
51
|
-
# "value": "image/png"
|
52
|
-
# }
|
53
|
-
# ]
|
54
|
-
# }
|
55
|
-
upload_operation = post_resp.upload_operations.first
|
56
|
-
|
57
|
-
headers = {}
|
58
|
-
upload_operation["requestHeaders"].each do |hash|
|
59
|
-
headers[hash["name"]] = hash["value"]
|
60
|
-
end
|
44
|
+
# Create placeholder
|
45
|
+
attachment = Spaceship::ConnectAPI.post_app_review_attachment(
|
46
|
+
app_store_review_detail_id: app_store_review_detail_id,
|
47
|
+
attributes: post_attributes
|
48
|
+
).to_models.first
|
61
49
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
headers
|
66
|
-
)
|
50
|
+
# Upload the file
|
51
|
+
upload_operations = attachment.upload_operations
|
52
|
+
Spaceship::ConnectAPI::FileUploader.upload(upload_operations, bytes)
|
67
53
|
|
54
|
+
# Update file uploading complete
|
68
55
|
patch_attributes = {
|
69
56
|
uploaded: true,
|
70
|
-
sourceFileChecksum:
|
57
|
+
sourceFileChecksum: Digest::MD5.hexdigest(bytes)
|
71
58
|
}
|
72
59
|
|
73
|
-
Spaceship::ConnectAPI.patch_app_review_attachment(
|
60
|
+
Spaceship::ConnectAPI.patch_app_review_attachment(
|
61
|
+
app_review_attachment_id: attachment.id,
|
62
|
+
attributes: patch_attributes
|
63
|
+
).to_models.first
|
74
64
|
end
|
75
65
|
|
76
66
|
def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require_relative '../model'
|
2
2
|
require_relative '../file_uploader'
|
3
|
+
require 'spaceship/globals'
|
4
|
+
|
5
|
+
require 'digest/md5'
|
3
6
|
|
4
7
|
module Spaceship
|
5
8
|
class ConnectAPI
|
@@ -15,36 +18,6 @@ module Spaceship
|
|
15
18
|
attr_accessor :asset_delivery_state
|
16
19
|
attr_accessor :uploaded
|
17
20
|
|
18
|
-
# "fileSize": 92542,
|
19
|
-
# "fileName": "ftl_3241d62418767c0aa9b889b020c4f8db_45455763d4aaf7b18ee0045bc787f3de.png",
|
20
|
-
# "sourceFileChecksum": "c237fd7852ed8f9285d16d9a28d2ec25",
|
21
|
-
# "imageAsset": {
|
22
|
-
# "templateUrl": "https://is4-ssl.mzstatic.com/image/thumb/Purple113/v4/61/18/68/61186886-b234-5bd0-1f4a-563124f18511/pr_source.png/{w}x{h}bb.{f}",
|
23
|
-
# "width": 2048,
|
24
|
-
# "height": 2732
|
25
|
-
# },
|
26
|
-
# "assetToken": "Purple113/v4/61/18/68/61186886-b234-5bd0-1f4a-563124f18511/pr_source.png",
|
27
|
-
# "assetType": "SortedJ99ScreenShot",
|
28
|
-
# "uploadOperations": null,
|
29
|
-
# "assetDeliveryState": {
|
30
|
-
# "errors": [],
|
31
|
-
# "warnings": null,
|
32
|
-
# "state": "COMPLETE"
|
33
|
-
# },
|
34
|
-
# "uploaded": null
|
35
|
-
|
36
|
-
# "assetDeliveryState": {
|
37
|
-
# "errors": [],
|
38
|
-
# "warnings": null,
|
39
|
-
# "state": "AWAITING_UPLOAD"
|
40
|
-
# },
|
41
|
-
|
42
|
-
# "assetDeliveryState": {
|
43
|
-
# "errors": [],
|
44
|
-
# "warnings": null,
|
45
|
-
# "state": "UPLOAD_COMPLETE"
|
46
|
-
# },
|
47
|
-
|
48
21
|
attr_mapping({
|
49
22
|
"fileName" => "file_name",
|
50
23
|
"sourceFileChecksum" => "source_file_checksum",
|
@@ -60,33 +33,56 @@ module Spaceship
|
|
60
33
|
return "appScreenshots"
|
61
34
|
end
|
62
35
|
|
36
|
+
def complete?
|
37
|
+
(asset_delivery_state || {})["state"] == "COMPLETE"
|
38
|
+
end
|
39
|
+
|
63
40
|
#
|
64
41
|
# API
|
65
42
|
#
|
43
|
+
#
|
66
44
|
|
67
45
|
def self.create(app_screenshot_set_id: nil, path: nil)
|
68
46
|
require 'faraday'
|
69
47
|
|
70
48
|
filename = File.basename(path)
|
71
49
|
filesize = File.size(path)
|
72
|
-
|
50
|
+
bytes = File.binread(path)
|
73
51
|
|
74
52
|
post_attributes = {
|
75
53
|
fileSize: filesize,
|
76
54
|
fileName: filename
|
77
55
|
}
|
78
56
|
|
79
|
-
|
57
|
+
# Create placeholder
|
58
|
+
screenshot = Spaceship::ConnectAPI.post_app_screenshot(
|
59
|
+
app_screenshot_set_id: app_screenshot_set_id,
|
60
|
+
attributes: post_attributes
|
61
|
+
).first
|
80
62
|
|
81
|
-
|
82
|
-
|
63
|
+
# Upload the file
|
64
|
+
upload_operations = screenshot.upload_operations
|
65
|
+
Spaceship::ConnectAPI::FileUploader.upload(upload_operations, bytes)
|
83
66
|
|
67
|
+
# Update file uploading complete
|
84
68
|
patch_attributes = {
|
85
69
|
uploaded: true,
|
86
|
-
sourceFileChecksum:
|
70
|
+
sourceFileChecksum: Digest::MD5.hexdigest(bytes)
|
87
71
|
}
|
88
72
|
|
89
|
-
|
73
|
+
begin
|
74
|
+
screenshot = Spaceship::ConnectAPI.patch_app_screenshot(
|
75
|
+
app_screenshot_id: screenshot.id,
|
76
|
+
attributes: patch_attributes
|
77
|
+
).first
|
78
|
+
rescue => error
|
79
|
+
puts("Failed to patch app screenshot. Update may have gone through so verifying") if Spaceship::Globals.verbose?
|
80
|
+
|
81
|
+
screenshot = Spaceship::ConnectAPI.get_app_screenshot(app_screenshot_id: screenshot.id).first
|
82
|
+
raise error unless screenshot.complete?
|
83
|
+
end
|
84
|
+
|
85
|
+
return screenshot
|
90
86
|
end
|
91
87
|
|
92
88
|
def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
|
@@ -188,6 +188,11 @@ module Spaceship
|
|
188
188
|
# appPreview
|
189
189
|
#
|
190
190
|
|
191
|
+
def get_app_preview(app_preview_id: nil)
|
192
|
+
params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
|
193
|
+
Client.instance.get("appPreviews/#{app_preview_id}", params)
|
194
|
+
end
|
195
|
+
|
191
196
|
def post_app_preview(app_preview_set_id: nil, attributes: {})
|
192
197
|
body = {
|
193
198
|
data: {
|
@@ -338,6 +343,11 @@ module Spaceship
|
|
338
343
|
# appScreenshots
|
339
344
|
#
|
340
345
|
|
346
|
+
def get_app_screenshot(app_screenshot_id: nil)
|
347
|
+
params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
|
348
|
+
Client.instance.get("appScreenshots/#{app_screenshot_id}", params)
|
349
|
+
end
|
350
|
+
|
341
351
|
def post_app_screenshot(app_screenshot_set_id: nil, attributes: {})
|
342
352
|
body = {
|
343
353
|
data: {
|
@@ -378,9 +388,9 @@ module Spaceship
|
|
378
388
|
# appInfos
|
379
389
|
#
|
380
390
|
|
381
|
-
def get_app_infos(
|
391
|
+
def get_app_infos(filter: {}, includes: nil, limit: nil, sort: nil)
|
382
392
|
params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
|
383
|
-
Client.instance.get("
|
393
|
+
Client.instance.get("appInfos", params)
|
384
394
|
end
|
385
395
|
|
386
396
|
def patch_app_info(app_info_id: nil, attributes: {})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.150.0.
|
4
|
+
version: 2.150.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manu Wallner
|
@@ -29,7 +29,7 @@ authors:
|
|
29
29
|
autorequire:
|
30
30
|
bindir: bin
|
31
31
|
cert_chain: []
|
32
|
-
date: 2020-06-
|
32
|
+
date: 2020-06-28 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: slack-notifier
|