fastlane-plugin-huawei_appgallery_connect 1.0.13 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb +19 -2
- data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb +56 -10
- data/lib/fastlane/plugin/huawei_appgallery_connect/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cbcf000ecf19c315a575d2c5084aae0880a68e7d86f7a2560252269fe5e1857
|
4
|
+
data.tar.gz: 3d30472124721a580b6ef1747437a306ae2e6b2810073caa9122f172296abd31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf05150273e858905a0bad16d652d3f93a63e655e0b498cf40908569981372e7076246691ac1b4ceb798d7f44ec68a6dde4e42315586d204946af943e4b3378b
|
7
|
+
data.tar.gz: f11f69b3f0eed7b80e5af2def0c4e2783f13a5fedc431adc43aa1544e159bd53f0f93b71d578433630710d87fc0ffc1d1661c7f10f614dfd2878e63d0c687ca9
|
data/README.md
CHANGED
@@ -27,6 +27,9 @@ huawei_appgallery_connect(
|
|
27
27
|
|
28
28
|
# Optional, Parameter beyond this are optional
|
29
29
|
|
30
|
+
# if you're uploading aab instead of apk, specify is_aab to true and specify path to aab file on apk_path
|
31
|
+
is_aab: true
|
32
|
+
|
30
33
|
submit_for_review: false,
|
31
34
|
|
32
35
|
privacy_policy_url: "https://example.com",
|
data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
CHANGED
@@ -16,12 +16,29 @@ module Fastlane
|
|
16
16
|
end
|
17
17
|
|
18
18
|
upload_app = Helper::HuaweiAppgalleryConnectHelper.upload_app(token, params[:client_id], params[:app_id], params[:apk_path], params[:is_aab])
|
19
|
+
UI.message("Waiting 10 seconds for upload to get processed...")
|
20
|
+
sleep(10)
|
21
|
+
self.submit_for_review(token, upload_app, params)
|
19
22
|
|
20
|
-
|
23
|
+
end
|
24
|
+
# Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.submit_for_review(token, upload_app, params)
|
28
|
+
if params[:is_aab] && upload_app["success"] == true && params[:submit_for_review] != false
|
29
|
+
compilationStatus = Helper::HuaweiAppgalleryConnectHelper.query_aab_compilation_status(token, params, upload_app["pkgVersion"])
|
30
|
+
if compilationStatus == 1
|
31
|
+
UI.important("aab file is currently processing, waiting for 2 minutes...")
|
32
|
+
sleep(10)
|
33
|
+
self.submit_for_review(token, upload_app, params)
|
34
|
+
elsif compilationStatus == 2
|
21
35
|
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
36
|
+
else
|
37
|
+
UI.user_error!("Compilation of aab failed")
|
22
38
|
end
|
39
|
+
elsif upload_app["success"] == true && params[:submit_for_review] != false
|
40
|
+
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
23
41
|
end
|
24
|
-
# Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
|
25
42
|
end
|
26
43
|
|
27
44
|
def self.description
|
data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
CHANGED
@@ -57,6 +57,7 @@ module Fastlane
|
|
57
57
|
request = Net::HTTP::Put.new(uri.request_uri)
|
58
58
|
request["client_id"] = client_id
|
59
59
|
request["Authorization"] = "Bearer #{token}"
|
60
|
+
request["Content-Type"] = "application/json"
|
60
61
|
|
61
62
|
request.body = {privacyPolicy: privacy_policy_url}.to_json
|
62
63
|
|
@@ -79,6 +80,10 @@ module Fastlane
|
|
79
80
|
def self.upload_app(token, client_id, app_id, apk_path, is_aab)
|
80
81
|
UI.message("Fetching upload URL")
|
81
82
|
|
83
|
+
responseData = JSON.parse("{}")
|
84
|
+
responseData["success"] = false
|
85
|
+
responseData["code"] = 0
|
86
|
+
|
82
87
|
if(is_aab)
|
83
88
|
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url?appId=#{app_id}&suffix=aab")
|
84
89
|
upload_filename = "release.aab"
|
@@ -92,19 +97,22 @@ module Fastlane
|
|
92
97
|
request = Net::HTTP::Get.new(uri.request_uri)
|
93
98
|
request["client_id"] = client_id
|
94
99
|
request["Authorization"] = "Bearer #{token}"
|
100
|
+
request["Content-Type"] = "application/json"
|
95
101
|
|
96
102
|
response = http.request(request)
|
97
103
|
|
98
104
|
if !response.kind_of? Net::HTTPSuccess
|
99
105
|
UI.user_error!("Cannot obtain upload url, please check API Token / Permissions (status code: #{response.code})")
|
100
|
-
|
106
|
+
responseData["success"] = false
|
107
|
+
return responseData
|
101
108
|
end
|
102
109
|
|
103
110
|
result_json = JSON.parse(response.body)
|
104
111
|
|
105
112
|
if result_json['uploadUrl'].nil?
|
106
113
|
UI.user_error!('Cannot obtain upload url')
|
107
|
-
|
114
|
+
responseData["success"] = false
|
115
|
+
return responseData
|
108
116
|
else
|
109
117
|
UI.important('Uploading app')
|
110
118
|
# Upload App
|
@@ -121,7 +129,8 @@ module Fastlane
|
|
121
129
|
result = http.request(request)
|
122
130
|
if !result.kind_of? Net::HTTPSuccess
|
123
131
|
UI.user_error!("Cannot upload app, please check API Token / Permissions (status code: #{result.code})")
|
124
|
-
|
132
|
+
responseData["success"] = false
|
133
|
+
return responseData
|
125
134
|
end
|
126
135
|
result_json = JSON.parse(result.body)
|
127
136
|
|
@@ -136,7 +145,7 @@ module Fastlane
|
|
136
145
|
request = Net::HTTP::Put.new(uri.request_uri)
|
137
146
|
request["client_id"] = client_id
|
138
147
|
request["Authorization"] = "Bearer #{token}"
|
139
|
-
request[
|
148
|
+
request["Content-Type"] = "application/json"
|
140
149
|
|
141
150
|
data = {fileType: 5, files: [{
|
142
151
|
|
@@ -150,24 +159,57 @@ module Fastlane
|
|
150
159
|
response = http.request(request)
|
151
160
|
if !response.kind_of? Net::HTTPSuccess
|
152
161
|
UI.user_error!("Cannot save app info, please check API Token / Permissions (status code: #{response.code})")
|
153
|
-
|
162
|
+
responseData["success"] = false
|
163
|
+
return responseData
|
154
164
|
end
|
155
165
|
result_json = JSON.parse(response.body)
|
156
166
|
|
157
167
|
if result_json['ret']['code'] == 0
|
158
168
|
UI.success("App information saved.")
|
159
|
-
|
169
|
+
responseData["success"] = true
|
170
|
+
responseData["pkgVersion"] = result_json["pkgVersion"][0]
|
171
|
+
return responseData
|
160
172
|
else
|
161
173
|
UI.user_error!(result_json)
|
162
174
|
UI.user_error!("Failed to save app information")
|
163
|
-
|
175
|
+
responseData["success"] = false
|
176
|
+
return responseData
|
164
177
|
end
|
165
178
|
else
|
166
|
-
|
179
|
+
responseData["success"] = false
|
180
|
+
return responseData
|
167
181
|
end
|
168
182
|
end
|
169
183
|
end
|
170
184
|
|
185
|
+
def self.query_aab_compilation_status(token,params, pkgVersion)
|
186
|
+
UI.important("Checking aab compilation status")
|
187
|
+
|
188
|
+
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/aab/complile/status?appId=#{params[:app_id]}&pkgVersion=#{pkgVersion}")
|
189
|
+
|
190
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
191
|
+
http.use_ssl = true
|
192
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
193
|
+
request["client_id"] = params[:client_id]
|
194
|
+
request["Authorization"] = "Bearer #{token}"
|
195
|
+
|
196
|
+
response = http.request(request)
|
197
|
+
|
198
|
+
if !response.kind_of? Net::HTTPSuccess
|
199
|
+
UI.user_error!("Cannot query compilation status (status code: #{response.code}, body: #{response.body})")
|
200
|
+
return false
|
201
|
+
end
|
202
|
+
|
203
|
+
result_json = JSON.parse(response.body)
|
204
|
+
|
205
|
+
if result_json['ret']['code'] == 0
|
206
|
+
return result_json['aabCompileStatus']
|
207
|
+
else
|
208
|
+
UI.user_error!(result_json)
|
209
|
+
return -999
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
171
213
|
def self.submit_app_for_review(token, params)
|
172
214
|
UI.important("Submitting app for review")
|
173
215
|
|
@@ -211,6 +253,7 @@ module Fastlane
|
|
211
253
|
request = Net::HTTP::Post.new(uri.request_uri)
|
212
254
|
request["client_id"] = params[:client_id]
|
213
255
|
request["Authorization"] = "Bearer #{token}"
|
256
|
+
request["Content-Type"] = "application/json"
|
214
257
|
|
215
258
|
if params[:phase_wise_release] != nil && params[:phase_wise_release]
|
216
259
|
request.body = {
|
@@ -221,7 +264,6 @@ module Fastlane
|
|
221
264
|
}.to_json
|
222
265
|
end
|
223
266
|
|
224
|
-
|
225
267
|
response = http.request(request)
|
226
268
|
|
227
269
|
if !response.kind_of? Net::HTTPSuccess
|
@@ -233,6 +275,11 @@ module Fastlane
|
|
233
275
|
|
234
276
|
if result_json['ret']['code'] == 0
|
235
277
|
UI.success("Successfully submitted app for review")
|
278
|
+
elsif result_json['ret']['code'] == 204144660 && result_json['ret']['msg'].include?("It may take 2-5 minutes")
|
279
|
+
UI.important(result_json)
|
280
|
+
UI.important("Build is currently processing, waiting for 2 minutes before submitting again...")
|
281
|
+
sleep(120)
|
282
|
+
self.submit_app_for_review(token, params)
|
236
283
|
else
|
237
284
|
UI.user_error!(result_json)
|
238
285
|
UI.user_error!("Failed to submit app for review.")
|
@@ -242,4 +289,3 @@ module Fastlane
|
|
242
289
|
end
|
243
290
|
end
|
244
291
|
end
|
245
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-huawei_appgallery_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shreejan Shrestha
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 2.137.0
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email: shr3jn@gmail.com
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
@@ -154,7 +154,7 @@ homepage: https://github.com/shr3jn/fastlane-plugin-huawei_appgallery_connect
|
|
154
154
|
licenses:
|
155
155
|
- MIT
|
156
156
|
metadata: {}
|
157
|
-
post_install_message:
|
157
|
+
post_install_message:
|
158
158
|
rdoc_options: []
|
159
159
|
require_paths:
|
160
160
|
- lib
|
@@ -169,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
173
|
-
signing_key:
|
172
|
+
rubygems_version: 3.2.33
|
173
|
+
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Huawei AppGallery Connect Plugin
|
176
176
|
test_files: []
|