da_funk 3.27.0 → 3.29.1

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
  SHA256:
3
- metadata.gz: ff3ff842f6205b4abaa8991b98a810c3f91fdb7bc8d1efe0ef906d68c300bad0
4
- data.tar.gz: 0440bbafb2757b6f5cc65932c5e474a5e1cfd81d384a5197698134686d6729f7
3
+ metadata.gz: 451f1a04625db6dbf5b6e90813c47a8419fbe68cfff6ba8c7ccbc233423e5253
4
+ data.tar.gz: 0d4347d21f0bb1eaff18a4dab1d70d2b573ecb82ffd7da0a0b87bf0dd94bcf6c
5
5
  SHA512:
6
- metadata.gz: 463973562fa833932df7a091af9a54c9027958380bfecd54baf35ffbfd452fbdb9e4672e650b4580f3f93010c4476c70b88a01b6af8cb79ee0749ddab9f58243
7
- data.tar.gz: 985c8a70c342a6eba544a266023345b388dabcfb970d30a17ba402bc8589150a6eed5f6758a0e5f8a8634b6b0433a029847dfc47754c52300fedbd7c1090fd81
6
+ metadata.gz: 103db5599eafffef2a1d29ebe0f82ed0bbccf358af999ec769f81153769d099e6f62e25acc9c49e5dde401b501f886e40b128a9634f1438f8d2d5bbc42ebbfba
7
+ data.tar.gz: cf0561ec14063622c8a694eb2d5cc9b4eb37188c2edea91ce2eea6830c357dfa8646c8792fe956ad430356614da9006a155b77505301aca9fc191a813356227a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- da_funk (3.27.0)
4
+ da_funk (3.29.1)
5
5
  archive-zip (~> 0.5)
6
6
  bundler
7
7
  cloudwalk_handshake
@@ -18,7 +18,7 @@ GEM
18
18
  cloudwalk (1.15.0)
19
19
  bundler
20
20
  rake
21
- cloudwalk_handshake (1.20.0)
21
+ cloudwalk_handshake (1.21.3)
22
22
  funky-simplehttp (~> 0.6)
23
23
  funky-emv (1.4.1)
24
24
  funky-tlv (~> 0.2)
@@ -27,25 +27,25 @@ GEM
27
27
  funky-tlv (0.2.3)
28
28
  io-like (0.3.1)
29
29
  parallel (1.19.2)
30
- parser (2.7.1.4)
30
+ parser (2.7.2.0)
31
31
  ast (~> 2.4.1)
32
32
  posxml_parser (2.26.0)
33
33
  funky-emv (~> 1)
34
34
  rainbow (3.0.0)
35
35
  rake (13.0.1)
36
- regexp_parser (1.7.1)
36
+ regexp_parser (1.8.2)
37
37
  rexml (3.2.4)
38
- rubocop (0.90.0)
38
+ rubocop (1.1.0)
39
39
  parallel (~> 1.10)
40
- parser (>= 2.7.1.1)
40
+ parser (>= 2.7.1.5)
41
41
  rainbow (>= 2.2.2, < 4.0)
42
- regexp_parser (>= 1.7)
42
+ regexp_parser (>= 1.8)
43
43
  rexml
44
- rubocop-ast (>= 0.3.0, < 1.0)
44
+ rubocop-ast (>= 1.0.1)
45
45
  ruby-progressbar (~> 1.7)
46
46
  unicode-display_width (>= 1.4.0, < 2.0)
47
- rubocop-ast (0.4.0)
48
- parser (>= 2.7.1.4)
47
+ rubocop-ast (1.1.0)
48
+ parser (>= 2.7.1.5)
49
49
  ruby-progressbar (1.10.1)
50
50
  unicode-display_width (1.7.0)
51
51
  yard (0.9.25)
@@ -1,5 +1,30 @@
1
1
  # DaFunk
2
2
 
3
+ ### 3.29.1 - 2020-11-04
4
+
5
+ - Fix battery charging status. When power supply is connected the SDK always returns 50% of battery, in this case it won't show the percentage until the SDK returns 100%.
6
+
7
+ ### 3.29.0 - 2020-11-03
8
+
9
+ - Added support to Ruby SecureRandom;
10
+ - Update cloudwalk_handshake (1.21.3).
11
+
12
+ ### 3.28.2 - 2020-10-07
13
+
14
+ - Added support of params.dat file restore if it was corrupted;
15
+ - Wait 3 seconds before restart after main update;
16
+ - Fixed method_missing exception;
17
+
18
+ ### 3.28.1 - 2020-09-26
19
+
20
+ - Close socket in case of ssl exceptions;
21
+ - Do not assign nil to PaymentChannel#current and client on error because this is already being done on PaymentChannel#close.
22
+
23
+ ### 3.28.0 - 2020-09-25
24
+
25
+ - Check if system update file is present after device restart in order to continue with system update process;
26
+ - Implemented block to write and break line if message has '\n'.
27
+
3
28
  ### 3.27.0 - 2020-09-25
4
29
 
5
30
  - Print bitmap if exists on DaFunk::ParamsDat#restart;
data/Rakefile CHANGED
@@ -56,6 +56,7 @@ FILES = FileList[
56
56
  "lib/da_funk/notification_event.rb",
57
57
  "lib/da_funk/notification_callback.rb",
58
58
  "lib/da_funk/notification.rb",
59
+ "lib/da_funk/secure_random.rb",
59
60
 
60
61
  "lib/device.rb",
61
62
  "lib/device/audio.rb",
@@ -1,8 +1,13 @@
1
1
  module DaFunk
2
2
  class Engine
3
3
  def self.check
4
- DaFunk::EventListener.check
5
- ThreadScheduler.keep_alive
4
+ if Device::Setting.boot == '1'
5
+ DaFunk::EventListener.check(:file_exists) #to check if system update is in progress
6
+ Device::Setting.boot = '0'
7
+ else
8
+ DaFunk::EventListener.check
9
+ ThreadScheduler.keep_alive
10
+ end
6
11
  end
7
12
 
8
13
  def self.app_loop(&block)
@@ -146,8 +146,13 @@ module DaFunk
146
146
  self.battery = bat
147
147
  self.power = dock
148
148
 
149
- Device::Display.print_status_bar(SLOT_BATTERY_PERCENTUAL,
150
- get_image_path(:battery_percentual, self.battery))
149
+ if self.power && self.battery == 50
150
+ Device::Display.print_status_bar(SLOT_BATTERY_PERCENTUAL, nil)
151
+ else
152
+ percentual = get_image_path(:battery_percentual, self.battery)
153
+ Device::Display.print_status_bar(SLOT_BATTERY_PERCENTUAL, percentual)
154
+ end
155
+
151
156
  if self.power
152
157
  Device::Display.print_status_bar(
153
158
  SLOT_BATTERY_LEVEL, get_image_path(:battery_charge, self.battery))
@@ -73,7 +73,11 @@ class I18n
73
73
 
74
74
  def self.pt(symbol, options = {})
75
75
  if options[:line] || options[:column]
76
- Device::Display.print_line(t(symbol, options), options[:line] || 0, options[:column] || 0)
76
+ line = options[:line] || 0
77
+ t(symbol, options).split("\n").each do |message|
78
+ Device::Display.print_line(message, line, options[:column] || 0)
79
+ line+=1
80
+ end
77
81
  else
78
82
  puts(t(symbol, options))
79
83
  end
@@ -5,7 +5,7 @@ module DaFunk
5
5
  include DaFunk::Helper
6
6
 
7
7
  class << self
8
- attr_accessor :file, :apps, :valid, :files
8
+ attr_accessor :file, :apps, :valid, :files, :checksum
9
9
  end
10
10
 
11
11
  self.apps = Array.new
@@ -20,9 +20,19 @@ module DaFunk
20
20
  end
21
21
 
22
22
  def self.setup
23
+ @checksum = calculate_checksum
23
24
  @file = FileDb.new(FILE_NAME)
24
25
  end
25
26
 
27
+ def self.calculate_checksum
28
+ Device::Crypto.crc16_hex(File.read(FILE_NAME)) if exists?
29
+ end
30
+
31
+ def self.corrupted?
32
+ return true unless exists?
33
+ @checksum != calculate_checksum
34
+ end
35
+
26
36
  def self.exists?
27
37
  File.exists?(FILE_NAME)
28
38
  end
@@ -153,6 +163,7 @@ module DaFunk
153
163
  Device::Display.clear
154
164
  if File.exists?('./shared/init_reboot.bmp')
155
165
  Device::Display.print_bitmap('./shared/init_reboot.bmp')
166
+ getc(3000)
156
167
  else
157
168
  I18n.pt(:admin_main_update_message)
158
169
  3.times do |i|
@@ -231,8 +231,7 @@ module DaFunk
231
231
  if Context.development?
232
232
  ContextLog.exception(exception, exception.backtrace, "PaymentChannel error")
233
233
  end
234
- PaymentChannel.current = nil
235
- @client = nil
234
+ self.close
236
235
  end
237
236
 
238
237
  def handshake
@@ -0,0 +1,17 @@
1
+ module DaFunk
2
+ class SecureRandom
3
+ CHARS = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten
4
+
5
+ def self.random_bytes(n = nil)
6
+ n = n ? n.to_int : 16
7
+ (0...n).map { CHARS[rand(CHARS.length)] }.join
8
+ end
9
+
10
+ def self.uuid
11
+ bytes = random_bytes.unpack('NnnnnN')
12
+ bytes[2] = (bytes[2] & 0x0fff) | 0x4000
13
+ bytes[3] = (bytes[3] & 0x3fff) | 0x8000
14
+ "%08x-%04x-%04x-%04x-%04x%08x" % bytes
15
+ end
16
+ end
17
+ end
@@ -1,4 +1,4 @@
1
1
  module DaFunk
2
- VERSION="3.27.0"
2
+ VERSION="3.29.1"
3
3
  end
4
4
 
@@ -152,16 +152,16 @@ class Device
152
152
 
153
153
  # Custom Attributes
154
154
  def self.tcp_recv_timeout
155
- DaFunk::ParamsDat.file["tcp_recv_timeout"] || method_missing(:tcp_recv_timeout)
155
+ DaFunk::ParamsDat.file["tcp_recv_timeout"] || @file&.dig("tcp_recv_timeout")
156
156
  end
157
157
 
158
158
  def self.attach_gprs_timeout
159
- value = (DaFunk::ParamsDat.file["attach_gprs_timeout"] || method_missing(:attach_gprs_timeout))
159
+ value = (DaFunk::ParamsDat.file["attach_gprs_timeout"] || @file&.dig("attach_gprs_timeout"))
160
160
  value.to_s.empty? ? nil : value.to_s.to_i
161
161
  end
162
162
 
163
163
  def self.heartbeat
164
- DaFunk::ParamsDat.file["heartbeat"] || method_missing(:heartbeat)
164
+ DaFunk::ParamsDat.file["heartbeat"] || @file&.dig("heartbeat")
165
165
  end
166
166
 
167
167
  def self.logical_number
@@ -0,0 +1,18 @@
1
+ class SecureRandomTest < DaFunk::Test.case
2
+ def setup
3
+ @uuid = DaFunk::SecureRandom.uuid
4
+ @random_bytes = DaFunk::SecureRandom.random_bytes
5
+ end
6
+
7
+ def test_uuid
8
+ assert_equal(36, @uuid.size)
9
+
10
+ # Check time_hi_and_version and clock_seq_hi_res bits (RFC 4122 4.4)
11
+ assert_equal('4', @uuid[14])
12
+ assert_include(%w'8 9 a b', @uuid[19])
13
+ end
14
+
15
+ def test_random_bytes
16
+ assert_equal(16, @random_bytes.size)
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: da_funk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.27.0
4
+ version: 3.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Scalone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-25 00:00:00.000000000 Z
11
+ date: 2020-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -174,6 +174,7 @@ files:
174
174
  - lib/da_funk/rake_task.rb
175
175
  - lib/da_funk/screen.rb
176
176
  - lib/da_funk/screen_flow.rb
177
+ - lib/da_funk/secure_random.rb
177
178
  - lib/da_funk/struct.rb
178
179
  - lib/da_funk/test.rb
179
180
  - lib/da_funk/transaction/download.rb
@@ -220,6 +221,7 @@ files:
220
221
  - test/resources/shared/bitmap_gp.dat
221
222
  - test/test_helper.rb
222
223
  - test/unit/da_funk/event_listener_test.rb
224
+ - test/unit/da_funk/secure_random.rb
223
225
  - test/unit/da_funk/struct_test.rb
224
226
  - test/unit/da_funk/support_test.rb
225
227
  - test/unit/device/application_test.rb
@@ -269,6 +271,7 @@ test_files:
269
271
  - test/resources/shared/bitmap_gp.dat
270
272
  - test/test_helper.rb
271
273
  - test/unit/da_funk/event_listener_test.rb
274
+ - test/unit/da_funk/secure_random.rb
272
275
  - test/unit/da_funk/struct_test.rb
273
276
  - test/unit/da_funk/support_test.rb
274
277
  - test/unit/device/application_test.rb