fastlane-plugin-huawei_appgallery_connect 1.0.18 → 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: 13c12a640e892f8a26d41fe23ec060b7151d36fb56792053a0781d77bf6fb698
4
- data.tar.gz: ec69a3d658b3d41c92376a6752ea743984251466f288d6bab34f5cdeca54d3bb
3
+ metadata.gz: 5ad5b99cb7e2f9b8189eb700c3ad1f4bd29a83569a72cc7e095efd5b44e139d1
4
+ data.tar.gz: 5135db4b14e398fddf95ad762129a9acb3cfac6f371453d60a05a38b1749ae51
5
5
  SHA512:
6
- metadata.gz: dcef9055f72ccaf6f08abf8fa5a1ac6a78e2101dfeb896a756bb66c28dcd847f662a0858aa397b029fd0fbae09e654444b39ce0ed3dbcc32bb5c43dc492ac5e0
7
- data.tar.gz: 49feaeecebd261abcc0e63862a6dec3ec6662b831ea77bf582a1036faa2ab422c675ab83d5f9cc88771eec77979ca9c30464dc83449644243df461a4d310fdb6
6
+ metadata.gz: 7d929f54743a20238a21bb3c038c82fb49dd2d15021357ad7a6b8826e19ed62eca52c1f4e140366ece81174243e389b8ee0d4ce97518fc410a315d772f9ab761
7
+ data.tar.gz: 50205181ecf2d71e4360bc332835a5a13dde3a35b1e875a1023940ccdf2b6be7ea6458474e7ae1cbdc19b341bc0ed42906d26b4031537cb85a1fc5ecd2faf88f
@@ -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
 
@@ -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.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.18
4
+ version: 1.0.19
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-02 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