fastlane-plugin-clean_testflight_testers 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7959153b701cc09103e9c8c5593dbb9984c90358
4
- data.tar.gz: de6a1c804eceb031f11c8a5ec690b22139659854
2
+ SHA256:
3
+ metadata.gz: 6cdfa6ddce47046a8d2ff9f5fd751ea737aa49acecabd65e998a99e6c3b8ae22
4
+ data.tar.gz: d9f46b90884a601849954e434c8aae0ab1ec768f546adc59cddafe981b997e43
5
5
  SHA512:
6
- metadata.gz: 48ef207925226c4fac60ee5abe28577fa158781295e1e6510008d68555daccfb25aeb40e83c59cb366b500f9d589febb5dcfc1571452ac12d8ec7445e7922b43
7
- data.tar.gz: 5b1bd35c52b68bca7bca6486895ac9dea3dc212a8e80d8f37fbb8f100c6b864d8ca727e5e8c95712c34cbe508573e3cf1236231b076c4a92af317d9fda93297d
6
+ metadata.gz: c39a42bbb5593adc9302d3b730e5cdba36a156a289dfc547017f1fec99afcd4545a1469615af828facffe5a521ca0a11a6139f01fa07173b4531adbac9d5193e
7
+ data.tar.gz: 3cd3ea3125389b7cf0306b8622652642dd629a86bac4b760ca1d3b4c8c741d53dc49c95950e487f5bb7875033fb142d156055986fa4860be37a50b71f39bc166
@@ -4,39 +4,44 @@ module Fastlane
4
4
  def self.run(params)
5
5
  require 'spaceship'
6
6
 
7
- UI.message("Login to iTunes Connect (#{params[:username]})")
8
- Spaceship::Tunes.login(params[:username])
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::Application.find(params[:app_identifier])
16
- UI.user_error!("Couldn't find app '#{params[:app_identifier]}' on the account of '#{params[:username]}' on iTunes Connect") unless spaceship_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 = Spaceship::TestFlight::Tester.all(app_id: app_id)
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
- days_since_status_change = (Time.now - current_tester.status_mod_time) / 60.0 / 60.0 / 24.0
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 current_tester.status == "invited"
30
+ if tester_metrics.beta_tester_state == "INVITED"
26
31
  if days_since_status_change > params[:days_of_inactivity]
27
- remove_tester(current_tester, app_id, params[:dry_run]) # user got invited, but never installed a build... why would you do that?
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] && current_tester.session_count == 0
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, app_id, params[:dry_run])
40
+ remove_tester(current_tester, spaceship_app, params[:dry_run])
36
41
  counter += 1
37
- elsif params[:oldest_build_allowed] && current_tester.latest_install_info["latestInstalledVersion"].to_i > 0 && current_tester.latest_install_info["latestInstalledVersion"].to_i < 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, app_id, params[:dry_run])
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, app_id, dry_run)
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 #{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 #{app_id}...")
57
- tester.remove_from_app!(app_id: app_id)
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
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module CleanTestflightTesters
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
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.2.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: 2018-01-26 00:00:00.000000000 Z
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
- rubyforge_project:
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