fastlane-plugin-huawei_appgallery_connect 1.0.18 → 1.0.19
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 +4 -4
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_update_app_localization.rb +65 -0
- data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb +58 -2
- data/lib/fastlane/plugin/huawei_appgallery_connect/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad5b99cb7e2f9b8189eb700c3ad1f4bd29a83569a72cc7e095efd5b44e139d1
|
4
|
+
data.tar.gz: 5135db4b14e398fddf95ad762129a9acb3cfac6f371453d60a05a38b1749ae51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
CHANGED
@@ -229,7 +229,7 @@ module Fastlane
|
|
229
229
|
end
|
230
230
|
|
231
231
|
if params[:release_time] != nil
|
232
|
-
params[:release_time] = URI
|
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
|
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
|
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.
|
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:
|
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.
|
173
|
+
rubygems_version: 3.0.9
|
173
174
|
signing_key:
|
174
175
|
specification_version: 4
|
175
176
|
summary: Huawei AppGallery Connect Plugin
|