fastlane-plugin-clean_testflight_testers 0.2.0 → 0.3.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6cdfa6ddce47046a8d2ff9f5fd751ea737aa49acecabd65e998a99e6c3b8ae22
|
4
|
+
data.tar.gz: d9f46b90884a601849954e434c8aae0ab1ec768f546adc59cddafe981b997e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39a42bbb5593adc9302d3b730e5cdba36a156a289dfc547017f1fec99afcd4545a1469615af828facffe5a521ca0a11a6139f01fa07173b4531adbac9d5193e
|
7
|
+
data.tar.gz: 3cd3ea3125389b7cf0306b8622652642dd629a86bac4b760ca1d3b4c8c741d53dc49c95950e487f5bb7875033fb142d156055986fa4860be37a50b71f39bc166
|
data/lib/fastlane/plugin/clean_testflight_testers/actions/clean_testflight_testers_action.rb
CHANGED
@@ -4,39 +4,44 @@ module Fastlane
|
|
4
4
|
def self.run(params)
|
5
5
|
require 'spaceship'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
app_identifier = params[:app_identifier]
|
8
|
+
username = params[:username]
|
9
|
+
|
10
|
+
UI.message("Login to iTunes Connect (#{username})")
|
11
|
+
Spaceship::Tunes.login(username)
|
9
12
|
Spaceship::Tunes.select_team
|
10
13
|
UI.message("Login successful")
|
11
14
|
|
12
15
|
UI.message("Fetching all TestFlight testers, this might take a few minutes, depending on the number of testers")
|
13
16
|
|
14
17
|
# Convert from bundle identifier to app ID
|
15
|
-
spaceship_app ||= Spaceship::
|
16
|
-
UI.user_error!("Couldn't find app '#{
|
17
|
-
app_id = spaceship_app.apple_id
|
18
|
+
spaceship_app ||= Spaceship::ConnectAPI::App.find(app_identifier)
|
19
|
+
UI.user_error!("Couldn't find app '#{app_identifier}' on the account of '#{username}' on iTunes Connect") unless spaceship_app
|
18
20
|
|
19
|
-
all_testers =
|
21
|
+
all_testers = spaceship_app.get_beta_testers(includes: "betaTesterMetrics", limit: 200)
|
20
22
|
counter = 0
|
21
23
|
|
22
24
|
all_testers.each do |current_tester|
|
23
|
-
|
25
|
+
tester_metrics = current_tester.beta_tester_metrics.first
|
26
|
+
|
27
|
+
time = Time.parse(tester_metrics.last_modified_date)
|
28
|
+
days_since_status_change = (Time.now - time) / 60.0 / 60.0 / 24.0
|
24
29
|
|
25
|
-
if
|
30
|
+
if tester_metrics.beta_tester_state == "INVITED"
|
26
31
|
if days_since_status_change > params[:days_of_inactivity]
|
27
|
-
remove_tester(current_tester,
|
32
|
+
remove_tester(current_tester, spaceship_app, params[:dry_run]) # user got invited, but never installed a build... why would you do that?
|
28
33
|
counter += 1
|
29
34
|
end
|
30
35
|
else
|
31
36
|
# We don't really have a good way to detect whether the user is active unfortunately
|
32
37
|
# So we can just delete users that had no sessions
|
33
|
-
if days_since_status_change > params[:days_of_inactivity] &&
|
38
|
+
if days_since_status_change > params[:days_of_inactivity] && tester_metrics.session_count == 0
|
34
39
|
# User had no sessions in the last e.g. 30 days, let's get rid of them
|
35
|
-
remove_tester(current_tester,
|
40
|
+
remove_tester(current_tester, spaceship_app, params[:dry_run])
|
36
41
|
counter += 1
|
37
|
-
elsif params[:oldest_build_allowed] &&
|
42
|
+
elsif params[:oldest_build_allowed] && tester_metrics.installed_cf_bundle_short_version_string.to_i > 0 && tester_metrics.installed_cf_bundle_short_version_string.to_i < params[:oldest_build_allowed]
|
38
43
|
# User has a build that is too old, let's get rid of them
|
39
|
-
remove_tester(current_tester,
|
44
|
+
remove_tester(current_tester, spaceship_app, params[:dry_run])
|
40
45
|
counter += 1
|
41
46
|
end
|
42
47
|
end
|
@@ -49,12 +54,12 @@ module Fastlane
|
|
49
54
|
end
|
50
55
|
end
|
51
56
|
|
52
|
-
def self.remove_tester(tester,
|
57
|
+
def self.remove_tester(tester, app, dry_run)
|
53
58
|
if dry_run
|
54
|
-
UI.message("TestFlight tester #{tester.email} seems to be inactive for app ID #{
|
59
|
+
UI.message("TestFlight tester #{tester.email} seems to be inactive for app ID #{app.id}")
|
55
60
|
else
|
56
|
-
UI.message("Removing tester #{tester.email} due to inactivity from app ID #{
|
57
|
-
tester.
|
61
|
+
UI.message("Removing tester #{tester.email} due to inactivity from app ID #{app.id}...")
|
62
|
+
tester.delete_from_apps(apps: [app])
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-clean_testflight_testers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -139,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.6.10
|
142
|
+
rubygems_version: 3.0.3
|
144
143
|
signing_key:
|
145
144
|
specification_version: 4
|
146
145
|
summary: Automatically remove TestFlight testers that are not actually testing your
|