da_funk 3.17.0 → 3.18.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/RELEASE_NOTES.md +10 -0
- data/lib/da_funk/helper.rb +27 -19
- data/lib/da_funk/params_dat.rb +25 -19
- data/lib/da_funk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceca3b8c7dbab19c356f90ae7f5f7dd9b2e6a3e5a29b5b535c614f334462292c
|
4
|
+
data.tar.gz: 21967381e026160e693bfaf3eabcbd03873dfb857e55a8e3a00a93efcdda2338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 201cc983eef4738eeeb3c27421bc1667020111a5f5ef1c2352798558c0cf14962e6c736d897435b4000cf7163d4a2320b261785f24b2da8b03256045b24c305b
|
7
|
+
data.tar.gz: 48503f11d53841c2d46cf95e08141bc20d10267fec052eaf6f1ba022b2eabd8e6d131d535ea066e915e0bfbf484c66f3ae5d4a5c58d1f697fb68ba65f94481aa
|
data/Gemfile.lock
CHANGED
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 3.18.0 - 2020-04-03
|
4
|
+
|
5
|
+
- Added enable_txt_ui parameter on the following methods
|
6
|
+
- DaFunk::ParamsDat#download;
|
7
|
+
- DaFunk::ParamsDat#update_apps;
|
8
|
+
- DaFunk::ParamsDat#update_app;
|
9
|
+
- DaFunk::ParamsDat#update_file;
|
10
|
+
- DaFunk::Helper#attach_options;
|
11
|
+
- DaFunk::Helper#check_download_error;
|
12
|
+
|
3
13
|
### 3.17.0 - 2020-02-10
|
4
14
|
|
5
15
|
- Added support to infinitepay endpoints config on config.dat file;
|
data/lib/da_funk/helper.rb
CHANGED
@@ -14,11 +14,11 @@ module DaFunk
|
|
14
14
|
string
|
15
15
|
end
|
16
16
|
|
17
|
-
def attach_options
|
17
|
+
def attach_options(enable_txt_ui = true)
|
18
18
|
if DaFunk::PaymentChannel.client == Context::CommunicationChannel
|
19
|
-
{:print_last => true}
|
19
|
+
{:print_last => true, :enable_txt_ui => enable_txt_ui}
|
20
20
|
else
|
21
|
-
{:print_last => false}
|
21
|
+
{:print_last => false, :enable_txt_ui => enable_txt_ui}
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -35,55 +35,63 @@ module DaFunk
|
|
35
35
|
|
36
36
|
def attach(options = attach_options)
|
37
37
|
if Device::Network.configured?
|
38
|
-
print_attach(:attach_connecting, options)
|
38
|
+
print_attach(:attach_connecting, options) if options[:enable_txt_ui]
|
39
39
|
unless Device::Network.connected?
|
40
40
|
if Device::Network.attach(options) == Device::Network::SUCCESS
|
41
41
|
Device::Setting.network_configured = 1
|
42
|
-
print_attach(:attach_connected, options)
|
42
|
+
print_attach(:attach_connected, options) if options[:enable_txt_ui]
|
43
43
|
else
|
44
44
|
Device::Setting.network_configured = 0 if DaFunk::ParamsDat.file["connection_management"] == "0"
|
45
|
-
|
46
|
-
|
45
|
+
if options[:enable_txt_ui]
|
46
|
+
print_attach(:attach_fail, options.merge(:args => [Device::Network.code.to_s]))
|
47
|
+
getc(10000)
|
48
|
+
end
|
47
49
|
return false
|
48
50
|
end
|
49
51
|
else
|
50
|
-
print_attach(:attach_already_connected, options)
|
52
|
+
print_attach(:attach_already_connected, options) if options[:enable_txt_ui]
|
51
53
|
end
|
52
54
|
true
|
53
55
|
else
|
54
|
-
|
55
|
-
|
56
|
+
if options[:enable_txt_ui]
|
57
|
+
print_attach(:attach_device_not_configured, options)
|
58
|
+
getc(2000)
|
59
|
+
end
|
56
60
|
false
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
60
|
-
def check_download_error(ret)
|
64
|
+
def check_download_error(ret, enable_txt_ui = true)
|
61
65
|
value = true
|
66
|
+
ui = {}
|
67
|
+
|
62
68
|
case ret
|
63
69
|
when DaFunk::Transaction::Download::SERIAL_NUMBER_NOT_FOUND
|
64
|
-
|
70
|
+
ui[:i18n] = :download_serial_number_not_found
|
65
71
|
value = false
|
66
72
|
when DaFunk::Transaction::Download::FILE_NOT_FOUND
|
67
|
-
|
73
|
+
ui[:i18n] = :download_file_not_found
|
68
74
|
value = false
|
69
75
|
when DaFunk::Transaction::Download::FILE_NOT_CHANGE
|
70
|
-
|
76
|
+
ui[:i18n] = :download_file_is_the_same
|
71
77
|
when DaFunk::Transaction::Download::SUCCESS
|
72
|
-
|
78
|
+
ui[:i18n] = :download_success
|
73
79
|
when DaFunk::Transaction::Download::COMMUNICATION_ERROR
|
74
|
-
|
80
|
+
ui[:i18n] = :download_communication_failure
|
75
81
|
value = false
|
76
82
|
when DaFunk::Transaction::Download::MAPREDUCE_RESPONSE_ERROR
|
77
|
-
|
83
|
+
ui[:i18n] = :download_encoding_error
|
78
84
|
value = false
|
79
85
|
when DaFunk::Transaction::Download::IO_ERROR
|
80
|
-
|
86
|
+
ui[:i18n] = :download_io_error
|
81
87
|
value = false
|
82
88
|
else
|
83
|
-
|
89
|
+
ui[:i18n] = :download_communication_failure
|
84
90
|
value = false
|
85
91
|
end
|
86
92
|
|
93
|
+
I18n.pt(ui[:i18n], :args => [ret]) if enable_txt_ui
|
94
|
+
|
87
95
|
value
|
88
96
|
end
|
89
97
|
|
data/lib/da_funk/params_dat.rb
CHANGED
@@ -104,15 +104,17 @@ module DaFunk
|
|
104
104
|
nil
|
105
105
|
end
|
106
106
|
|
107
|
-
def self.download
|
108
|
-
if attach
|
107
|
+
def self.download(enable_txt_ui = true)
|
108
|
+
if attach(attach_options(enable_txt_ui))
|
109
109
|
parse
|
110
110
|
ret = try(3) do |attempt|
|
111
|
-
|
112
|
-
|
111
|
+
if enable_txt_ui
|
112
|
+
Device::Display.clear
|
113
|
+
I18n.pt(:downloading_content, :args => ["PARAMS", 1, 1])
|
114
|
+
end
|
113
115
|
getc(100)
|
114
116
|
ret = DaFunk::Transaction::Download.request_param_file(FILE_NAME)
|
115
|
-
unless check_download_error(ret)
|
117
|
+
unless check_download_error(ret, enable_txt_ui)
|
116
118
|
getc(2000)
|
117
119
|
false
|
118
120
|
else
|
@@ -124,21 +126,21 @@ module DaFunk
|
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
127
|
-
def self.update_apps(force_params = false, force_crc = false, force = false)
|
128
|
-
self.download if force_params || ! self.valid
|
129
|
+
def self.update_apps(force_params = false, force_crc = false, force = false, enable_txt_ui = true)
|
130
|
+
self.download(enable_txt_ui) if force_params || ! self.valid
|
129
131
|
main_updated = nil
|
130
132
|
if self.valid
|
131
133
|
apps_to_update = self.outdated_apps(force_crc, force)
|
132
134
|
size_apps = apps_to_update.size
|
133
135
|
apps_to_update.each_with_index do |app, index|
|
134
|
-
ret = self.update_app(app, index+1, size_apps, force_crc || force)
|
136
|
+
ret = self.update_app(app, index+1, size_apps, force_crc || force, enable_txt_ui)
|
135
137
|
main_updated ||= (ret && app.main_application?)
|
136
138
|
end
|
137
139
|
|
138
140
|
files_to_update = self.outdated_files(force_crc, force)
|
139
141
|
size_files = files_to_update.size
|
140
142
|
files_to_update.each_with_index do |file_, index|
|
141
|
-
self.update_file(file_, index+1, size_files, force_crc || force)
|
143
|
+
self.update_file(file_, index+1, size_files, force_crc || force, enable_txt_ui)
|
142
144
|
end
|
143
145
|
end
|
144
146
|
ensure
|
@@ -179,26 +181,30 @@ module DaFunk
|
|
179
181
|
File.file?(path) && ! keep
|
180
182
|
end
|
181
183
|
|
182
|
-
def self.update_app(application, index = 1, all = 1, force = false)
|
183
|
-
if attach && application
|
184
|
+
def self.update_app(application, index = 1, all = 1, force = false, enable_txt_ui = true)
|
185
|
+
if attach(attach_options(enable_txt_ui)) && application
|
184
186
|
try(3) do |attempt|
|
185
|
-
|
186
|
-
|
187
|
+
if enable_txt_ui
|
188
|
+
Device::Display.clear
|
189
|
+
I18n.pt(:downloading_content, :args => [I18n.t(:apps), index, all])
|
190
|
+
end
|
187
191
|
getc(100)
|
188
|
-
ret = check_download_error(application.download(force))
|
192
|
+
ret = check_download_error(application.download(force), enable_txt_ui)
|
189
193
|
getc(1000)
|
190
194
|
ret
|
191
195
|
end
|
192
196
|
end
|
193
197
|
end
|
194
198
|
|
195
|
-
def self.update_file(file_parameter, index = 1, all = 1, force = false)
|
196
|
-
if attach && file_parameter
|
199
|
+
def self.update_file(file_parameter, index = 1, all = 1, force = false, enable_txt_ui = true)
|
200
|
+
if attach(attach_options(enable_txt_ui)) && file_parameter
|
197
201
|
try(3) do |attempt|
|
198
|
-
|
199
|
-
|
202
|
+
if enable_txt_ui
|
203
|
+
Device::Display.clear
|
204
|
+
I18n.pt(:downloading_content, :args => [I18n.t(:files), index, all])
|
205
|
+
end
|
200
206
|
getc(100)
|
201
|
-
ret = check_download_error(file_parameter.download(force))
|
207
|
+
ret = check_download_error(file_parameter.download(force), enable_txt_ui)
|
202
208
|
file_parameter.unzip if ret
|
203
209
|
getc(1000)
|
204
210
|
ret
|
data/lib/da_funk/version.rb
CHANGED
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.
|
4
|
+
version: 3.18.0
|
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-
|
11
|
+
date: 2020-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|