fastlane 2.169.0 → 2.174.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +76 -76
  3. data/deliver/lib/deliver/app_screenshot.rb +5 -7
  4. data/deliver/lib/deliver/app_screenshot_validator.rb +108 -0
  5. data/deliver/lib/deliver/commands_generator.rb +1 -1
  6. data/deliver/lib/deliver/loader.rb +13 -29
  7. data/deliver/lib/deliver/setup.rb +8 -3
  8. data/deliver/lib/deliver/upload_metadata.rb +5 -3
  9. data/fastlane/lib/fastlane/actions/add_git_tag.rb +12 -3
  10. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +1 -0
  11. data/fastlane/lib/fastlane/actions/appetize.rb +13 -1
  12. data/fastlane/lib/fastlane/actions/artifactory.rb +36 -3
  13. data/fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb +10 -2
  14. data/fastlane/lib/fastlane/actions/build_app.rb +3 -1
  15. data/fastlane/lib/fastlane/actions/carthage.rb +22 -0
  16. data/fastlane/lib/fastlane/actions/cocoapods.rb +15 -1
  17. data/fastlane/lib/fastlane/actions/create_pull_request.rb +16 -1
  18. data/fastlane/lib/fastlane/actions/create_xcframework.rb +118 -0
  19. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +1 -1
  20. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +4 -0
  21. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +5 -1
  22. data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +142 -0
  23. data/fastlane/lib/fastlane/actions/download_dsyms.rb +0 -1
  24. data/fastlane/lib/fastlane/actions/git_commit.rb +6 -2
  25. data/fastlane/lib/fastlane/actions/github_api.rb +14 -3
  26. data/fastlane/lib/fastlane/actions/nexus_upload.rb +1 -0
  27. data/fastlane/lib/fastlane/actions/onesignal.rb +13 -3
  28. data/fastlane/lib/fastlane/actions/pod_push.rb +9 -0
  29. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +9 -1
  30. data/fastlane/lib/fastlane/actions/register_device.rb +1 -1
  31. data/fastlane/lib/fastlane/actions/register_devices.rb +2 -1
  32. data/fastlane/lib/fastlane/actions/set_github_release.rb +21 -8
  33. data/fastlane/lib/fastlane/actions/slack.rb +4 -5
  34. data/fastlane/lib/fastlane/actions/spm.rb +2 -2
  35. data/fastlane/lib/fastlane/actions/swiftlint.rb +4 -4
  36. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +291 -0
  37. data/fastlane/lib/fastlane/cli_tools_distributor.rb +3 -0
  38. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -1
  39. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -0
  40. data/fastlane/lib/fastlane/version.rb +1 -1
  41. data/fastlane/swift/Actions.swift +1 -1
  42. data/fastlane/swift/Appfile.swift +1 -1
  43. data/fastlane/swift/ArgumentProcessor.swift +1 -1
  44. data/fastlane/swift/ControlCommand.swift +1 -1
  45. data/fastlane/swift/Deliverfile.swift +2 -2
  46. data/fastlane/swift/DeliverfileProtocol.swift +2 -2
  47. data/fastlane/swift/Fastlane.swift +253 -37
  48. data/fastlane/swift/Gymfile.swift +2 -2
  49. data/fastlane/swift/GymfileProtocol.swift +11 -3
  50. data/fastlane/swift/LaneFileProtocol.swift +1 -1
  51. data/fastlane/swift/MainProcess.swift +1 -1
  52. data/fastlane/swift/Matchfile.swift +2 -2
  53. data/fastlane/swift/MatchfileProtocol.swift +2 -2
  54. data/fastlane/swift/Plugins.swift +1 -1
  55. data/fastlane/swift/Precheckfile.swift +2 -2
  56. data/fastlane/swift/PrecheckfileProtocol.swift +6 -2
  57. data/fastlane/swift/RubyCommand.swift +1 -1
  58. data/fastlane/swift/RubyCommandable.swift +1 -1
  59. data/fastlane/swift/Runner.swift +2 -2
  60. data/fastlane/swift/RunnerArgument.swift +1 -1
  61. data/fastlane/swift/Scanfile.swift +2 -2
  62. data/fastlane/swift/ScanfileProtocol.swift +14 -2
  63. data/fastlane/swift/Screengrabfile.swift +2 -2
  64. data/fastlane/swift/ScreengrabfileProtocol.swift +2 -2
  65. data/fastlane/swift/Snapshotfile.swift +2 -2
  66. data/fastlane/swift/SnapshotfileProtocol.swift +15 -3
  67. data/fastlane/swift/SocketClient.swift +1 -1
  68. data/fastlane/swift/SocketClientDelegateProtocol.swift +1 -1
  69. data/fastlane/swift/SocketResponse.swift +1 -1
  70. data/fastlane/swift/formatting/Brewfile.lock.json +18 -14
  71. data/fastlane/swift/main.swift +1 -1
  72. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +7 -1
  73. data/fastlane_core/lib/fastlane_core/helper.rb +2 -2
  74. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +41 -16
  75. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -4
  76. data/fastlane_core/lib/fastlane_core/project.rb +41 -14
  77. data/frameit/lib/frameit/device_types.rb +7 -1
  78. data/gym/lib/gym/error_handler.rb +8 -0
  79. data/gym/lib/gym/generators/build_command_generator.rb +3 -1
  80. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  81. data/gym/lib/gym/options.rb +12 -2
  82. data/match/lib/match/encryption/openssl.rb +4 -2
  83. data/match/lib/match/runner.rb +1 -1
  84. data/match/lib/match/storage/git_storage.rb +14 -10
  85. data/precheck/lib/precheck/options.rb +6 -1
  86. data/precheck/lib/precheck/rule_processor.rb +1 -1
  87. data/precheck/lib/precheck/runner.rb +1 -1
  88. data/scan/lib/scan/options.rb +15 -0
  89. data/scan/lib/scan/runner.rb +6 -1
  90. data/scan/lib/scan/slack_poster.rb +4 -1
  91. data/scan/lib/scan/test_command_generator.rb +3 -1
  92. data/screengrab/lib/screengrab/runner.rb +2 -0
  93. data/sigh/lib/sigh/runner.rb +1 -1
  94. data/snapshot/lib/assets/SnapshotHelper.swift +1 -1
  95. data/snapshot/lib/snapshot/options.rb +17 -2
  96. data/snapshot/lib/snapshot/update.rb +1 -1
  97. data/spaceship/lib/spaceship/client.rb +14 -1
  98. data/spaceship/lib/spaceship/connect_api.rb +6 -0
  99. data/spaceship/lib/spaceship/connect_api/api_client.rb +17 -2
  100. data/spaceship/lib/spaceship/connect_api/models/app.rb +6 -0
  101. data/spaceship/lib/spaceship/connect_api/models/app_data_usage.rb +59 -0
  102. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_category.rb +65 -0
  103. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_data_protection.rb +27 -0
  104. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_grouping.rb +18 -0
  105. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_purposes.rb +37 -0
  106. data/spaceship/lib/spaceship/connect_api/models/app_data_usages_publish_state.rb +36 -0
  107. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +7 -1
  108. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +9 -0
  109. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +24 -0
  110. data/spaceship/lib/spaceship/connect_api/models/bundle_id_capability.rb +26 -4
  111. data/spaceship/lib/spaceship/connect_api/models/device.rb +30 -0
  112. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +53 -0
  113. data/spaceship/lib/spaceship/connect_api/response.rb +3 -1
  114. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
  115. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +103 -0
  116. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +1 -0
  117. data/spaceship/lib/spaceship/upgrade_2fa_later_client.rb +91 -0
  118. metadata +45 -25
  119. data/cert/lib/cert/.options.rb.swp +0 -0
  120. data/cert/lib/cert/.runner.rb.swp +0 -0
  121. data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
  122. data/match/lib/match/.options.rb.swp +0 -0
  123. data/sigh/lib/sigh/.options.rb.swp +0 -0
@@ -411,6 +411,11 @@ module Scan
411
411
  description: "Only post on Slack if the tests fail",
412
412
  is_string: false,
413
413
  default_value: false),
414
+ FastlaneCore::ConfigItem.new(key: :slack_default_payloads,
415
+ env_name: "SCAN_SLACK_DEFAULT_PAYLOADS",
416
+ description: "Specifies default payloads to include in Slack messages. For more info visit https://docs.fastlane.tools/actions/slack",
417
+ optional: true,
418
+ type: Array),
414
419
 
415
420
  # misc
416
421
  FastlaneCore::ConfigItem.new(key: :destination,
@@ -446,6 +451,16 @@ module Scan
446
451
  description: "Sets a custom path for Swift Package Manager dependencies",
447
452
  type: String,
448
453
  optional: true),
454
+ FastlaneCore::ConfigItem.new(key: :skip_package_dependencies_resolution,
455
+ env_name: "SCAN_SKIP_PACKAGE_DEPENDENCIES_RESOLUTION",
456
+ description: "Skips resolution of Swift Package Manager dependencies",
457
+ type: Boolean,
458
+ default_value: false),
459
+ FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
460
+ env_name: "SCAN_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
461
+ description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file",
462
+ type: Boolean,
463
+ default_value: false),
449
464
  FastlaneCore::ConfigItem.new(key: :use_system_scm,
450
465
  env_name: "SCAN_USE_SYSTEM_SCM",
451
466
  description: "Lets xcodebuild use system's scm configuration",
@@ -83,7 +83,12 @@ module Scan
83
83
  end
84
84
 
85
85
  def handle_results(tests_exit_status)
86
- return if Scan.config[:disable_xcpretty]
86
+ if Scan.config[:disable_xcpretty]
87
+ unless tests_exit_status == 0
88
+ UI.test_failure!("Test execution failed. Exit status: #{tests_exit_status}")
89
+ end
90
+ return
91
+ end
87
92
 
88
93
  result = TestResultParser.new.parse_result(test_results)
89
94
  SlackPoster.new.run(result)
@@ -1,5 +1,6 @@
1
1
  require 'fastlane/action'
2
2
  require 'fastlane/actions/slack'
3
+ require 'fastlane_core/configuration/configuration'
3
4
 
4
5
  require_relative 'module'
5
6
 
@@ -43,7 +44,7 @@ module Scan
43
44
  }
44
45
  end
45
46
 
46
- Fastlane::Actions::SlackAction.run({
47
+ options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, {
47
48
  message: "#{Scan.config[:app_name] || Scan.project.app_name} Tests:\n#{Scan.config[:slack_message]}",
48
49
  channel: channel,
49
50
  slack_url: Scan.config[:slack_url].to_s,
@@ -51,10 +52,12 @@ module Scan
51
52
  username: username,
52
53
  icon_url: icon_url,
53
54
  payload: {},
55
+ default_payloads: Scan.config[:slack_default_payloads],
54
56
  attachment_properties: {
55
57
  fields: fields
56
58
  }
57
59
  })
60
+ Fastlane::Actions::SlackAction.run(options)
58
61
  end
59
62
  end
60
63
  end
@@ -32,13 +32,15 @@ module Scan
32
32
 
33
33
  options = []
34
34
  options += project_path_array unless config[:xctestrun]
35
- options << "-scmProvider system" if config[:use_system_scm]
36
35
  options << "-sdk '#{config[:sdk]}'" if config[:sdk]
37
36
  options << destination # generated in `detect_values`
38
37
  options << "-toolchain '#{config[:toolchain]}'" if config[:toolchain]
39
38
  if config[:derived_data_path] && !options.include?("-derivedDataPath #{config[:derived_data_path].shellescape}")
40
39
  options << "-derivedDataPath #{config[:derived_data_path].shellescape}"
41
40
  end
41
+ if config[:use_system_scm] && !options.include?("-scmProvider system")
42
+ options << "-scmProvider system"
43
+ end
42
44
  options << "-resultBundlePath '#{result_bundle_path}'" if config[:result_bundle]
43
45
  if FastlaneCore::Helper.xcode_at_least?(10)
44
46
  options << "-parallel-testing-worker-count #{config[:concurrent_workers]}" if config[:concurrent_workers]
@@ -24,6 +24,8 @@ module Screengrab
24
24
  end
25
25
 
26
26
  def run
27
+ # Standardize the locales
28
+ @config[:locales].map! { |locale| locale.gsub("_", "-") }
27
29
  FastlaneCore::PrintTable.print_values(config: @config, hide_keys: [], title: "Summary for screengrab #{Fastlane::VERSION}")
28
30
 
29
31
  app_apk_path = @config.fetch(:app_apk_path, ask: false)
@@ -327,7 +327,7 @@ module Sigh
327
327
  UI.important("Found more than one code signing identity. Choosing the first one. Check out `fastlane sigh --help` to see all available options.")
328
328
  UI.important("Available Code Signing Identities for current filters:")
329
329
  certificates.each do |c|
330
- str = ["\t- Name:", c.display_name, "- ID:", c.id + " - Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
330
+ str = ["\t- Name:", c.display_name, "- ID:", c.id + " - Expires", Time.parse(c.expiration_date).strftime("%Y-%m-%d")].join(" ")
331
331
  UI.message(str.green)
332
332
  end
333
333
  end
@@ -227,7 +227,7 @@ open class Snapshot: NSObject {
227
227
  #if os(OSX)
228
228
  let homeDir = URL(fileURLWithPath: NSHomeDirectory())
229
229
  return homeDir.appendingPathComponent(cachePath)
230
- #elseif arch(i386) || arch(x86_64)
230
+ #elseif arch(i386) || arch(x86_64) || arch(arm64)
231
231
  guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else {
232
232
  throw SnapshotError.cannotFindSimulatorHomeDirectory
233
233
  }
@@ -123,7 +123,7 @@ module Snapshot
123
123
  type: Boolean),
124
124
  FastlaneCore::ConfigItem.new(key: :override_status_bar,
125
125
  env_name: 'SNAPSHOT_OVERRIDE_STATUS_BAR',
126
- description: "Enabling this option wil automatically override the status bar to show 9:41 AM, full battery, and full reception",
126
+ description: "Enabling this option will automatically override the status bar to show 9:41 AM, full battery, and full reception",
127
127
  default_value: false,
128
128
  is_string: false),
129
129
  FastlaneCore::ConfigItem.new(key: :localize_simulator,
@@ -253,6 +253,16 @@ module Snapshot
253
253
  description: "Sets a custom path for Swift Package Manager dependencies",
254
254
  type: String,
255
255
  optional: true),
256
+ FastlaneCore::ConfigItem.new(key: :skip_package_dependencies_resolution,
257
+ env_name: "SNAPSHOT_SKIP_PACKAGE_DEPENDENCIES_RESOLUTION",
258
+ description: "Skips resolution of Swift Package Manager dependencies",
259
+ type: Boolean,
260
+ default_value: false),
261
+ FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
262
+ env_name: "SNAPSHOT_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
263
+ description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file",
264
+ type: Boolean,
265
+ default_value: false),
256
266
  FastlaneCore::ConfigItem.new(key: :testplan,
257
267
  env_name: "SNAPSHOT_TESTPLAN",
258
268
  description: "The testplan associated with the scheme that should be used for testing",
@@ -283,7 +293,12 @@ module Snapshot
283
293
  env_name: "SNAPSHOT_SUPPRESS_XCODE_OUTPUT",
284
294
  description: "Suppress the output of xcodebuild to stdout. Output is still saved in buildlog_path",
285
295
  type: Boolean,
286
- optional: true)
296
+ optional: true),
297
+ FastlaneCore::ConfigItem.new(key: :use_system_scm,
298
+ env_name: "SNAPSHOT_USE_SYSTEM_SCM",
299
+ description: "Lets xcodebuild use system's scm configuration",
300
+ type: Boolean,
301
+ default_value: false)
287
302
  ]
288
303
  end
289
304
  end
@@ -8,7 +8,7 @@ module Snapshot
8
8
  def self.find_helper
9
9
  paths = Dir["./**/SnapshotHelper.swift"] + Dir["./**/SnapshotHelperXcode8.swift"]
10
10
  # exclude assets in gym
11
- paths.reject { |p| p.include?("snapshot/lib/assets/") }
11
+ paths.reject { |p| p.include?("snapshot/lib/assets/") || p.include?("DerivedData") }
12
12
  end
13
13
 
14
14
  def update(force: false)
@@ -403,6 +403,7 @@ module Spaceship
403
403
  # This will also handle 2 step verification and 2 factor authentication
404
404
  #
405
405
  # It is called in `send_login_request` of sub classes (which the method `login`, above, transferred over to via `do_login`)
406
+ # rubocop:disable Metrics/PerceivedComplexity
406
407
  def send_shared_login_request(user, password)
407
408
  # Check if we have a cached/valid session
408
409
  #
@@ -506,9 +507,19 @@ module Spaceship
506
507
  # User Credentials are wrong
507
508
  raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username."
508
509
  elsif response.status == 412 && AUTH_TYPES.include?(response.body["authType"])
510
+
511
+ if try_upgrade_2fa_later(response)
512
+ store_cookie
513
+ fetch_olympus_session
514
+ return true
515
+ end
516
+
509
517
  # Need to acknowledge Apple ID and Privacy statement - https://github.com/fastlane/fastlane/issues/12577
510
518
  # Looking for status of 412 might be enough but might be safer to keep looking only at what is being reported
511
- raise AppleIDAndPrivacyAcknowledgementNeeded.new, "Need to acknowledge to Apple's Apple ID and Privacy statement. Please manually log into https://appleid.apple.com (or https://appstoreconnect.apple.com) to acknowledge the statement."
519
+ raise AppleIDAndPrivacyAcknowledgementNeeded.new, "Need to acknowledge to Apple's Apple ID and Privacy statement. " \
520
+ "Please manually log into https://appleid.apple.com (or https://appstoreconnect.apple.com) to acknowledge the statement. " \
521
+ "Your account might also be asked to upgrade to 2FA. " \
522
+ "Set SPACESHIP_SKIP_2FA_UPGRADE=1 for fastlane to automaticaly bypass 2FA upgrade if possible."
512
523
  elsif (response['Set-Cookie'] || "").include?("itctx")
513
524
  raise "Looks like your Apple ID is not enabled for App Store Connect, make sure to be able to login online"
514
525
  else
@@ -517,6 +528,7 @@ module Spaceship
517
528
  end
518
529
  end
519
530
  end
531
+ # rubocop:enable Metrics/PerceivedComplexity
520
532
 
521
533
  # Get the `itctx` from the new (22nd May 2017) API endpoint "olympus"
522
534
  # Update (29th March 2019) olympus migrates to new appstoreconnect API
@@ -925,3 +937,4 @@ module Spaceship
925
937
  end
926
938
 
927
939
  require 'spaceship/two_step_or_factor_client'
940
+ require 'spaceship/upgrade_2fa_later_client'
@@ -35,6 +35,12 @@ require 'spaceship/connect_api/models/custom_app_organization'
35
35
  require 'spaceship/connect_api/models/custom_app_user'
36
36
  require 'spaceship/connect_api/models/pre_release_version'
37
37
 
38
+ require 'spaceship/connect_api/models/app_data_usage'
39
+ require 'spaceship/connect_api/models/app_data_usage_category'
40
+ require 'spaceship/connect_api/models/app_data_usage_data_protection'
41
+ require 'spaceship/connect_api/models/app_data_usage_grouping'
42
+ require 'spaceship/connect_api/models/app_data_usage_purposes'
43
+ require 'spaceship/connect_api/models/app_data_usages_publish_state'
38
44
  require 'spaceship/connect_api/models/age_rating_declaration'
39
45
  require 'spaceship/connect_api/models/app_category'
40
46
  require 'spaceship/connect_api/models/app_info'
@@ -196,7 +196,7 @@ module Spaceship
196
196
 
197
197
  store_csrf_tokens(response)
198
198
 
199
- return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, client: self)
199
+ return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, headers: response.headers, client: self)
200
200
  end
201
201
 
202
202
  def handle_401(response)
@@ -247,8 +247,23 @@ module Spaceship
247
247
  # ]
248
248
  # }
249
249
 
250
+ # Detail is missing in this response making debugging super hard
251
+ # {"errors" =>
252
+ # [
253
+ # {
254
+ # "id"=>"80ea6cff-0043-4543-9cd1-3e26b0fce383",
255
+ # "status"=>"409",
256
+ # "code"=>"ENTITY_ERROR.RELATIONSHIP.INVALID",
257
+ # "title"=>"The provided entity includes a relationship with an invalid value",
258
+ # "source"=>{
259
+ # "pointer"=>"/data/relationships/primarySubcategoryOne"
260
+ # }
261
+ # }
262
+ # ]
263
+ # }
264
+
250
265
  return response.body['errors'].map do |error|
251
- messages = [[error['title'], error['detail']].compact.join(" - ")]
266
+ messages = [[error['title'], error['detail'], error.dig("source", "pointer")].compact.join(" - ")]
252
267
 
253
268
  meta = error["meta"] || {}
254
269
  associated_errors = meta["associatedErrors"] || {}
@@ -144,6 +144,12 @@ module Spaceship
144
144
  end.first
145
145
  end
146
146
 
147
+ def fetch_latest_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES)
148
+ client ||= Spaceship::ConnectAPI
149
+ resp = client.get_app_infos(app_id: id, includes: includes)
150
+ return resp.to_models.first
151
+ end
152
+
147
153
  #
148
154
  # Available Territories
149
155
  #
@@ -0,0 +1,59 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsage
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :category
8
+ attr_accessor :grouping
9
+ attr_accessor :purpose
10
+ attr_accessor :data_protection
11
+
12
+ attr_mapping({
13
+ "category" => "category",
14
+ "grouping" => "grouping",
15
+ "dataProtection" => "data_protection"
16
+ })
17
+
18
+ def self.type
19
+ return "appDataUsages"
20
+ end
21
+
22
+ #
23
+ # Helpers
24
+ #
25
+
26
+ def is_not_collected?
27
+ return false unless data_protection
28
+ return data_protection.id == "DATA_NOT_COLLECTED"
29
+ end
30
+
31
+ #
32
+ # API
33
+ #
34
+
35
+ def self.all(app_id:, filter: {}, includes: nil, limit: nil, sort: nil)
36
+ raise "app_id is required " if app_id.nil?
37
+
38
+ resps = Spaceship::ConnectAPI.get_app_data_usages(app_id: app_id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
39
+ return resps.flat_map(&:to_models)
40
+ end
41
+
42
+ def self.create(app_id:, app_data_usage_category_id: nil, app_data_usage_protection_id: nil, app_data_usage_purpose_id: nil)
43
+ raise "app_id is required " if app_id.nil?
44
+
45
+ resp = Spaceship::ConnectAPI.post_app_data_usage(
46
+ app_id: app_id,
47
+ app_data_usage_category_id: app_data_usage_category_id,
48
+ app_data_usage_protection_id: app_data_usage_protection_id,
49
+ app_data_usage_purpose_id: app_data_usage_purpose_id
50
+ )
51
+ return resp.to_models.first
52
+ end
53
+
54
+ def delete!
55
+ Spaceship::ConnectAPI.delete_app_data_usage(app_data_usage_id: id)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,65 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsageCategory
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :deleted
8
+ attr_accessor :grouping
9
+
10
+ attr_mapping({
11
+ "deleted" => "deleted",
12
+ "grouping" => "grouping"
13
+ })
14
+
15
+ # Found at https://appstoreconnect.apple.com/iris/v1/appDataUsageCategories
16
+ module ID
17
+ PAYMENT_INFORMATION = "PAYMENT_INFORMATION"
18
+ CREDIT_AND_FRAUD = "CREDIT_AND_FRAUD"
19
+ OTHER_FINANCIAL_INFO = "OTHER_FINANCIAL_INFO"
20
+ PRECISE_LOCATION = "PRECISE_LOCATION"
21
+ SENSITIVE_INFO = "SENSITIVE_INFO"
22
+ PHYSICAL_ADDRESS = "PHYSICAL_ADDRESS"
23
+ EMAIL_ADDRESS = "EMAIL_ADDRESS"
24
+ NAME = "NAME"
25
+ PHONE_NUMBER = "PHONE_NUMBER"
26
+ OTHER_CONTACT_INFO = "OTHER_CONTACT_INFO"
27
+ CONTACTS = "CONTACTS"
28
+ EMAILS_OR_TEXT_MESSAGES = "EMAILS_OR_TEXT_MESSAGES"
29
+ PHOTOS_OR_VIDEOS = "PHOTOS_OR_VIDEOS"
30
+ AUDIO = "AUDIO"
31
+ GAMEPLAY_CONTENT = "GAMEPLAY_CONTENT"
32
+ CUSTOMER_SUPPORT = "CUSTOMER_SUPPORT"
33
+ OTHER_USER_CONTENT = "OTHER_USER_CONTENT"
34
+ BROWSING_HISTORY = "BROWSING_HISTORY"
35
+ SEARCH_HISTORY = "SEARCH_HISTORY"
36
+ USER_ID = "USER_ID"
37
+ DEVICE_ID = "DEVICE_ID"
38
+ PURCHASE_HISTORY = "PURCHASE_HISTORY"
39
+ PRODUCT_INTERACTION = "PRODUCT_INTERACTION"
40
+ ADVERTISING_DATA = "ADVERTISING_DATA"
41
+ OTHER_USAGE_DATA = "OTHER_USAGE_DATA"
42
+ CRASH_DATA = "CRASH_DATA"
43
+ PERFORMANCE_DATA = "PERFORMANCE_DATA"
44
+ OTHER_DIAGNOSTIC_DATA = "OTHER_DIAGNOSTIC_DATA"
45
+ OTHER_DATA = "OTHER_DATA"
46
+ HEALTH = "HEALTH"
47
+ FITNESS = "FITNESS"
48
+ COARSE_LOCATION = "COARSE_LOCATION"
49
+ end
50
+
51
+ def self.type
52
+ return "appDataUsageCategories"
53
+ end
54
+
55
+ #
56
+ # API
57
+ #
58
+
59
+ def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
60
+ resps = Spaceship::ConnectAPI.get_app_data_usage_categories(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
61
+ return resps.flat_map(&:to_models)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,27 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsageDataProtection
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :deleted
8
+
9
+ attr_mapping({
10
+ "deleted" => "deleted"
11
+ })
12
+
13
+ # Found at https://appstoreconnect.apple.com/iris/v1/appDataUsageDataProtections
14
+ module ID
15
+ DATA_USED_TO_TRACK_YOU = "DATA_USED_TO_TRACK_YOU"
16
+ DATA_LINKED_TO_YOU = "DATA_LINKED_TO_YOU"
17
+ DATA_NOT_LINKED_TO_YOU = "DATA_NOT_LINKED_TO_YOU"
18
+
19
+ DATA_NOT_COLLECTED = "DATA_NOT_COLLECTED"
20
+ end
21
+
22
+ def self.type
23
+ return "appDataUsageDataProtections"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppDataUsageGrouping
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :deleted
8
+
9
+ attr_mapping({
10
+ "deleted" => "deleted"
11
+ })
12
+
13
+ def self.type
14
+ return "appDataUsageGroupings"
15
+ end
16
+ end
17
+ end
18
+ end