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] + [
|
history: (state[:friends][friend_number][:history] + [
|
||||||
error: error,
|
error: error,
|
||||||
out: true,
|
out: true,
|
||||||
time: Time.now.utc.freeze,
|
received: false,
|
||||||
name: @tox_client.name.freeze,
|
time: Time.now.utc.freeze,
|
||||||
text: text,
|
name: @tox_client.name.freeze,
|
||||||
|
text: text,
|
||||||
]).freeze,
|
]).freeze,
|
||||||
).freeze,
|
).freeze,
|
||||||
).freeze,
|
).freeze,
|
||||||
|
|
|
@ -13,7 +13,14 @@ module Widgets
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
props[:messages].reverse_each do |msg|
|
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]
|
break if offset >= props[:height]
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue