fastlane-plugin-huawei_appgallery_connect 1.0.16 → 1.0.19

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: dfbde49f6453dab62630894c6b4d16a2710d588b0745d97b33840fbb8eaae8d8
4
- data.tar.gz: 158bbe4a0770dfc2eb01a260144e3aecf72b14ba95f45e50789c3907a92bf8e0
3
+ metadata.gz: 5ad5b99cb7e2f9b8189eb700c3ad1f4bd29a83569a72cc7e095efd5b44e139d1
4
+ data.tar.gz: 5135db4b14e398fddf95ad762129a9acb3cfac6f371453d60a05a38b1749ae51
5
5
  SHA512:
6
- metadata.gz: 21ac172a899067f8eac2eaf09268c7ff0e941da6886ab393a9f52f29860c6d03ec71cb997a6d84946410a87bcdf0bed5b2d53816e5aebd66767b0e961c465b44
7
- data.tar.gz: d77abc579cd3551998c11c8c24a97053a079bcbf8cfc662e97883632da71d9e3be95ecb973dcdeb9461a41015bcac6bf4ba5b99dae4bb88a65847977c7a3aba2
6
+ metadata.gz: 7d929f54743a20238a21bb3c038c82fb49dd2d15021357ad7a6b8826e19ed62eca52c1f4e140366ece81174243e389b8ee0d4ce97518fc410a315d772f9ab761
7
+ data.tar.gz: 50205181ecf2d71e4360bc332835a5a13dde3a35b1e875a1023940ccdf2b6be7ea6458474e7ae1cbdc19b341bc0ed42906d26b4031537cb85a1fc5ecd2faf88f
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,6 +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
+ 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
19
26
  self.submit_for_review(token, upload_app, params)
20
27
 
21
28
  end
@@ -27,7 +34,7 @@ module Fastlane
27
34
  compilationStatus = Helper::HuaweiAppgalleryConnectHelper.query_aab_compilation_status(token, params, upload_app["pkgVersion"])
28
35
  if compilationStatus == 1
29
36
  UI.important("aab file is currently processing, waiting for 2 minutes...")
30
- sleep(10)
37
+ sleep(120)
31
38
  self.submit_for_review(token, upload_app, params)
32
39
  elsif compilationStatus == 2
33
40
  Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
@@ -148,7 +155,13 @@ module Fastlane
148
155
  env_name: "HUAWEI_APPGALLERY_SUBMIT_FOR_REVIEW",
149
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",
150
157
  optional: true,
151
- 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)
152
165
  ]
153
166
  end
154
167
 
@@ -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
@@ -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
 
@@ -264,7 +264,6 @@ module Fastlane
264
264
  }.to_json
265
265
  end
266
266
 
267
-
268
267
  response = http.request(request)
269
268
 
270
269
  if !response.kind_of? Net::HTTPSuccess
@@ -287,6 +286,62 @@ module Fastlane
287
286
  end
288
287
 
289
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
290
345
  end
291
346
  end
292
347
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module HuaweiAppgalleryConnect
3
- VERSION = "1.0.16"
3
+ VERSION = "1.0.19"
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.16
4
+ version: 1.0.19
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: 2021-05-15 00:00:00.000000000 Z
11
+ date: 2022-05-02 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: []
@@ -148,13 +148,14 @@ 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
154
155
  licenses:
155
156
  - MIT
156
157
  metadata: {}
157
- post_install_message:
158
+ post_install_message:
158
159
  rdoc_options: []
159
160
  require_paths:
160
161
  - lib
@@ -169,8 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
170
  - !ruby/object:Gem::Version
170
171
  version: '0'
171
172
  requirements: []
172
- rubygems_version: 3.0.3
173
- signing_key:
173
+ rubygems_version: 3.0.9
174
+ signing_key:
174
175
  specification_version: 4
175
176
  summary: Huawei AppGallery Connect Plugin
176
177
  test_files: []