Class: RunLoop::CLI::TCC

Inherits:
Thor
  • Object
show all
Defined in:
lib/run_loop/cli/tcc.rb

Instance Method Summary collapse

Instance Method Details

#allowObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/run_loop/cli/tcc.rb', line 66

def allow
  debug = options[:debug]

  device = options[:device]
  if device
    devices = [expect_device(options)]
  else
    devices = sim_control.simulators
  end

  service = options[:service]

  if service
    services = [service]
  else
   services = RunLoop::TCC::PRIVACY_SERVICES.map do |key, _|
    key
   end
  end

  app = options[:app]
  simctl = RunLoop::Simctl.new

  RunLoop::Environment.with_debugging(debug) do
    devices.each do |_device|
      _device.simulator_allow_location app
      simctl.ensure_software_keyboard(_device)
      tcc = RunLoop::TCC.new(_device, app)
      services.each do |_service|
        tcc.allow_service(_service)
      end
    end
  end
  true
end

#openObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/run_loop/cli/tcc.rb', line 25

def open
  device = expect_device(options)

  tcc_db = device.simulator_tcc_db

  return false if tcc_db.nil?

  args = ['open', tcc_db]

  pid = Process.spawn(*args)
  Process.detach(pid)
  pid
end

#servicesObject



11
12
13
14
15
# File 'lib/run_loop/cli/tcc.rb', line 11

def services
  RunLoop::TCC::PRIVACY_SERVICES.each do |key, _|
    puts key
  end
end