fastlane-plugin-taiwan_number_one 1.0.1 → 1.1.3

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: c7a52ae95184c56210567ff8e07044f3211006e0c2573ae4bca75fe92e2fde95
4
- data.tar.gz: 4566306d89b9d912349db6e51006e498b4504dc88e8b32504728807fbbcc4ef4
3
+ metadata.gz: 1c5ccf4c9522f758764660d86f7faf7fd084922efff188b493bf3b5467732783
4
+ data.tar.gz: 9d437678f413a529a6f1644bfc8a7d988b74e8d4e460e4ac784343b96adcd4e1
5
5
  SHA512:
6
- metadata.gz: 994f6edc6152386ee0d3c1c571600e0a63dc6b28fa312c42a9d2d45f6afd2e076357b0ba75ce830cfb333ca3fd8a844f589274281586edddf659cc01b29e8e48
7
- data.tar.gz: 74195ccb3f67a13e2e7a962a9e568247225d7497e6fece51661d924d26652a1b35a58d306f046c2173b918a01301fd0d9b7c9220049a23c7b52bfaa6956d04f5
6
+ metadata.gz: 32a3f59ae71f9436841279b95d0d3bc34181bd35c2952565703fd7a01552b15eadfef2798b97eed2526ad46a37005ee19083127761e3eb1ad5ebc7612634ac4b
7
+ data.tar.gz: a58410635d23aa6f37d7757ef78acd4e1d0fe4009cef686c78e6bb7b44312d8a5840611682c87f06a5462ce2d22ed5b6168cefb8cd5ceff7fd1421b0f7c9da49
@@ -53,14 +53,14 @@ module Fastlane
53
53
  ].join(","),
54
54
  platform: platform
55
55
  }
56
-
56
+
57
57
  decision ||= fetch_decision(params)
58
58
  if params[:force] && decision == DecisionType::REJECT
59
59
  UI.message("decision is reject")
60
60
  app_store_version = app.get_app_store_versions(client: client, includes: "appStoreVersionSubmission")
61
- .sort_by { |v| Gem::Version.new(v.version_string) }
62
- .last
63
- return reject_version_if_possible(app: app, app_store_version: app_store_version)
61
+ .sort_by { |v| Gem::Version.new(v.version_string) }
62
+ .last
63
+ return reject_version_if_possible(client: client, app_store_version: app_store_version)
64
64
  end
65
65
 
66
66
  app_store_version = app.get_app_store_versions(client: client, filter: filter, includes: "appStoreVersionSubmission")
@@ -83,7 +83,7 @@ module Fastlane
83
83
  result = release_version_if_possible(app: app, app_store_version: app_store_version, token: token)
84
84
  when DecisionType::REJECT
85
85
  UI.message("decision is reject")
86
- result = reject_version_if_possible(app: app, app_store_version: app_store_version)
86
+ result = reject_version_if_possible(client: client, app_store_version: app_store_version)
87
87
  else
88
88
  UI.user_error!("App's decision must be release or reject")
89
89
  result = ActionResult::DO_NOTHING
@@ -126,39 +126,29 @@ module Fastlane
126
126
  return ActionResult::DO_NOTHING
127
127
  end
128
128
 
129
- begin
130
- if token
131
- now = Time.now
132
- release_date_string = now.strftime("%Y-%m-%dT%H:00%:z")
133
- app_store_version.update(attributes: {
134
- earliest_release_date: release_date_string,
135
- release_type: Spaceship::ConnectAPI::AppStoreVersion::ReleaseType::SCHEDULED
136
- })
137
- return ActionResult::SUCCESS
138
- else
139
- app_store_version.create_app_store_version_release_request
140
- UI.message("release version #{app_store_version.version_string} successfully!")
141
- return ActionResult::SUCCESS
142
- end
143
- rescue => e
144
- UI.user_error!("An error occurred while releasing version #{app_store_version}, #{e.message}\n#{e.backtrace.join("\n")}")
145
- return ActionResult::DO_NOTHING
129
+ version = app.get_pending_release_app_store_version
130
+ if version.nil? == false
131
+ Spaceship::ConnectAPI.post_app_store_version_release_request(app_store_version_id: version.id)
132
+ UI.message("release version #{app_store_version} successfully!")
133
+ return ActionResult::SUCCESS
134
+ else
135
+ UI.user_error!("version not found while releasing version #{app_store_version}, #{e.message}\n#{e.backtrace.join("\n")}")
146
136
  end
147
137
  end
148
138
 
149
- def self.reject_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
150
- unless app
151
- UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
139
+ # For example https://appstoreconnect.apple.com/iris/v1/appStoreVersionSubmissions/575ee084-a3a6-4664-8ba5-49dd77a00927
140
+ # Request Method: DELETE
141
+ def self.reject_version_if_possible(client: Spaceship::ConnectAPI, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
142
+ if app_store_version.app_store_state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REJECTED
143
+ UI.message("app_store_state is already #{app_store_version.app_store_state}")
144
+ UI.message("🇹🇼 Taiwan helps you do nothing!")
152
145
  return ActionResult::DO_NOTHING
153
146
  end
154
147
 
155
- if app_store_version.reject!
156
- UI.success("rejected version #{app_store_version.version_string} Successfully!")
157
- return ActionResult::SUCCESS
158
- else
159
- UI.user_error!("An error occurred while rejected version #{app_store_version}")
160
- return ActionResult::DO_NOTHING
161
- end
148
+ client.delete_app_store_version_submission(app_store_version_submission_id: app_store_version.id)
149
+ UI.success("Rejected version #{app_store_version.version_string} Successfully!")
150
+ UI.message("🇹🇼 Taiwan can help!")
151
+ return ActionResult::SUCCESS
162
152
  end
163
153
 
164
154
  def self.api_token(params)
@@ -186,8 +176,8 @@ module Fastlane
186
176
 
187
177
  def self.output
188
178
  [
189
- [ActionResult::SUCCESS, 'Successfully release or reject.'],
190
- [ActionResult::DO_NOTHING, 'Do nothing.']
179
+ [ActionResult::SUCCESS, "Successfully release or reject."],
180
+ [ActionResult::DO_NOTHING, "Do nothing."]
191
181
  ]
192
182
  end
193
183
 
@@ -258,7 +248,7 @@ module Fastlane
258
248
  env_name: "FL_DECISION_FORCE",
259
249
  description: "Skip verifying of current version state for reject reviewed version or cancel waiting review version",
260
250
  is_string: false,
261
- default_value: false),
251
+ default_value: false)
262
252
  ]
263
253
  end
264
254
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TaiwanNumberOne
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-taiwan_number_one
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrew54068
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-06 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry