fastlane-plugin-huawei_appgallery_connect 1.0.27 → 1.0.28

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: 3572c301afd996aadeccb467e91daaa3b8514d7dd6837b9ee6d13d335da35773
4
- data.tar.gz: 9cba86c4dee9506d332c246bee527b27357ad7b4369c385255ed4bcf27093273
3
+ metadata.gz: 6e4cd56c26e2348508c07b4f09817f4943cf49534e0a4bc34a907856ce380412
4
+ data.tar.gz: 279935cb94b9f7d2e18d3c1cb17a6fe3888eafe18cc34310db82d525673e7942
5
5
  SHA512:
6
- metadata.gz: b3e891f32a127c782092c5011b060b9184c022702af2ff90b7e968824ddaa9d30d25fab56cea0aae4a1f9bac9f6f51063565cb91d8cb795e60df2f394f6e7789
7
- data.tar.gz: 03fed4623c6d833b221228e56513368b58a1846688ba56f69e78ab4f0ba7e778779784e102af47f2fd4ca01c6e746fbd6d96ae15f3570311e78fac3de2675e6d
6
+ metadata.gz: 83f176cd4a84b951ab2f55db38c32267e0dba37f5a244aefd151fbc2b6f572ea30c6ced731a5abf27f1240279b92004ffacdf1e9a8d2b147b00bed9d767a5ffb
7
+ data.tar.gz: 79bb69f5af73ea2c80619ad2407ec7b250d8ffdd482193cca721c2a130ff663230b7b90626c61c9923b5d4e5a78f51d3e0631fb82ac75608a7b86e07e3d1a1c5
data/README.md CHANGED
@@ -102,6 +102,17 @@ huawei_appgallery_connect_update_app_localization(
102
102
  )
103
103
  ```
104
104
 
105
+ To update the GMS dependency of the app, use the following action
106
+
107
+ ```
108
+ huawei_appgallery_connect_update_app_localization(
109
+ client_id: "<CLIENT_ID>",
110
+ client_secret: "<CLIENT_SECRET>",
111
+ app_id: "<APP_ID>",
112
+ gms_dependency: 1 #Indicates whether an app depends on GMS. 1: Yes, 0: No
113
+ )
114
+ ```
115
+
105
116
  Your folder structure for applying multiple languages for the metadata should look like this:
106
117
 
107
118
  ```
@@ -0,0 +1,75 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/huawei_appgallery_connect_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class HuaweiAppgalleryConnectSetGmsDependencyAction < Action
7
+
8
+ def self.run(params)
9
+ token = Helper::HuaweiAppgalleryConnectHelper.get_token(params[:client_id], params[:client_secret])
10
+
11
+ if token.nil?
12
+ UI.message("Cannot retrieve token, please check your client ID and client secret")
13
+ else
14
+ Helper::HuaweiAppgalleryConnectHelper.set_gms_dependency(token,
15
+ params[:client_id],
16
+ params[:app_id],
17
+ params[:gms_dependency]
18
+ )
19
+ end
20
+ end
21
+
22
+ def self.description
23
+ "Huawei AppGallery Connect Plugin"
24
+ end
25
+
26
+ def self.authors
27
+ ["Shreejan Shrestha"]
28
+ end
29
+
30
+ def self.return_value
31
+ # If your method provides a return value, you can describe here what it does
32
+ end
33
+
34
+ def self.details
35
+ # Optional:
36
+ "Set GMS Dependency"
37
+ end
38
+
39
+ def self.available_options
40
+ [
41
+ FastlaneCore::ConfigItem.new(key: :client_id,
42
+ env_name: "HUAWEI_APPGALLERY_CONNECT_CLIENT_ID",
43
+ description: "Huawei AppGallery Connect Client ID",
44
+ optional: false,
45
+ type: String),
46
+
47
+ FastlaneCore::ConfigItem.new(key: :client_secret,
48
+ env_name: "HUAWEI_APPGALLERY_CONNECT_CLIENT_SECRET",
49
+ description: "Huawei AppGallery Connect Client Secret",
50
+ optional: false,
51
+ type: String),
52
+
53
+ FastlaneCore::ConfigItem.new(key: :app_id,
54
+ env_name: "HUAWEI_APPGALLERY_CONNECT_APP_ID",
55
+ description: "Huawei AppGallery Connect App ID",
56
+ optional: false,
57
+ type: String),
58
+
59
+ FastlaneCore::ConfigItem.new(key: :gms_dependency,
60
+ env_name: "HUAWEI_APPGALLERY_CONNECT_GMS_DEPENDENCY",
61
+ description: "GMS Dependency of the app. (0 for no, 1 for yes)",
62
+ optional: false,
63
+ type: Integer),
64
+
65
+ ]
66
+ end
67
+
68
+ def self.is_supported?(platform)
69
+ [:android].include?(platform)
70
+ true
71
+ end
72
+
73
+ end
74
+ end
75
+ end
@@ -369,6 +369,36 @@ module Fastlane
369
369
  end
370
370
  end
371
371
  end
372
+
373
+ def self.set_gms_dependency(token, client_id, app_id, gms_dependency)
374
+ UI.message("Setting GMS Dependency")
375
+
376
+ uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/properties/gms?appId=#{app_id}")
377
+
378
+ http = Net::HTTP.new(uri.host, uri.port)
379
+ http.use_ssl = true
380
+ request = Net::HTTP::Put.new(uri.request_uri)
381
+ request["client_id"] = client_id
382
+ request["Authorization"] = "Bearer #{token}"
383
+ request["Content-Type"] = "application/json"
384
+
385
+ request.body = {needGms: gms_dependency}.to_json
386
+
387
+ response = http.request(request)
388
+ if !response.kind_of? Net::HTTPSuccess
389
+ UI.user_error!("Cannot update gms dependency, please check API Token / Permissions (status code: #{response.code})")
390
+ return false
391
+ end
392
+ result_json = JSON.parse(response.body)
393
+
394
+ if result_json['ret']['code'] == 0
395
+ UI.success("Successfully updated GMS Dependency")
396
+ else
397
+ UI.user_error!(result_json)
398
+ UI.user_error!("Failed to update GMS Dependency")
399
+ end
400
+ end
401
+
372
402
  end
373
403
  end
374
404
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module HuaweiAppgalleryConnect
3
- VERSION = "1.0.27"
3
+ VERSION = "1.0.28"
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.27
4
+ version: 1.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shreejan Shrestha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-05 00:00:00.000000000 Z
11
+ date: 2023-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -162,6 +162,7 @@ files:
162
162
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
163
163
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_id.rb
164
164
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_info.rb
165
+ - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_set_gms_dependency.rb
165
166
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_submit_for_review.rb
166
167
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_update_app_localization.rb
167
168
  - lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb