fastlane-plugin-huawei_appgallery_connect 1.0.14 → 1.0.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b26badca5c4e5028b8e90d24bdf2b300539f369b468ad182149c94bde47c406
4
- data.tar.gz: 81b7075c7cc3f4bbfdc541e9cb82baad9636056b7773e0c5932ba4dd083bf3e2
3
+ metadata.gz: e8ad1b77f355b7d2284ad5e1cd0f161b2c643209cafbe79c3bd11c5de23405f2
4
+ data.tar.gz: f6dd1a859de8909d8e25b1485a5dd98130da965814e6246beadaf4c291f3f41d
5
5
  SHA512:
6
- metadata.gz: df7fcb9ba89d6708ea7c013e5f435935f9e608f8a8e8908fedb7016d1dd8b99c843707268786ad6638aa42b66ce54e68bea474046ff0e22fcb89d7c414c861fb
7
- data.tar.gz: e50ad0fdbfd1933f26377752558d9cb0d1294c7ff6c99dec928c1d01fa39e4a5a366cbb78bc3e291fa4eb746947efb2f500da6cca95ece979565017ea0ae694f
6
+ metadata.gz: 1cef05bbe6d2a076cca0e48d42e956717e792ebae5420c00e6c2c0b0ba805a186aa563c70f11268fc0d1b220b1ada355759f555c0f13fa37ad9bf0975b3409bc
7
+ data.tar.gz: 15771fc11e6da6d2deb8eb442c2b05e82c9d2f379bf64658617aa041bcf5f7c9507d926cf27d343bdc189f11c111f0ff91a449360a309801cedbf64ba76e9348
@@ -16,12 +16,27 @@ 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
+ self.submit_for_review(token, upload_app, params)
19
20
 
20
- if upload_app && params[:submit_for_review] != false
21
+ end
22
+ # Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
23
+ end
24
+
25
+ def self.submit_for_review(token, upload_app, params)
26
+ if params[:is_aab] && upload_app["success"] == true && params[:submit_for_review] != false
27
+ compilationStatus = Helper::HuaweiAppgalleryConnectHelper.query_aab_compilation_status(token, params, upload_app["pkgVersion"])
28
+ if compilationStatus == 1
29
+ UI.important("aab file is currently processing, waiting for 2 minutes...")
30
+ sleep(10)
31
+ self.submit_for_review(token, upload_app, params)
32
+ elsif compilationStatus == 2
21
33
  Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
34
+ else
35
+ UI.user_error!("Compilation of aab failed")
22
36
  end
37
+ elsif upload_app["success"] == true && params[:submit_for_review] != false
38
+ Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
23
39
  end
24
- # Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
25
40
  end
26
41
 
27
42
  def self.description
@@ -79,6 +79,10 @@ module Fastlane
79
79
  def self.upload_app(token, client_id, app_id, apk_path, is_aab)
80
80
  UI.message("Fetching upload URL")
81
81
 
82
+ responseData = JSON.parse("{}")
83
+ responseData["success"] = false
84
+ responseData["code"] = 0
85
+
82
86
  if(is_aab)
83
87
  uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url?appId=#{app_id}&suffix=aab")
84
88
  upload_filename = "release.aab"
@@ -97,14 +101,16 @@ module Fastlane
97
101
 
98
102
  if !response.kind_of? Net::HTTPSuccess
99
103
  UI.user_error!("Cannot obtain upload url, please check API Token / Permissions (status code: #{response.code})")
100
- return false
104
+ responseData["success"] = false
105
+ return responseData
101
106
  end
102
107
 
103
108
  result_json = JSON.parse(response.body)
104
109
 
105
110
  if result_json['uploadUrl'].nil?
106
111
  UI.user_error!('Cannot obtain upload url')
107
- return false
112
+ responseData["success"] = false
113
+ return responseData
108
114
  else
109
115
  UI.important('Uploading app')
110
116
  # Upload App
@@ -121,7 +127,8 @@ module Fastlane
121
127
  result = http.request(request)
122
128
  if !result.kind_of? Net::HTTPSuccess
123
129
  UI.user_error!("Cannot upload app, please check API Token / Permissions (status code: #{result.code})")
124
- return false
130
+ responseData["success"] = false
131
+ return responseData
125
132
  end
126
133
  result_json = JSON.parse(result.body)
127
134
 
@@ -150,24 +157,57 @@ module Fastlane
150
157
  response = http.request(request)
151
158
  if !response.kind_of? Net::HTTPSuccess
152
159
  UI.user_error!("Cannot save app info, please check API Token / Permissions (status code: #{response.code})")
153
- return false
160
+ responseData["success"] = false
161
+ return responseData
154
162
  end
155
163
  result_json = JSON.parse(response.body)
156
164
 
157
165
  if result_json['ret']['code'] == 0
158
166
  UI.success("App information saved.")
159
- return true
167
+ responseData["success"] = true
168
+ responseData["pkgVersion"] = result_json["pkgVersion"][0]
169
+ return responseData
160
170
  else
161
171
  UI.user_error!(result_json)
162
172
  UI.user_error!("Failed to save app information")
163
- return false
173
+ responseData["success"] = false
174
+ return responseData
164
175
  end
165
176
  else
166
- return false
177
+ responseData["success"] = false
178
+ return responseData
167
179
  end
168
180
  end
169
181
  end
170
182
 
183
+ def self.query_aab_compilation_status(token,params, pkgVersion)
184
+ UI.important("Checking aab compilation status")
185
+
186
+ uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/aab/complile/status?appId=#{params[:app_id]}&pkgVersion=#{pkgVersion}")
187
+
188
+ http = Net::HTTP.new(uri.host, uri.port)
189
+ http.use_ssl = true
190
+ request = Net::HTTP::Get.new(uri.request_uri)
191
+ request["client_id"] = params[:client_id]
192
+ request["Authorization"] = "Bearer #{token}"
193
+
194
+ response = http.request(request)
195
+
196
+ if !response.kind_of? Net::HTTPSuccess
197
+ UI.user_error!("Cannot query compilation status (status code: #{response.code}, body: #{response.body})")
198
+ return false
199
+ end
200
+
201
+ result_json = JSON.parse(response.body)
202
+
203
+ if result_json['ret']['code'] == 0
204
+ return result_json['aabCompileStatus']
205
+ else
206
+ UI.user_error!(result_json)
207
+ return -999
208
+ end
209
+ end
210
+
171
211
  def self.submit_app_for_review(token, params)
172
212
  UI.important("Submitting app for review")
173
213
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module HuaweiAppgalleryConnect
3
- VERSION = "1.0.14"
3
+ VERSION = "1.0.15"
4
4
  end
5
5
  end
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.14
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shreejan Shrestha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-15 00:00:00.000000000 Z
11
+ date: 2020-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry