fastlane-plugin-huawei_appgallery_connect 1.0.18 → 1.0.21

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: 13c12a640e892f8a26d41fe23ec060b7151d36fb56792053a0781d77bf6fb698
4
- data.tar.gz: ec69a3d658b3d41c92376a6752ea743984251466f288d6bab34f5cdeca54d3bb
3
+ metadata.gz: f9fc41a8d6e55897cd72faea6687c02535685d249689a602716a336998acb4ff
4
+ data.tar.gz: fadc99b2e64d76088cbebebae314a8d9dc8a02a8b41e20d5e435ce979589c873
5
5
  SHA512:
6
- metadata.gz: dcef9055f72ccaf6f08abf8fa5a1ac6a78e2101dfeb896a756bb66c28dcd847f662a0858aa397b029fd0fbae09e654444b39ce0ed3dbcc32bb5c43dc492ac5e0
7
- data.tar.gz: 49feaeecebd261abcc0e63862a6dec3ec6662b831ea77bf582a1036faa2ab422c675ab83d5f9cc88771eec77979ca9c30464dc83449644243df461a4d310fdb6
6
+ metadata.gz: a640ab54fb7c6b2595f536c24ff6397c6a49e0b592e0cce5a6eec9d7b0429eb8a2fd6b4dcf0efb7491bc6d5db96619c568d2c9fdb94e7d19123b75e61d57f6bf
7
+ data.tar.gz: 06c31847ac1001da459cffce87d9013020b3247be624a0aca0d5bafc3be88659933dd02b5da9536779ffa566621fdd61ef40c73eb6aacd4fb80e761c5fc913d4
data/README.md CHANGED
@@ -23,15 +23,18 @@ huawei_appgallery_connect(
23
23
  client_id: "<CLIENT_ID>",
24
24
  client_secret: "<CLIENT_SECRET>",
25
25
  app_id: "<APP_ID>",
26
- apk_path: "<APK_PATH>"
26
+ apk_path: "<APK_PATH>",
27
27
 
28
28
  # Optional, Parameter beyond this are optional
29
29
 
30
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
31
+ delay_before_submit_for_review: 20,
32
32
 
33
33
  # if you're uploading aab instead of apk, specify is_aab to true and specify path to aab file on apk_path
34
- is_aab: true
34
+ is_aab: true,
35
+
36
+ # package id should be defined if you are submitting app for review
37
+ package_ids: "com.example.app",
35
38
 
36
39
  submit_for_review: false,
37
40
 
@@ -161,7 +161,13 @@ module Fastlane
161
161
  env_name: "HUAWEI_APPGALLERY_DELAY_BEFORE_REVIEW",
162
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
163
  optional: true,
164
- type: Integer)
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)
165
171
  ]
166
172
  end
167
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.18"
3
+ VERSION = "1.0.21"
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.18
4
+ version: 1.0.21
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-17 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