fastlane-plugin-huawei_appgallery_connect 1.0.14 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb +31 -3
- data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb +51 -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: 13c12a640e892f8a26d41fe23ec060b7151d36fb56792053a0781d77bf6fb698
|
4
|
+
data.tar.gz: ec69a3d658b3d41c92376a6752ea743984251466f288d6bab34f5cdeca54d3bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcef9055f72ccaf6f08abf8fa5a1ac6a78e2101dfeb896a756bb66c28dcd847f662a0858aa397b029fd0fbae09e654444b39ce0ed3dbcc32bb5c43dc492ac5e0
|
7
|
+
data.tar.gz: 49feaeecebd261abcc0e63862a6dec3ec6662b831ea77bf582a1036faa2ab422c675ab83d5f9cc88771eec77979ca9c30464dc83449644243df461a4d310fdb6
|
data/README.md
CHANGED
@@ -26,6 +26,9 @@ huawei_appgallery_connect(
|
|
26
26
|
apk_path: "<APK_PATH>"
|
27
27
|
|
28
28
|
# Optional, Parameter beyond this are optional
|
29
|
+
|
30
|
+
# If you are facing errors when submitting for review, increase the delay time before submitting the app for review using this option:
|
31
|
+
delay_before_submit_for_review: 20
|
29
32
|
|
30
33
|
# if you're uploading aab instead of apk, specify is_aab to true and specify path to aab file on apk_path
|
31
34
|
is_aab: true
|
data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
CHANGED
@@ -16,12 +16,34 @@ 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
|
+
if params[:delay_before_submit_for_review] == nil
|
20
|
+
UI.message("Waiting 10 seconds for upload to get processed...")
|
21
|
+
sleep(10)
|
22
|
+
else
|
23
|
+
UI.message("Waiting #{params[:delay_before_submit_for_review]} seconds for upload to get processed...")
|
24
|
+
sleep(params[:delay_before_submit_for_review])
|
25
|
+
end
|
26
|
+
self.submit_for_review(token, upload_app, params)
|
27
|
+
|
28
|
+
end
|
29
|
+
# Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
|
30
|
+
end
|
19
31
|
|
20
|
-
|
32
|
+
def self.submit_for_review(token, upload_app, params)
|
33
|
+
if params[:is_aab] && upload_app["success"] == true && params[:submit_for_review] != false
|
34
|
+
compilationStatus = Helper::HuaweiAppgalleryConnectHelper.query_aab_compilation_status(token, params, upload_app["pkgVersion"])
|
35
|
+
if compilationStatus == 1
|
36
|
+
UI.important("aab file is currently processing, waiting for 2 minutes...")
|
37
|
+
sleep(120)
|
38
|
+
self.submit_for_review(token, upload_app, params)
|
39
|
+
elsif compilationStatus == 2
|
21
40
|
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
41
|
+
else
|
42
|
+
UI.user_error!("Compilation of aab failed")
|
22
43
|
end
|
44
|
+
elsif upload_app["success"] == true && params[:submit_for_review] != false
|
45
|
+
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
23
46
|
end
|
24
|
-
# Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
|
25
47
|
end
|
26
48
|
|
27
49
|
def self.description
|
@@ -133,7 +155,13 @@ module Fastlane
|
|
133
155
|
env_name: "HUAWEI_APPGALLERY_SUBMIT_FOR_REVIEW",
|
134
156
|
description: "Should submit the app for review. The default value is true. If set false will only upload the app, and you can submit for review from the console",
|
135
157
|
optional: true,
|
136
|
-
type: Boolean)
|
158
|
+
type: Boolean),
|
159
|
+
|
160
|
+
FastlaneCore::ConfigItem.new(key: :delay_before_submit_for_review,
|
161
|
+
env_name: "HUAWEI_APPGALLERY_DELAY_BEFORE_REVIEW",
|
162
|
+
description: "Delay before submitting the app for review. Default is 10 seconds. Change this to a higher value if you are having issues submitting the app for review",
|
163
|
+
optional: true,
|
164
|
+
type: Integer)
|
137
165
|
]
|
138
166
|
end
|
139
167
|
|
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
|
@@ -247,4 +289,3 @@ module Fastlane
|
|
247
289
|
end
|
248
290
|
end
|
249
291
|
end
|
250
|
-
|
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.18
|
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-17 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: []
|