da_funk 3.23.0 → 3.24.4

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: 578bfb9686acbf39125036a2f0ce6c3463e0ae6789e381143935cb874885d687
4
- data.tar.gz: de3bdde3690d6b2bc1a8f44e21892666cbbf1319b589d756b52dc7ffdac609ca
3
+ metadata.gz: 6d190ea42757a9e1a847740dc4321adcc7bf2bf356f90185fdd8c8b7de3c2398
4
+ data.tar.gz: b116514238c4c9b2d0458b08231619cbeaa8533ba264491716d5685fd64bbf13
5
5
  SHA512:
6
- metadata.gz: 341c25f679bd5ca34b5a5a445901e451a8ba5e669dc73d89c9ae5b8dff49551aa3cdad540200eb6cab998b4ef6c895af86341fdc46f64a7adf7bb4fdac2e2cc5
7
- data.tar.gz: 2a159ed3938d10c0304f95759a327b56f2d600de26d6dd80308ee52f7c0e111aae07181e51f3e7a1c99bee4d25cc637d72ba75e76c0d855768872373a5936854
6
+ metadata.gz: 0bedf7264f973b4f96e7de1f8e70a599e47e026cc5c00a1b2418674ab6ed32a32a178b41fa6d4d8ecb5ed5a23ec46bfd894a5b087e71d26997b8326c10d26f56
7
+ data.tar.gz: c3d53db9952a1e942ba42308491726700809ad5435c1d66d7b8c9dd67099b737063b540e9f0a64f8aede8aed718c1aefcca456ba3658c12f575b4c18d8956305
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- da_funk (3.23.0)
4
+ da_funk (3.24.4)
5
5
  archive-zip (~> 0.5)
6
6
  bundler
7
7
  cloudwalk_handshake
@@ -1,5 +1,28 @@
1
1
  # DaFunk
2
2
 
3
+ ### 3.24.4 - 2020-08-07
4
+
5
+ - Add defensive code to gsub calls.
6
+
7
+ ### 3.24.3 - 2020-08-03
8
+
9
+ - Fixed path name on DaFunk::Application
10
+
11
+ ### 3.24.2 - 2020-08-01
12
+
13
+ - Do not remove company name to file path when ruby app
14
+
15
+ ### 3.24.1 - 2020-07-27
16
+
17
+ - Infinitepay authorizer setting 1 as default.
18
+
19
+ ### 3.24.0 - 2020-07-25
20
+
21
+ - Added Device::Signature class;
22
+ - Added support of converting signature after updating params.dat;
23
+ - Added support to network state on status bar;
24
+ - Added support to physical number keys on virtual keyboard.
25
+
3
26
  ### 3.23.0 - 2020-06-22
4
27
 
5
28
  - Remove ThreadPubSub publication before attach;
data/Rakefile CHANGED
@@ -69,7 +69,8 @@ FILES = FileList[
69
69
  "lib/device/support.rb",
70
70
  "lib/device/system.rb",
71
71
  "lib/device/magnetic.rb",
72
- "lib/device/virtual_keyboard.rb"
72
+ "lib/device/virtual_keyboard.rb",
73
+ "lib/device/signature.rb"
73
74
  ]
74
75
 
75
76
  DaFunk::RakeTask.new do |t|
@@ -23,7 +23,7 @@ module DaFunk
23
23
  company = check_company(remote)
24
24
  @remote = remote.sub("#{company}_", "")
25
25
  @name = remote.sub("#{company}_", "").split(".")[0]
26
- @file = check_path(@remote)
26
+ @file = check_path("#{@remote}")
27
27
  end
28
28
 
29
29
  def crc_local
@@ -140,7 +140,11 @@ module DaFunk
140
140
  if posxml?
141
141
  "./shared/#{path}"
142
142
  else
143
- "#{path.gsub("#{Device::Setting.company_name}_", "")}.zip"
143
+ if ruby?
144
+ "#{path}.zip"
145
+ else
146
+ "#{path.to_s.gsub("#{Device::Setting.company_name}_", "")}.zip"
147
+ end
144
148
  end
145
149
  end
146
150
 
@@ -7,6 +7,20 @@ module DaFunk
7
7
  SLOT_UPDATE = 2
8
8
  SLOT_BATTERY_PERCENTUAL = 6
9
9
  SLOT_BATTERY_LEVEL = 7
10
+ SLOT_MESSAGE_CONNECTION = {
11
+ true => {
12
+ :slot1 => 2,
13
+ :slot2 => 3,
14
+ :message1 => './shared/conectado_01.png',
15
+ :message2 => './shared/conectado_02.png'
16
+ },
17
+ false => {
18
+ :slot1 => 2,
19
+ :slot2 => 3,
20
+ :message1 => './shared/buscando_01.png',
21
+ :message2 => './shared/buscando_02.png'
22
+ }
23
+ }
10
24
 
11
25
  BATTERY_IMAGES = {
12
26
  0..4 => "./shared/battery0.png",
@@ -61,7 +75,7 @@ module DaFunk
61
75
  }
62
76
 
63
77
  class << self
64
- attr_accessor :signal, :battery, :power, :managment
78
+ attr_accessor :signal, :battery, :power, :managment, :connected
65
79
  end
66
80
 
67
81
  def self.check
@@ -75,8 +89,26 @@ module DaFunk
75
89
  def self.change_update
76
90
  if File.exists?('./shared/system_update')
77
91
  PAX::Display.print_status_bar(SLOT_UPDATE, "./shared/system_update_download.png")
92
+ PAX::Display.print_status_bar(3, nil)
78
93
  else
79
- PAX::Display.print_status_bar(SLOT_UPDATE, nil)
94
+ change_message
95
+ end
96
+ end
97
+
98
+ def self.change_message
99
+ connected = Device::Network.connected?
100
+
101
+ if connected != self.connected
102
+ self.connected = connected
103
+
104
+ slot_message_1 = SLOT_MESSAGE_CONNECTION[self.connected][:slot1]
105
+ slot_message_2 = SLOT_MESSAGE_CONNECTION[self.connected][:slot2]
106
+
107
+ message_1 = SLOT_MESSAGE_CONNECTION[self.connected][:message1]
108
+ message_2 = SLOT_MESSAGE_CONNECTION[self.connected][:message2]
109
+
110
+ Device::Display.print_status_bar(slot_message_1, message_1)
111
+ Device::Display.print_status_bar(slot_message_2, message_2)
80
112
  end
81
113
  end
82
114
 
@@ -83,6 +83,8 @@ module DaFunk
83
83
  # After: "1 - App,pc2_app.zip,ruby,E0A0;"
84
84
  def self.parse
85
85
  return unless self.setup
86
+
87
+ Device::Signature.convert
86
88
  parse_apps
87
89
  parse_files
88
90
 
@@ -1,4 +1,4 @@
1
1
  module DaFunk
2
- VERSION="3.23.0"
2
+ VERSION="3.24.4"
3
3
  end
4
4
 
@@ -8,7 +8,7 @@ class Device
8
8
  #
9
9
  # @return [Class] the class object flatted
10
10
  def self.flat_api
11
- klass_version = Device.version.gsub(".", "")
11
+ klass_version = Device.version.to_s.gsub(".", "")
12
12
  # Sample
13
13
  #if Device.version == "0.4.3"
14
14
  #const_get("VersionFlat#{klass_version}").flat Device
@@ -60,7 +60,7 @@ class Device
60
60
  "metadata_timestamp" => "",
61
61
  "payment_channel_attempts" => "0",
62
62
  "payment_channel_date" => "",
63
- "infinitepay_authorizer" => "0",
63
+ "infinitepay_authorizer" => "1",
64
64
  "infinitepay_api" => "0",
65
65
  "infinitepay_cw_endpoint" => "1",
66
66
  "infinitepay_google_endpoint" => "0",
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Device
4
+ class Signature
5
+ FILE = './shared/device.sig'
6
+
7
+ CONVERTED = 1
8
+ FILE_NOT_FOUND = 2
9
+ IS_THE_SAME = 3
10
+
11
+ def self.convert
12
+ load
13
+ return FILE_NOT_FOUND unless @file
14
+
15
+ if must_convert?
16
+ @file.update_attributes({ 'signer' => DaFunk::ParamsDat.file['signer'] })
17
+ return CONVERTED
18
+ end
19
+ IS_THE_SAME
20
+ end
21
+
22
+ def self.must_convert?
23
+ DaFunk::ParamsDat.file['signer'] && DaFunk::ParamsDat.file['signer'] != @file['signer']
24
+ end
25
+
26
+ def self.load
27
+ @file = FileDb.new FILE
28
+ end
29
+ end
30
+ end
@@ -114,6 +114,7 @@ class Device
114
114
  }
115
115
 
116
116
  def self.type_text(params = {})
117
+ phisical_keys = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', "\017"]
117
118
  change_keyboard
118
119
  Device::Display.print_line("#{self.text}", params[:line], params[:column])
119
120
  time = Time.now + (params[:timeout] || Device::IO.timeout) / 1000
@@ -129,6 +130,13 @@ class Device
129
130
  break(Device::IO::KEY_TIMEOUT) if Time.now > time
130
131
 
131
132
  key = getc(100)
133
+ if phisical_keys.include?(key)
134
+ if key == Device::IO::BACK
135
+ show_text({char: :erase}, params)
136
+ else
137
+ show_text({char: key}, params)
138
+ end
139
+ end
132
140
  end
133
141
  end
134
142
 
@@ -23,7 +23,7 @@ module ISO8583
23
23
  # hex2b "abcd12" => "\xa\cd\12"
24
24
  #
25
25
  def hex2b(hex_string)
26
- string = hex_string.gsub(/\s+/, "")
26
+ string = hex_string.to_s.gsub(/\s+/, "")
27
27
  raise ISO8583Exception.new("Invalid Hex chars: #{hex_string}") unless string =~ /^[A-Fa-f0-9]*$/
28
28
  raise ISO8583Exception.new("Uneven number of Hex chars #{hex_string}") unless ( (string.length % 2) == 0)
29
29
  [string].pack("H*")
@@ -0,0 +1,24 @@
1
+ require 'funky-mock'
2
+
3
+ class SignatureTest < DaFunk::Test.case
4
+ def test_signature_should_be_updated
5
+ FileDb.new(Device::Signature::FILE).update_attributes({'signer' => 'whatever'})
6
+ DaFunk::ParamsDat.file = {'signer' => 'thebestsignature'}
7
+
8
+ assert_equal Device::Signature::CONVERTED, Device::Signature.convert
9
+ end
10
+
11
+ def test_signature_file_not_found
12
+ FunkyMock::Mock.new
13
+ Device::Signature.stubs(:load).returns(nil)
14
+
15
+ assert_equal Device::Signature::FILE_NOT_FOUND, Device::Signature.convert
16
+ end
17
+
18
+ def test_signature_is_the_same
19
+ FileDb.new(Device::Signature::FILE).update_attributes({'signer' => 'whatever'})
20
+ DaFunk::ParamsDat.file = {'signer' => 'whatever'}
21
+
22
+ assert_equal Device::Signature::IS_THE_SAME, Device::Signature.convert
23
+ end
24
+ 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.23.0
4
+ version: 3.24.4
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-06-22 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -189,6 +189,7 @@ files:
189
189
  - lib/device/printer.rb
190
190
  - lib/device/runtime.rb
191
191
  - lib/device/setting.rb
192
+ - lib/device/signature.rb
192
193
  - lib/device/support.rb
193
194
  - lib/device/system.rb
194
195
  - lib/device/version.rb
@@ -227,6 +228,7 @@ files:
227
228
  - test/unit/device/io_test.rb
228
229
  - test/unit/device/notification_callback_test.rb
229
230
  - test/unit/device/notification_event_test.rb
231
+ - test/unit/device/signature_test.rb
230
232
  - test/unit/ext/float_test.rb
231
233
  - test/unit/ext/string_test.rb
232
234
  - test/unit/file_db_test.rb
@@ -275,6 +277,7 @@ test_files:
275
277
  - test/unit/device/io_test.rb
276
278
  - test/unit/device/notification_callback_test.rb
277
279
  - test/unit/device/notification_event_test.rb
280
+ - test/unit/device/signature_test.rb
278
281
  - test/unit/ext/float_test.rb
279
282
  - test/unit/ext/string_test.rb
280
283
  - test/unit/file_db_test.rb