fastlane-plugin-huawei_appgallery_connect 1.0.25 → 1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_id.rb +76 -0
- data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb +28 -1
- data/lib/fastlane/plugin/huawei_appgallery_connect/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3572c301afd996aadeccb467e91daaa3b8514d7dd6837b9ee6d13d335da35773
|
4
|
+
data.tar.gz: 9cba86c4dee9506d332c246bee527b27357ad7b4369c385255ed4bcf27093273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3e891f32a127c782092c5011b060b9184c022702af2ff90b7e968824ddaa9d30d25fab56cea0aae4a1f9bac9f6f51063565cb91d8cb795e60df2f394f6e7789
|
7
|
+
data.tar.gz: 03fed4623c6d833b221228e56513368b58a1846688ba56f69e78ab4f0ba7e778779784e102af47f2fd4ca01c6e746fbd6d96ae15f3570311e78fac3de2675e6d
|
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
|
```
|
data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_id.rb
ADDED
@@ -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
|
data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'fastlane_core/ui/ui'
|
2
|
-
require '
|
2
|
+
require 'cgi'
|
3
3
|
|
4
4
|
module Fastlane
|
5
5
|
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
@@ -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
|
|
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.27
|
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
|
11
|
+
date: 2023-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -160,6 +160,7 @@ 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
|
164
165
|
- lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_submit_for_review.rb
|
165
166
|
- lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_update_app_localization.rb
|