fastlane-plugin-huawei_appgallery_connect 1.0.17 → 1.0.20

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: 4cbcf000ecf19c315a575d2c5084aae0880a68e7d86f7a2560252269fe5e1857
4
- data.tar.gz: 3d30472124721a580b6ef1747437a306ae2e6b2810073caa9122f172296abd31
3
+ metadata.gz: 0a4f3a4eb6499091d3b7c95a832214f04be9846b9465766aa41e4f2bc405cc86
4
+ data.tar.gz: 41e306b534c09d085c62178aa7ba9198096ad8a582fa4a0d8ae0f0bef1cd3225
5
5
  SHA512:
6
- metadata.gz: cf05150273e858905a0bad16d652d3f93a63e655e0b498cf40908569981372e7076246691ac1b4ceb798d7f44ec68a6dde4e42315586d204946af943e4b3378b
7
- data.tar.gz: f11f69b3f0eed7b80e5af2def0c4e2783f13a5fedc431adc43aa1544e159bd53f0f93b71d578433630710d87fc0ffc1d1661c7f10f614dfd2878e63d0c687ca9
6
+ metadata.gz: e610470f62631e286658f801c9e598bd540fe3b0f4fa6168798336bf13a623931ea02b35a71221b1eb09e3de4fab0f8bc253357b62a72a450e987667c5a363a9
7
+ data.tar.gz: 509a8bc237fbdfa5e099e113532c3c5151bfd20083be18e79150bb447a6c6d2c357f1e661baec97987e6efdb1e58005616b9ec3051edac2a051cc2b8d786265b
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
@@ -16,8 +16,13 @@ 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)
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
21
26
  self.submit_for_review(token, upload_app, params)
22
27
 
23
28
  end
@@ -29,7 +34,7 @@ module Fastlane
29
34
  compilationStatus = Helper::HuaweiAppgalleryConnectHelper.query_aab_compilation_status(token, params, upload_app["pkgVersion"])
30
35
  if compilationStatus == 1
31
36
  UI.important("aab file is currently processing, waiting for 2 minutes...")
32
- sleep(10)
37
+ sleep(120)
33
38
  self.submit_for_review(token, upload_app, params)
34
39
  elsif compilationStatus == 2
35
40
  Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
@@ -150,7 +155,19 @@ module Fastlane
150
155
  env_name: "HUAWEI_APPGALLERY_SUBMIT_FOR_REVIEW",
151
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",
152
157
  optional: true,
153
- 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),
165
+
166
+ FastlaneCore::ConfigItem.new(key: :package_ids,
167
+ env_name: "HUAWEI_APPGALLERY_PACKAGE_IDS",
168
+ description: "App Package IDs separated by commas.",
169
+ optional: true,
170
+ type: String)
154
171
  ]
155
172
  end
156
173
 
@@ -0,0 +1,65 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/huawei_appgallery_connect_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class HuaweiAppgalleryConnectUpdateAppLocalizationAction < Action
7
+ def self.run(params)
8
+ token = Helper::HuaweiAppgalleryConnectHelper.get_token(params[:client_id], params[:client_secret])
9
+
10
+ if token.nil?
11
+ UI.message('Cannot retrieve token, please check your client ID and client secret')
12
+ else
13
+ Helper::HuaweiAppgalleryConnectHelper.update_app_localization_info(token, params)
14
+ end
15
+ end
16
+
17
+ def self.description
18
+ 'Huawei AppGallery Connect Plugin'
19
+ end
20
+
21
+ def self.authors
22
+ ['Shreejan Shrestha', 'Nikita Blizniuk']
23
+ end
24
+
25
+ def self.return_value; end
26
+
27
+ def self.details
28
+ 'Fastlane plugin to upload Android app to Huawei AppGallery Connect'
29
+ end
30
+
31
+ def self.available_options
32
+ [
33
+ FastlaneCore::ConfigItem.new(key: :client_id,
34
+ env_name: 'HUAWEI_APPGALLERY_CONNECT_CLIENT_ID',
35
+ description: 'Huawei AppGallery Connect Client ID',
36
+ optional: false,
37
+ type: String),
38
+
39
+ FastlaneCore::ConfigItem.new(key: :client_secret,
40
+ env_name: 'HUAWEI_APPGALLERY_CONNECT_CLIENT_SECRET',
41
+ description: 'Huawei AppGallery Connect Client Secret',
42
+ optional: false,
43
+ type: String),
44
+
45
+ FastlaneCore::ConfigItem.new(key: :app_id,
46
+ env_name: 'HUAWEI_APPGALLERY_CONNECT_APP_ID',
47
+ description: 'Huawei AppGallery Connect App ID',
48
+ optional: false,
49
+ type: String),
50
+
51
+ FastlaneCore::ConfigItem.new(key: :metadata_path,
52
+ env_name: 'HUAWEI_APPGALLERY_CONNECT_METADATA_PATH',
53
+ description: 'Huawei Appgallery Connect Metadata Path. Default is fastalane/metadata/huawei',
54
+ optional: true,
55
+ type: String)
56
+ ]
57
+ end
58
+
59
+ def self.is_supported?(platform)
60
+ [:android].include?(platform)
61
+ true
62
+ end
63
+ end
64
+ end
65
+ end
@@ -185,7 +185,7 @@ module Fastlane
185
185
  def self.query_aab_compilation_status(token,params, pkgVersion)
186
186
  UI.important("Checking aab compilation status")
187
187
 
188
- uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/aab/complile/status?appId=#{params[:app_id]}&pkgVersion=#{pkgVersion}")
188
+ uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/aab/complile/status?appId=#{params[:app_id]}&pkgIds=#{params[:package_ids]}&pkgVersion=#{pkgVersion}")
189
189
 
190
190
  http = Net::HTTP.new(uri.host, uri.port)
191
191
  http.use_ssl = true
@@ -229,7 +229,7 @@ module Fastlane
229
229
  end
230
230
 
231
231
  if params[:release_time] != nil
232
- params[:release_time] = URI::encode(params[:release_time], /\W/)
232
+ params[:release_time] = Addressable::URI.encode(params[:release_time], /\W/)
233
233
  release_time = "&releaseTime=#{params[:release_time]}"
234
234
  end
235
235
 
@@ -242,7 +242,7 @@ module Fastlane
242
242
  UI.user_error!("Failed to submit app for review. Changelog file length is invalid")
243
243
  return
244
244
  else
245
- changelog = "&remark=" + URI::encode(changelog_data)
245
+ changelog = "&remark=" + Addressable::URI.encode(changelog_data)
246
246
  end
247
247
  end
248
248
 
@@ -286,6 +286,62 @@ module Fastlane
286
286
  end
287
287
 
288
288
  end
289
+
290
+ def self.update_app_localization_info(token, params)
291
+ metadata_path = if !params[:metadata_path].nil?
292
+ params[:metadata_path]
293
+ else
294
+ 'fastlane/metadata/huawei'
295
+ end
296
+
297
+ UI.important("Uploading app localization information from path: #{metadata_path}")
298
+
299
+ # gather info from metadata folders
300
+ Dir.glob("#{metadata_path}/*") do |folder|
301
+ uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/app-language-info?appId=#{params[:app_id]}")
302
+ http = Net::HTTP.new(uri.host, uri.port)
303
+ http.use_ssl = true
304
+ request = Net::HTTP::Put.new(uri.request_uri)
305
+ request['client_id'] = params[:client_id]
306
+ request['Authorization'] = "Bearer #{token}"
307
+ request['Content-Type'] = 'application/json'
308
+ lang = File.basename(folder)
309
+ body = { "lang": lang }
310
+
311
+ Dir.glob("#{folder}/*") do |file|
312
+ case file
313
+ when /app_name/
314
+ body[:appName] = File.read(file)
315
+ when /app_description/
316
+ body[:appDesc] = File.read(file)
317
+ when /introduction/
318
+ body[:briefInfo] = File.read(file)
319
+ when /release_notes/
320
+ body[:newFeatures] = File.read(file)
321
+ end
322
+ end
323
+
324
+ body.length.zero? && next
325
+ UI.important(body.to_json)
326
+ request.body = body.to_json
327
+ response = http.request(request)
328
+
329
+ UI.important(response)
330
+
331
+ unless response.is_a? Net::HTTPSuccess
332
+ UI.user_error!("Cannot upload localization info (status code: #{response.code}, body: #{response.body})")
333
+ return false
334
+ end
335
+
336
+ result_json = JSON.parse(response.body)
337
+
338
+ if result_json['ret']['code'].zero?
339
+ UI.success("Successfully uploaded app localization info for #{File.basename(folder)}")
340
+ else
341
+ UI.user_error!(result_json)
342
+ end
343
+ end
344
+ end
289
345
  end
290
346
  end
291
347
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module HuaweiAppgalleryConnect
3
- VERSION = "1.0.17"
3
+ VERSION = "1.0.20"
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.17
4
+ version: 1.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shreejan Shrestha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2022-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -148,6 +148,7 @@ files:
148
148
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
149
149
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_info.rb
150
150
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_submit_for_review.rb
151
+ - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_update_app_localization.rb
151
152
  - lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
152
153
  - lib/fastlane/plugin/huawei_appgallery_connect/version.rb
153
154
  homepage: https://github.com/shr3jn/fastlane-plugin-huawei_appgallery_connect
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
170
  - !ruby/object:Gem::Version
170
171
  version: '0'
171
172
  requirements: []
172
- rubygems_version: 3.2.33
173
+ rubygems_version: 3.0.9
173
174
  signing_key:
174
175
  specification_version: 4
175
176
  summary: Huawei AppGallery Connect Plugin