tgios 0.0.39 → 0.0.40
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 +8 -8
- data/Gemfile.lock +1 -1
- data/lib/tgios/beacon_manager.rb +12 -6
- data/lib/tgios/scan_qr_controller.rb +30 -3
- data/lib/tgios/ui_table_view_utility_binding.rb +1 -0
- data/lib/tgios/ui_text_field_binding.rb +16 -12
- data/lib/tgios/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
MDcyNTVlZWQ0NTFmZTM2NWY2OWUzODUwYzAxZWIwNmQxY2FkOTcxYQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MmI0NDA0N2E4N2FlYWE3ZDVhM2ViM2E0MmI4MzcwOTE4MjFjZWQyYw==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
NmE4ZDk2ZDljMDc4MTBlMzNiNmIxNGEzZTdkNGY0YzU0N2Q3YTU3OWZjZDhm
|
|
10
|
+
ODVkNmQ4OWJhYTE5NzU1NTI5ZWNmZDkxZTBiODczMmQ2NWQ0MDNjZTQ3ZjU5
|
|
11
|
+
NWY3ZDM0MTg0MGU1N2M5ZGUxNWU2ZTc4YWM1NTE1ZmE4ZjIyYjQ=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ZDU0OTg5OWE3NjNhZTdjY2M2MWMyMjlhMWU1N2Q4NmZhZmQ1ZDY1NmJlYWQ3
|
|
14
|
+
NjAzYTQyNmJlYjY1OWJhY2JjNzRiZDQ4YmY5ZjEwN2VmNzhmMmU2NWNmZDk2
|
|
15
|
+
N2NmYjgwMTgxNGM5NjgzMzBiZDFmMzUxY2YyYzRlZmMwNDZlZDE=
|
data/Gemfile.lock
CHANGED
data/lib/tgios/beacon_manager.rb
CHANGED
|
@@ -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|
|
|
146
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
135
|
-
|
|
160
|
+
self.dismissViewControllerAnimated(true, completion: -> {
|
|
161
|
+
@events[:result_scanned].call(result)
|
|
162
|
+
})
|
|
136
163
|
end
|
|
137
164
|
|
|
138
165
|
def stop_scanning
|
|
@@ -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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
@ui_field.delegate
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
data/lib/tgios/version.rb
CHANGED
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.
|
|
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:
|
|
12
|
+
date: 2017-03-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: sugarcube
|