Show error mark if message not received after 10 secs
This commit is contained in:
parent
8e064c8ac0
commit
4361b6e4e3
2 changed files with 14 additions and 6 deletions
11
lib/main.rb
11
lib/main.rb
|
@ -280,11 +280,12 @@ private
|
|||
),
|
||||
|
||||
history: (state[:friends][friend_number][:history] + [
|
||||
error: error,
|
||||
out: true,
|
||||
time: Time.now.utc.freeze,
|
||||
name: @tox_client.name.freeze,
|
||||
text: text,
|
||||
error: error,
|
||||
out: true,
|
||||
received: false,
|
||||
time: Time.now.utc.freeze,
|
||||
name: @tox_client.name.freeze,
|
||||
text: text,
|
||||
]).freeze,
|
||||
).freeze,
|
||||
).freeze,
|
||||
|
|
|
@ -13,7 +13,14 @@ module Widgets
|
|||
offset = 0
|
||||
|
||||
props[:messages].reverse_each do |msg|
|
||||
offset += draw_message offset, msg[:error], msg[:out], msg[:time].strftime('%H:%M:%S'), msg[:name], msg[:text]
|
||||
offset += draw_message(
|
||||
offset,
|
||||
msg[:error] || msg[:out] && !msg[:received] && Time.now.utc - msg[:time] > 10,
|
||||
msg[:out],
|
||||
msg[:time].strftime('%H:%M:%S'),
|
||||
msg[:name],
|
||||
msg[:text],
|
||||
)
|
||||
|
||||
break if offset >= props[:height]
|
||||
end
|
||||
|
|
Reference in a new issue