fastlane-plugin-huawei_appgallery_connect 1.0.28 → 1.0.30

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e4cd56c26e2348508c07b4f09817f4943cf49534e0a4bc34a907856ce380412
4
- data.tar.gz: 279935cb94b9f7d2e18d3c1cb17a6fe3888eafe18cc34310db82d525673e7942
3
+ metadata.gz: 2904a4ad4c7854401244691e37011ff3499a3804ca3d16f87a867e8cc9c5e6ed
4
+ data.tar.gz: 5e3af3d520578df106b3ef534bbaea25f1f64db836d3154fcddf38d593ed7751
5
5
  SHA512:
6
- metadata.gz: 83f176cd4a84b951ab2f55db38c32267e0dba37f5a244aefd151fbc2b6f572ea30c6ced731a5abf27f1240279b92004ffacdf1e9a8d2b147b00bed9d767a5ffb
7
- data.tar.gz: 79bb69f5af73ea2c80619ad2407ec7b250d8ffdd482193cca721c2a130ff663230b7b90626c61c9923b5d4e5a78f51d3e0631fb82ac75608a7b86e07e3d1a1c5
6
+ metadata.gz: 4108624df4841576b640a986c87e4b9a3b09343d90edd0cf438c7fa59bbd358879111e330a71e2499e2361fcba84c7ccaee6a31b2d48be50e9994b32722d2611
7
+ data.tar.gz: 98719dd530726f05aed5b6c22d0f1c845ac3a98cb5d9b90d392154e1731afcb97069f857a0b6f91ac30df1dee418ebc094c12316f3bd1d8fad793f759f5db4e2
data/README.md CHANGED
@@ -105,7 +105,7 @@ huawei_appgallery_connect_update_app_localization(
105
105
  To update the GMS dependency of the app, use the following action
106
106
 
107
107
  ```
108
- huawei_appgallery_connect_update_app_localization(
108
+ huawei_appgallery_connect_set_gms_dependency(
109
109
  client_id: "<CLIENT_ID>",
110
110
  client_secret: "<CLIENT_SECRET>",
111
111
  app_id: "<APP_ID>",
@@ -112,11 +112,14 @@ module Fastlane
112
112
  responseData["success"] = false
113
113
  responseData["code"] = 0
114
114
 
115
+ file_size_in_bytes = File.size(apk_path.to_s)
116
+ sha256 = Digest::SHA256.file(apk_path).hexdigest
117
+
115
118
  if(is_aab)
116
- uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url?appId=#{app_id}&suffix=aab")
119
+ uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url/for-obs?appId=#{app_id}&fileName=release.aab&contentLength=#{file_size_in_bytes}&suffix=aab")
117
120
  upload_filename = "release.aab"
118
121
  else
119
- uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url?appId=#{app_id}&suffix=apk")
122
+ uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url/for-obs?appId=#{app_id}&fileName=release.apk&contentLength=#{file_size_in_bytes}&suffix=apk")
120
123
  upload_filename = "release.apk"
121
124
  end
122
125
 
@@ -137,32 +140,40 @@ module Fastlane
137
140
 
138
141
  result_json = JSON.parse(response.body)
139
142
 
140
- if result_json['uploadUrl'].nil?
141
- UI.user_error!('Cannot obtain upload url')
143
+ if result_json.nil? || result_json['urlInfo'].nil? || result_json['urlInfo']['url'].nil?
144
+ UI.message('Cannot obtain upload url')
145
+ UI.user_error!(response.body)
146
+
142
147
  responseData["success"] = false
143
148
  return responseData
144
149
  else
145
150
  UI.important('Uploading app')
146
151
  # Upload App
147
152
  boundary = "755754302457647"
148
- uri = URI(result_json['uploadUrl'])
153
+ uri = URI(result_json['urlInfo']['url'])
149
154
  # uri = URI("http://localhost/dashboard/test")
150
155
  http = Net::HTTP.new(uri.host, uri.port)
151
156
  http.use_ssl = true
152
- request = Net::HTTP::Post.new(uri)
157
+ request = Net::HTTP::Put.new(uri)
158
+ request["Authorization"] = result_json['urlInfo']['headers']['Authorization']
159
+ request["Content-Type"] = result_json['urlInfo']['headers']['Content-Type']
160
+ request["user-agent"] = result_json['urlInfo']['headers']['user-agent']
161
+ request["Host"] = result_json['urlInfo']['headers']['Host']
162
+ request["x-amz-date"] = result_json['urlInfo']['headers']['x-amz-date']
163
+ request["x-amz-content-sha256"] = result_json['urlInfo']['headers']['x-amz-content-sha256']
153
164
 
154
- form_data = [['file', File.open(apk_path.to_s)],['authCode', result_json['authCode']],['fileCount', '1']]
155
- request.set_form form_data, 'multipart/form-data'
165
+ request.body = File.read(apk_path.to_s)
166
+ request.content_type = 'application/octet-stream'
156
167
 
157
168
  result = http.request(request)
158
169
  if !result.kind_of? Net::HTTPSuccess
170
+ UI.user_error!(result.body)
159
171
  UI.user_error!("Cannot upload app, please check API Token / Permissions (status code: #{result.code})")
160
172
  responseData["success"] = false
161
173
  return responseData
162
174
  end
163
- result_json = JSON.parse(result.body)
164
175
 
165
- if result_json['result']['result_code'].to_i == 0
176
+ if result.code.to_i == 200
166
177
  UI.success('Upload app to AppGallery Connect successful')
167
178
  UI.important("Saving app information")
168
179
 
@@ -178,8 +189,8 @@ module Fastlane
178
189
  data = {fileType: 5, files: [{
179
190
 
180
191
  fileName: upload_filename,
181
- fileDestUrl: result_json['result']['UploadFileRsp']['fileInfoList'][0]['fileDestUlr'],
182
- size: result_json['result']['UploadFileRsp']['fileInfoList'][0]['size'].to_s
192
+ fileDestUrl: result_json['urlInfo']['objectId']
193
+ # size: result_json['result']['UploadFileRsp']['fileInfoList'][0]['size'].to_s
183
194
 
184
195
  }] }.to_json
185
196
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module HuaweiAppgalleryConnect
3
- VERSION = "1.0.28"
3
+ VERSION = "1.0.30"
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.28
4
+ version: 1.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shreejan Shrestha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-23 00:00:00.000000000 Z
11
+ date: 2024-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry