run_loop_tcc 2.1.4 → 2.1.5

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
  SHA1:
3
- metadata.gz: 4143b3554f7ad4f25c8fae224252d150707038d6
4
- data.tar.gz: 048556097795a71f5dc489f7500c7ffd0fc1c4c2
3
+ metadata.gz: ba34fbad489b76c83f05053ea85c84d7170d1311
4
+ data.tar.gz: 54274decfe80bde2eb1d390759e06ab69e11cb5e
5
5
  SHA512:
6
- metadata.gz: 9ed3f99cc678b9c9e91e3bdb6e1a379dba69016986750f0cceee0975c1e277b08719146db1e530cdbc5bdcdd38c645bd6a81c287aa6c7930f161516a4211ef1e
7
- data.tar.gz: f250e465f6466ad04b393769e71b128de2b81437258046aee5d2ee8846f1326b668dc13605ab2367073b7eb2616d85d3c888201c02638aeec2b38715f3c5c0cf
6
+ metadata.gz: e82e8d023569c115a0b77c4d1ee7b9e1433e580e8976c8df14d5fc7be290555ceb908754516e1dab9f1aea4ad985a34111f7ebe8eb78d2f4380cf15c518aa072
7
+ data.tar.gz: 2c83f38e2dea1f5ebcbdd45dd0cf6bf173eeb088dbc1c2df7800720db8e499e86fe7af75ed26468064eeba9d3f1dca9a83f75c9286377eaeb6a51bb0484f6506
@@ -88,6 +88,7 @@ module RunLoop
88
88
 
89
89
  RunLoop::Environment.with_debugging(debug) do
90
90
  devices.each do |_device|
91
+ _device.simulator_allow_location app
91
92
  simctl.ensure_software_keyboard(_device)
92
93
  tcc = RunLoop::TCC.new(_device, app)
93
94
  services.each do |_service|
@@ -37,6 +37,7 @@ module RunLoop
37
37
  attr_reader :state
38
38
  attr_reader :simulator_root_dir
39
39
  attr_reader :simulator_accessibility_plist_path
40
+ attr_reader :simulator_locationd_plist_path
40
41
  attr_reader :simulator_preferences_plist_path
41
42
  attr_reader :simulator_log_file_path
42
43
  attr_reader :pbuddy
@@ -287,6 +288,14 @@ version: #{version}
287
288
  }.call
288
289
  end
289
290
 
291
+ # @!visibility private
292
+ def simulator_locationd_plist_path
293
+ @simulator_locationd_plist_path ||= lambda {
294
+ return nil if physical_device?
295
+ File.join(simulator_root_dir, 'data/Library/Caches/locationd/clients.plist')
296
+ }.call
297
+ end
298
+
290
299
  # @!visibility private
291
300
  def simulator_preferences_plist_path
292
301
  @simulator_preferences_plist_path ||= lambda {
@@ -459,6 +468,34 @@ version: #{version}
459
468
  locale
460
469
  end
461
470
 
471
+ # Authorize location permission.
472
+ # @param [String] bundle_id bundle id to authorize
473
+ # @raise [RuntimeError] if this is a physical device
474
+ def simulator_allow_location(bundle_id)
475
+ if physical_device?
476
+ raise RuntimeError, "This method is for Simulators only"
477
+ end
478
+
479
+ location_plist = simulator_locationd_plist_path
480
+ unless File.exist? location_plist
481
+ FileUtils.mkdir_p File.dirname location_plist
482
+ pbuddy.create_plist(location_plist)
483
+ end
484
+ pbuddy.plist_set("#{bundle_id}", 'dict', nil, location_plist)
485
+ pbuddy.plist_set("#{bundle_id}:BundleId", 'string', bundle_id, location_plist)
486
+ pbuddy.plist_set("#{bundle_id}:Authorization", 'integer', 2, location_plist)
487
+ pbuddy.plist_set("#{bundle_id}:SupportedAuthorizationMask", 'integer', 3, location_plist)
488
+
489
+ # BundleId - String - bundle_id
490
+ # Authorization - Integer - 2
491
+ # SupportedAuthorizationMask - Integer - 3
492
+
493
+ # Add :new.id Dict
494
+ # Add :new.id:BundleId string com.my.bundleid
495
+ # Add :new.id:SupportedAuthorizationMask integer 3
496
+ # Add :new.id:Authorization integer 2
497
+ end
498
+
462
499
  # @!visibility private
463
500
  #
464
501
  # Returns the AppleLanguages array in global plist as an array
@@ -149,12 +149,12 @@ module RunLoop
149
149
  unless value_type
150
150
  raise(ArgumentError, ':value_type is a required key for :add command')
151
151
  end
152
- allowed_value_types = ['string', 'bool', 'real', 'integer']
152
+ allowed_value_types = ['string', 'bool', 'real', 'integer', 'dict']
153
153
  unless allowed_value_types.include?(value_type)
154
154
  raise(ArgumentError, "expected '#{value_type}' to be one of '#{allowed_value_types}'")
155
155
  end
156
156
  value = args_hash[:value]
157
- unless value
157
+ unless value || args_hash[:type] == 'dict'
158
158
  raise(ArgumentError, ':value is a required key for :add command')
159
159
  end
160
160
  key = args_hash[:key]
@@ -170,7 +170,7 @@ module RunLoop
170
170
  cmd_part = "\"Print :#{key}\""
171
171
  when :set
172
172
  value = args_hash[:value]
173
- unless value
173
+ unless value || args_hash[:type] == 'dict'
174
174
  raise(ArgumentError, ':value is a required key for :set command')
175
175
  end
176
176
  key = args_hash[:key]
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = "2.1.4"
2
+ VERSION = "2.1.5"
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_loop_tcc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -435,9 +435,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
435
435
  version: '0'
436
436
  requirements: []
437
437
  rubyforge_project:
438
- rubygems_version: 2.6.4
438
+ rubygems_version: 2.6.10
439
439
  signing_key:
440
440
  specification_version: 4
441
441
  summary: Fork of run_loop with tcc support.
442
442
  test_files: []
443
- has_rdoc: