fastlane-plugin-samsungknox 0.1.0 → 0.1.1

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: 13f339b3a0c91bae5b4367b52ddb51edc1677ffb4d648cb4d2bc2ea4edbdb59f
4
- data.tar.gz: a473a896843e29ac7ba7c4e35fadeb4b887f6cd0c8d02306bfbccda9679b92b5
3
+ metadata.gz: a54952079f4f11fcee99287b11a0ebd08c8828671e2cd71a0266cdb3af286d7a
4
+ data.tar.gz: fe1ad89fa1f341bfd0c1cb040fede24a143b0d95c8657e09151d2b60b6b8e7f5
5
5
  SHA512:
6
- metadata.gz: f55918dc6f651cb7206f0b3bbf83e1f8a209db04877d328e7b4ff2fdc485a3da056f4d8d5b321b7e7792e39f7a11794f9ccc3dd2dc84a435f84d7b91b514431b
7
- data.tar.gz: 4a619558aaee807883d1ab61560d56b4e50301bd7f0ea7a0060112e704b0b315b2c9fb310524f60f88dc1e148d2bb89f6c8c337d920da881018f3f3fa7f2da58
6
+ metadata.gz: 6c14c149b851b5755ecbe5a429a6f0fe590f0666047c2c234c80f274e4f612ad94a9feedd2ae188a2edd0f4d8d687e695b0388cd4dabe1a58a4383fa4de8d86c
7
+ data.tar.gz: a0f21411d2e4410266834e8991026f4709bfaf323f65377892c56bedbd4037c6ed20516d3afdaba508f70ca815a473adf8a64ceeec67448416c58e4f3eeabaf8
@@ -25,7 +25,8 @@ module Fastlane
25
25
  KnoxConfigureLibraryUploadApp.upload_app(
26
26
  access_token[:token],
27
27
  params[:app_file_path],
28
- params[:app_description]
28
+ params[:app_description],
29
+ params[:api_region].downcase
29
30
  )
30
31
  end
31
32
 
@@ -5,8 +5,10 @@ module Fastlane
5
5
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
6
 
7
7
  module KnoxConfigureLibraryUploadApp
8
- def self.upload_app(access_token, app_file_path, app_description)
9
- uri = URI('https://eu-kcs-api.samsungknox.com/kcs/v1/kc/applications/upload')
8
+ def self.upload_app(access_token, app_file_path, app_description, api_region)
9
+ UI.header('Step: 📲 Upload Application to Knox Configure Library 📲 ')
10
+
11
+ uri = URI("https://#{api_region}-kcs-api.samsungknox.com/kcs/v1/kc/applications/upload")
10
12
 
11
13
  File.open(app_file_path) do |file|
12
14
  request = Net::HTTP::Post::Multipart.new uri,
@@ -14,17 +16,24 @@ module Fastlane
14
16
 
15
17
  request['X-KNOX-APITOKEN'] = access_token
16
18
 
17
- UI.message("⌛ Uploading the #{'APP'}.")
19
+ UI.message("⌛ Uploading the Application. Please wait a moment...")
18
20
  response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
19
21
  http.request(request)
20
22
  end
21
23
 
22
24
  if response.is_a?(Net::HTTPSuccess)
23
- data = JSON.parse(response.body)
24
- UI.success(data)
25
+ uploadResponseBody = JSON.parse(response.body)
26
+ successResponse = uploadResponseBody['successResponse'][0]
27
+ appInfo = successResponse['appInfo'][0]
28
+ UI.success("🎉 Uploaded Application [#{appInfo['name']}] v#{appInfo['packageVersion']} successfully!")
25
29
  else
26
- raise "Request failed with response: #{response.body}"
27
- end
30
+ uploadResponseBody = JSON.parse(response.body)
31
+ if uploadResponseBody['data'].strip == 'APP_BINARY_EXISTS'
32
+ UI.success("✅ The same Application was found in release with no changes, skipping.")
33
+ else
34
+ raise "Request failed with response: #{response.body}"
35
+ end
36
+ end
28
37
  end
29
38
  end
30
39
  end
@@ -67,7 +67,7 @@ module Fastlane
67
67
 
68
68
  if response.is_a?(Net::HTTPSuccess)
69
69
  data = JSON.parse(response.body)
70
- UI.success('✅ ams accessToken generated successfully!')
70
+ UI.success('✅ ams accessToken generated successfully')
71
71
  return data["accessToken"]
72
72
  else
73
73
  raise "Request failed with response: #{response.body}"
@@ -77,15 +77,15 @@ module Fastlane
77
77
  def self.generate_knox_access_token(credential, clientIdentifierJwtToken, api_region)
78
78
  UI.header('Step: 🔐 KNOX ACCESS TOKEN GENERATE 🔐 ')
79
79
 
80
- UI.message(' Sign the knox token using the credential...')
80
+ UI.message('🔐 Sign in the knox token using the credential...')
81
81
  generate_signed_jwt_result = generate_signed_jwt(credential, clientIdentifierJwtToken, true)
82
82
 
83
83
  base64_encoding_public_Key = generate_signed_jwt_result[:public_key]
84
84
  sign_by_client_identifier_jwt_token = generate_signed_jwt_result[:token]
85
85
 
86
- UI.message('⏳ Request the knox client identifier jwt ams access token...')
86
+ UI.message('⏳ Request the knox client identifier jwt ams access token.')
87
87
  ams_access_token = get_access_token(30, base64_encoding_public_Key, sign_by_client_identifier_jwt_token, api_region)
88
- UI.message(' Sign the knox token using the ams access token and private key...')
88
+ UI.message('🔐 Sign the knox token using the ams access token and private key.')
89
89
  token = generate_signed_jwt(credential, ams_access_token, false)
90
90
 
91
91
  return { token: token[:token] }
@@ -114,7 +114,7 @@ module Fastlane
114
114
 
115
115
  token = JWT.encode(payload, private_key, 'RS512')
116
116
 
117
- UI.success('✅ token generated successfully!')
117
+ UI.success('✅ token generated successfully')
118
118
  return { public_key: public_key, token: token }
119
119
  end
120
120
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Samsungknox
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-samsungknox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jieey1140
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-25 00:00:00.000000000 Z
11
+ date: 2023-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler