fastlane-plugin-huawei_appgallery_connect 1.0.26 → 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: 0f20c028c8e26916529edfbbb96f65abc93b24dca4e6722b851bc27c92468689
4
- data.tar.gz: 76f394ed59804d49919e962f33252b87d02ec2e0b795f4a15b3b6af831fbbd23
3
+ metadata.gz: 6e4cd56c26e2348508c07b4f09817f4943cf49534e0a4bc34a907856ce380412
4
+ data.tar.gz: 279935cb94b9f7d2e18d3c1cb17a6fe3888eafe18cc34310db82d525673e7942
5
5
  SHA512:
6
- metadata.gz: c015a15fd3c1b8c60ce9a9e9af6216e9c5c9be0ceff5d6098b1b032fa228e0bfe3d3a583c9868c5c38a161e9fa41b183a7d0a04db209ce47f4866c8a4377efe9
7
- data.tar.gz: 6bedf89e173cea230b2acb15262fd6f99308cb40bcbd7332883f6c72d60f90001f11fee64525450868613982ee24da8cfa88e271fc360ba20601a58aef6cd2fc
6
+ metadata.gz: 83f176cd4a84b951ab2f55db38c32267e0dba37f5a244aefd151fbc2b6f572ea30c6ced731a5abf27f1240279b92004ffacdf1e9a8d2b147b00bed9d767a5ffb
7
+ data.tar.gz: 79bb69f5af73ea2c80619ad2407ec7b250d8ffdd482193cca721c2a130ff663230b7b90626c61c9923b5d4e5a78f51d3e0631fb82ac75608a7b86e07e3d1a1c5
data/README.md CHANGED
@@ -16,7 +16,7 @@ Huawei AppGallery Connect Plugin can be used to upload Android application on th
16
16
 
17
17
  ## Usage
18
18
 
19
- To get started you will need the client id, client Secret & app ID which can be obtained from your Huawei AppGallery Connect account.
19
+ To get started you will need the client id, client Secret & app ID which can be obtained from your Huawei AppGallery Connect account OR can be obtained with huawei_appgallery_connect_get_app_id action (please see example below).
20
20
 
21
21
  ```
22
22
  huawei_appgallery_connect(
@@ -50,6 +50,16 @@ huawei_appgallery_connect(
50
50
  )
51
51
  ```
52
52
 
53
+ You can retreive app id by making use of the following action
54
+
55
+ ```
56
+ huawei_appgallery_connect_get_app_id(
57
+ client_id: "<CLIENT_ID>",
58
+ client_secret: "<CLIENT_SECRET>",
59
+ package_id: "<PACKAGE_ID>"
60
+ )
61
+ ```
62
+
53
63
  The following action can be used to submit the app for review if submit_for_review was set to false during the upload of apk
54
64
 
55
65
  ```
@@ -92,6 +102,17 @@ huawei_appgallery_connect_update_app_localization(
92
102
  )
93
103
  ```
94
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
+
95
116
  Your folder structure for applying multiple languages for the metadata should look like this:
96
117
 
97
118
  ```
@@ -0,0 +1,76 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/huawei_appgallery_connect_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ ANDROID_APPGALLERY_APP_ID = :ANDROID_APPGALLERY_APP_ID
8
+ end
9
+ class HuaweiAppgalleryConnectGetAppIdAction < Action
10
+
11
+ def self.run(params)
12
+ token = Helper::HuaweiAppgalleryConnectHelper.get_token(params[:client_id], params[:client_secret])
13
+
14
+ if token.nil?
15
+ UI.message("Cannot retrieve token, please check your client ID and client secret")
16
+ else
17
+ appID = Helper::HuaweiAppgalleryConnectHelper.get_app_id(token, params[:client_id],params[:package_id])
18
+ Actions.lane_context[SharedValues::ANDROID_APPGALLERY_APP_ID] = appID
19
+ return appID
20
+ end
21
+ end
22
+
23
+ def self.description
24
+ "Huawei AppGallery Connect Plugin"
25
+ end
26
+
27
+ def self.authors
28
+ ["Shreejan Shrestha", "Kirill Mandrygin"]
29
+ end
30
+
31
+ def self.return_value
32
+ # If your method provides a return value, you can describe here what it does
33
+ end
34
+
35
+ def self.details
36
+ # Optional:
37
+ "Fastlane plugin to get Android app to Huawei AppGallery Connect information"
38
+ end
39
+
40
+ def self.available_options
41
+ [
42
+ FastlaneCore::ConfigItem.new(key: :client_id,
43
+ env_name: "HUAWEI_APPGALLERY_CONNECT_CLIENT_ID",
44
+ description: "Huawei AppGallery Connect Client ID",
45
+ optional: false,
46
+ type: String),
47
+
48
+ FastlaneCore::ConfigItem.new(key: :client_secret,
49
+ env_name: "HUAWEI_APPGALLERY_CONNECT_CLIENT_SECRET",
50
+ description: "Huawei AppGallery Connect Client Secret",
51
+ optional: false,
52
+ type: String),
53
+
54
+ FastlaneCore::ConfigItem.new(key: :package_id,
55
+ env_name: "HUAWEI_APPGALLERY_CONNECT_PACKAGE_ID",
56
+ description: "Huawei AppGallery Connect Package ID",
57
+ optional: false,
58
+ type: String),
59
+
60
+ ]
61
+ end
62
+
63
+ def self.is_supported?(platform)
64
+ [:android].include?(platform)
65
+ true
66
+ end
67
+
68
+ def self.example_code
69
+ [
70
+ 'app_id = huawei_appgallery_connect_get_app_id'
71
+ ]
72
+ end
73
+
74
+ end
75
+ end
76
+ end
@@ -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
@@ -21,6 +21,33 @@ module Fastlane
21
21
  return result_json['access_token']
22
22
  end
23
23
 
24
+ def self.get_app_id(token, client_id, package_id)
25
+ UI.message("Fetching App ID")
26
+
27
+ uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/appid-list?packageName=#{package_id}")
28
+
29
+ http = Net::HTTP.new(uri.host, uri.port)
30
+ http.use_ssl = true
31
+ request = Net::HTTP::Get.new(uri.request_uri)
32
+ request["client_id"] = client_id
33
+ request["Authorization"] = "Bearer #{token}"
34
+ response = http.request(request)
35
+ if !response.kind_of? Net::HTTPSuccess
36
+ UI.user_error!("Cannot obtain app id, please check API Token / Permissions (status code: #{response.code})")
37
+ return false
38
+ end
39
+ result_json = JSON.parse(response.body)
40
+
41
+ if result_json['ret']['code'] == 0
42
+ UI.success("Successfully getting app id")
43
+ return result_json['appids'][0]['value']
44
+ else
45
+ UI.user_error!(result_json)
46
+ UI.user_error!("Failed to get app id")
47
+ end
48
+
49
+ end
50
+
24
51
  def self.get_app_info(token, client_id, app_id)
25
52
  UI.message("Fetching App Info")
26
53
 
@@ -342,6 +369,36 @@ module Fastlane
342
369
  end
343
370
  end
344
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
+
345
402
  end
346
403
  end
347
404
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module HuaweiAppgalleryConnect
3
- VERSION = "1.0.26"
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.26
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-05-30 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
@@ -160,7 +160,9 @@ files:
160
160
  - README.md
161
161
  - lib/fastlane/plugin/huawei_appgallery_connect.rb
162
162
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
163
+ - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_id.rb
163
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
164
166
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_submit_for_review.rb
165
167
  - lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_update_app_localization.rb
166
168
  - lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb