fastlane-plugin-huawei_appgallery_connect 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb +8 -2
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_info.rb +76 -0
- data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb +17 -19
- 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: db6448df1270081dea454256e3901e7cfccd87f05b9e567f60ac087a22503712
|
4
|
+
data.tar.gz: 6f45cf3e942fd190878b9bcccc4f517e418e8dde45ee9095e4a46191f4704bff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c3845380567b942d70b03de4d957397078847c870d4c08b3a925981e2ee1d1a310e26d85d80e514022d6616812481c754521a433f6018db18e88d76f24c7ad
|
7
|
+
data.tar.gz: c10c3d520b9dcf5e9fb632a763e4dac72d00603d52439afbc2b2ddf28d560c15db36dfd859e2b1340b5e97893a276708857d4afa5caeb05b0b12c95cc7c7ffc6
|
data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
CHANGED
@@ -17,7 +17,7 @@ module Fastlane
|
|
17
17
|
|
18
18
|
upload_app = Helper::HuaweiAppgalleryConnectHelper.upload_app(token, params[:client_id], params[:app_id], params[:apk_path])
|
19
19
|
|
20
|
-
if upload_app
|
20
|
+
if upload_app && params[:submit_for_review] != false
|
21
21
|
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
22
22
|
end
|
23
23
|
end
|
@@ -121,7 +121,13 @@ module Fastlane
|
|
121
121
|
env_name: "HUAWEI_APPGALLERY_CONNECT_APK_LANGUAGE",
|
122
122
|
description: "Language type. For details, please refer to https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agcapi-reference-langtype",
|
123
123
|
optional: true,
|
124
|
-
type: String)
|
124
|
+
type: String),
|
125
|
+
|
126
|
+
FastlaneCore::ConfigItem.new(key: :submit_for_review,
|
127
|
+
env_name: "HUAWEI_APPGALLERY_SUBMIT_FOR_REVIEW",
|
128
|
+
description: "Should submit the app for review. The default value is true. If set false will only upload the app, and you can submit for review from the console",
|
129
|
+
optional: true,
|
130
|
+
type: Boolean)
|
125
131
|
]
|
126
132
|
end
|
127
133
|
|
data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_info.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_INFO = :ANDROID_APPGALLERY_APP_INFO
|
8
|
+
end
|
9
|
+
class HuaweiAppgalleryConnectGetAppInfoAction < 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
|
+
appInfo = Helper::HuaweiAppgalleryConnectHelper.get_app_info(token, params[:client_id],params[:app_id])
|
18
|
+
Actions.lane_context[SharedValues::ANDROID_APPGALLERY_APP_INFO] = appInfo
|
19
|
+
return appInfo
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.description
|
24
|
+
"Huawei AppGallery Connect Plugin"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.authors
|
28
|
+
["Shreejan Shrestha"]
|
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: :app_id,
|
55
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_APP_ID",
|
56
|
+
description: "Huawei AppGallery Connect App 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_info = huawei_appgallery_connect_get_app_info'
|
71
|
+
]
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
CHANGED
@@ -32,7 +32,15 @@ module Fastlane
|
|
32
32
|
request["Authorization"] = "Bearer #{token}"
|
33
33
|
response = http.request(request)
|
34
34
|
|
35
|
-
result_json = JSON.parse(
|
35
|
+
result_json = JSON.parse(response.body)
|
36
|
+
|
37
|
+
if result_json['ret']['code'] == 0
|
38
|
+
UI.success("Successfully getting app info")
|
39
|
+
return result_json['appInfo']
|
40
|
+
else
|
41
|
+
UI.user_error!("Failed to get app info")
|
42
|
+
end
|
43
|
+
|
36
44
|
end
|
37
45
|
|
38
46
|
def self.update_appinfo(client_id, token, app_id, privacy_policy_url)
|
@@ -73,6 +81,11 @@ module Fastlane
|
|
73
81
|
|
74
82
|
response = http.request(request)
|
75
83
|
|
84
|
+
if !response.kind_of? Net::HTTPSuccess
|
85
|
+
UI.user_error!("Cannot obtain upload url, please check API Token / Permissions (status code: #{response.code})")
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
|
76
89
|
result_json = JSON.parse(response.body)
|
77
90
|
|
78
91
|
if result_json['uploadUrl'].nil?
|
@@ -87,24 +100,9 @@ module Fastlane
|
|
87
100
|
http = Net::HTTP.new(uri.host, uri.port)
|
88
101
|
http.use_ssl = true
|
89
102
|
request = Net::HTTP::Post.new(uri)
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
# add the auth code
|
94
|
-
post_body << "--#{boundary}\r\n"
|
95
|
-
post_body << "Content-Disposition: form-data; name=\"authCode\"\r\n\r\n"
|
96
|
-
post_body << result_json['authCode']
|
97
|
-
# add the file count
|
98
|
-
post_body << "\r\n--#{boundary}\r\n"
|
99
|
-
post_body << "Content-Disposition: form-data; name=\"fileCount\"\r\n\r\n"
|
100
|
-
post_body << "1"
|
101
|
-
# add the apk
|
102
|
-
post_body << "\r\n--#{boundary}\r\n"
|
103
|
-
post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"release.apk\"\r\n"
|
104
|
-
post_body << "Content-Type: multipart/form-data\r\n\r\n"
|
105
|
-
post_body << File.read(apk_path).encode('utf-8')
|
106
|
-
post_body << "\r\n--#{boundary}--\r\n"
|
107
|
-
request.body = post_body.join
|
103
|
+
|
104
|
+
form_data = [['file', File.open(apk_path.to_s)],['authCode', result_json['authCode']],['fileCount', '1']]
|
105
|
+
request.set_form form_data, 'multipart/form-data'
|
108
106
|
|
109
107
|
result = http.request(request)
|
110
108
|
result_json = JSON.parse(result.body)
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shreejan Shrestha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- README.md
|
147
147
|
- lib/fastlane/plugin/huawei_appgallery_connect.rb
|
148
148
|
- lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
|
149
|
+
- lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_get_app_info.rb
|
149
150
|
- lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
|
150
151
|
- lib/fastlane/plugin/huawei_appgallery_connect/version.rb
|
151
152
|
homepage: https://github.com/shr3jn/fastlane-plugin-huawei_appgallery_connect
|