tgios 0.0.39 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGI1N2Q0YWY4YWJlNzQ4M2YyZWM2ZTMyN2UyM2RkNTY1NGM2MGRhNQ==
4
+ MDcyNTVlZWQ0NTFmZTM2NWY2OWUzODUwYzAxZWIwNmQxY2FkOTcxYQ==
5
5
  data.tar.gz: !binary |-
6
- ODM4NjY3M2I4MzdlZjdlZjIxMTkzM2Y0ZGJlMjFhY2UxMWUxMzMyZg==
6
+ MmI0NDA0N2E4N2FlYWE3ZDVhM2ViM2E0MmI4MzcwOTE4MjFjZWQyYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGNlZTQzNzJiN2RjMDliOWE3YjBkNDMzOTVmM2FkYjA4MjY4OWM0ZDgzZjZh
10
- ZDhiYTRjYWZhZmEyNzMyMmJmNWNmNWNhNGY5OTk5YzhiMDYzZjAwY2U2ZmE0
11
- ZjY0NTc3ZDQ3YTlkN2U1NWI1NzQ3YTcwN2JjODBiNmQ0NzUwZWM=
9
+ NmE4ZDk2ZDljMDc4MTBlMzNiNmIxNGEzZTdkNGY0YzU0N2Q3YTU3OWZjZDhm
10
+ ODVkNmQ4OWJhYTE5NzU1NTI5ZWNmZDkxZTBiODczMmQ2NWQ0MDNjZTQ3ZjU5
11
+ NWY3ZDM0MTg0MGU1N2M5ZGUxNWU2ZTc4YWM1NTE1ZmE4ZjIyYjQ=
12
12
  data.tar.gz: !binary |-
13
- ODBhZDg0NmRlN2M1NjhhZTdlY2JmYjI0NTJmZjk0MjVmZDE0ZWIxYmQ2ZjE4
14
- MjliN2M4ZTgxMjg2M2NlNTlkYjExZDcxYmZhYzA0OTlmODY1MWQ2ODE4MDlk
15
- YmUwYTM1YjI5ZDBiMTI3MjUxMTYzYTY1Y2E1MTQwMmE2OGM3Y2M=
13
+ ZDU0OTg5OWE3NjNhZTdjY2M2MWMyMjlhMWU1N2Q4NmZhZmQ1ZDY1NmJlYWQ3
14
+ NjAzYTQyNmJlYjY1OWJhY2JjNzRiZDQ4YmY5ZjEwN2VmNzhmMmU2NWNmZDk2
15
+ N2NmYjgwMTgxNGM5NjgzMzBiZDFmMzUxY2YyYzRlZmMwNDZlZDE=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tgios (0.0.39)
4
+ tgios (0.0.40)
5
5
  awesome_print_motion
6
6
  motion-layout
7
7
  plastic_cup (>= 0.1.1)
@@ -111,10 +111,10 @@ module Tgios
111
111
  def algorithm=(val)
112
112
  alg = val.to_s.to_sym
113
113
  return unless alg.present?
114
+ raise ArgumentError.new("Algorithm not found, valid algorithm are: [#{ALGORITHMS.join(', ')}]") unless ALGORITHMS.include?(alg)
114
115
  if @algorithm != alg
115
116
  @previous_beacons.clear
116
117
  end
117
- raise ArgumentError.new("Algorithm not found, valid algorithm are: [#{ALGORITHMS.join(', ')}]") unless ALGORITHMS.include?(alg)
118
118
 
119
119
  @algorithm = alg
120
120
  end
@@ -142,8 +142,12 @@ module Tgios
142
142
  region_hash = get_region_hash(region)
143
143
  return unless region_hash[:active]
144
144
 
145
- beacons = beacons.sort_by{|b| b.try(@range_method)}
146
- beacons = beacons.reverse if @range_method == :rssi
145
+ beacons = beacons.sort_by{|b|
146
+ val = b.try(@range_method)
147
+ val = val * -1 if val && @range_method == :rssi
148
+ val
149
+ }
150
+
147
151
  known_beacons = beacons.select{|b| b.proximity != CLProximityUnknown}
148
152
  unknown_beacons = beacons - known_beacons
149
153
  beacon = nil
@@ -156,9 +160,11 @@ module Tgios
156
160
  end
157
161
  push_beacon(beacon) # nil value will signify null beacon
158
162
 
163
+ # use known_beacons + unknown_beacons to make sure closest range comes to the top
164
+ all_beacons = known_beacons + unknown_beacons
165
+
159
166
  if has_event(:beacons_found)
160
- # use known_beacons + unknown_beacons to make sure closest range comes to the top
161
- @events[:beacons_found].call(beacons_in_range, known_beacons + unknown_beacons, @current_beacon)
167
+ @events[:beacons_found].call(beacons_in_range, all_beacons, @current_beacon)
162
168
  end
163
169
 
164
170
  if has_event(:beacon_found)
@@ -166,7 +172,7 @@ module Tgios
166
172
  end
167
173
 
168
174
  BeaconFoundKey.post_notification(self, {region: region, beacon: @current_beacon})
169
- BeaconsFoundKey.post_notification(self, {region: region, beacon: @current_beacon, beacons_in_range: beacons_in_range, any_beacons: known_beacons + unknown_beacons})
175
+ BeaconsFoundKey.post_notification(self, {region: region, beacon: @current_beacon, beacons_in_range: beacons_in_range, any_beacons: all_beacons})
170
176
  end
171
177
 
172
178
  def locationManager(manager, rangingBeaconsDidFailForRegion: region, withError: error)
@@ -1,6 +1,6 @@
1
1
  module Tgios
2
2
  class ScanQrController < UIViewController
3
- attr_accessor :types
3
+ attr_accessor :types, :bottom_text
4
4
 
5
5
  def viewDidLoad
6
6
  super
@@ -75,6 +75,32 @@ module Tgios
75
75
  @output = AVCaptureMetadataOutput.alloc.init
76
76
  @output.setMetadataObjectsDelegate self, queue: @queue.dispatch_object
77
77
 
78
+ if @bottom_text
79
+ whole_lbl_h = 36
80
+ lbl_h = 18
81
+ t_frame = layerRect.dup
82
+ t_frame.origin.y = t_frame.size.height - whole_lbl_h
83
+ t_frame.size.height = whole_lbl_h
84
+ bg_layer = Base.style(CALayer.layer,
85
+ frame: t_frame,
86
+ backgroundColor: :black.cgcolor(0.3),
87
+ )
88
+ self.view.layer.addSublayer(bg_layer)
89
+
90
+ t_frame.origin.y = (whole_lbl_h - lbl_h)/ 2.0
91
+ t_frame.size.height = lbl_h
92
+ text_layer = Base.style(CATextLayer.layer,
93
+ contentsScale: UIScreen.mainScreen.scale,
94
+ frame: t_frame,
95
+ foregroundColor: :white.cgcolor,
96
+ alignmentMode: KCAAlignmentCenter,
97
+ truncationMode: KCATruncationEnd,
98
+ fontSize: 14,
99
+ )
100
+ bg_layer.addSublayer(text_layer)
101
+ text_layer.string = @bottom_text
102
+ end
103
+
78
104
  camera_size = layerRect.size
79
105
  sq_size = 240
80
106
  sq_border = 20
@@ -131,8 +157,9 @@ module Tgios
131
157
  def openQRCode(result)
132
158
  stop_scanning
133
159
 
134
- @events[:result_scanned].call(result)
135
- self.dismissViewControllerAnimated(true, completion: nil)
160
+ self.dismissViewControllerAnimated(true, completion: -> {
161
+ @events[:result_scanned].call(result)
162
+ })
136
163
  end
137
164
 
138
165
  def stop_scanning
@@ -76,6 +76,7 @@ module Tgios
76
76
  end
77
77
 
78
78
  def reset_content_inset_bottom
79
+ return unless @table.weakref_alive?
79
80
  @table.contentInset = UIEdgeInsetsZero
80
81
  @table.scrollIndicatorInsets = UIEdgeInsetsZero
81
82
  @expanding = false
@@ -81,9 +81,9 @@ module Tgios
81
81
 
82
82
  def textFieldDidEndEditing(textField)
83
83
  puts "textFieldDidEndEditing"
84
- @model.send("#{@field_name}=", textField.text)
84
+ @model.send("#{@field_name}=", textField.text) if @model.present?
85
85
  weak_text_field=WeakRef.new(textField)
86
- @events[:end_edit].call(@model, @field_name, {text_field: weak_text_field}) unless @events[:end_edit].nil?
86
+ @events[:end_edit].call(@model, @field_name, {text_field: weak_text_field}) unless @events.nil? || @events[:end_edit].nil?
87
87
  @decimal_button.removeFromSuperview unless @decimal_button.nil?
88
88
  end
89
89
 
@@ -279,17 +279,21 @@ module Tgios
279
279
  end
280
280
 
281
281
  def onPrepareForRelease
282
- stop_listen
283
- @model=nil
284
- @decimal_button=nil
285
- if !@ui_field.nil? && @ui_field.weakref_alive? && @ui_field.delegate == self
286
- @ui_field.delegate = nil
287
- toolbar = @ui_field.inputAccessoryView
288
- toolbar.items = nil unless toolbar.nil?
289
- @ui_field.inputAccessoryView = nil
282
+ begin
283
+ stop_listen
284
+ @model=nil
285
+ @decimal_button=nil
286
+ if @ui_field.is_a?(WeakRef) && @ui_field.weakref_alive? && !@ui_field.nil? && @ui_field.delegate == self
287
+ @ui_field.delegate = nil
288
+ toolbar = @ui_field.inputAccessoryView
289
+ toolbar.items = nil unless toolbar.nil?
290
+ @ui_field.inputAccessoryView = nil
291
+ end
292
+ @ui_field=nil
293
+ @events=nil
294
+ rescue Exception => e
295
+ NSLog e.inspect
290
296
  end
291
- @ui_field=nil
292
- @events=nil
293
297
  end
294
298
 
295
299
  def dealloc
@@ -1,3 +1,3 @@
1
1
  module Tgios
2
- VERSION = '0.0.39'
2
+ VERSION = '0.0.40'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tgios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 0.0.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - April Tsang
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-20 00:00:00.000000000 Z
12
+ date: 2017-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sugarcube