Skip to content

Commit 77bc3bd

Browse files
committed
Fixes as a result of an actual test
1 parent 4723f27 commit 77bc3bd

File tree

7 files changed

+22
-13
lines changed

7 files changed

+22
-13
lines changed

cmd/streampanel/FyneApp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Website = "https://github.com/xaionaro/streamctl"
55
Name = "streampanel"
66
ID = "center.dx.streampanel"
77
Version = "0.1.0"
8-
Build = 374
8+
Build = 382

pkg/chatmessagesstorage/get_messages_since.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func (s *ChatMessagesStorage) getMessagesSinceLocked(
3030
}
3131

3232
if !s.IsSorted {
33+
logger.Tracef(ctx, "not sorted, sorting")
3334
s.sortAndDeduplicateAndTruncate(ctx)
3435
}
3536

pkg/chatmessagesstorage/sort_and_deduplicate.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ import (
99
)
1010

1111
func msgLess(ctx context.Context, a *api.ChatMessage, b *api.ChatMessage) bool {
12-
if a.CreatedAt.Before(b.CreatedAt) {
13-
return true
12+
if a.CreatedAt != b.CreatedAt {
13+
return a.CreatedAt.Before(b.CreatedAt)
1414
}
15-
if a.Platform < b.Platform {
16-
return true
15+
if a.Platform != b.Platform {
16+
return a.Platform < b.Platform
1717
}
18-
if a.Username < b.Username {
19-
return true
18+
if a.Username != b.Username {
19+
return a.Username < b.Username
2020
}
21-
if a.MessageID < b.MessageID {
22-
return true
21+
if a.MessageID != b.MessageID {
22+
return a.MessageID < b.MessageID
2323
}
24-
if a.Message < b.Message {
25-
return true
24+
if a.Message != b.Message {
25+
return a.Message < b.Message
2626
}
2727
if a != b {
2828
logger.Errorf(ctx, "msgs A and B look equal, but are not: A:%#+v B:%#+v", a, b)

pkg/streampanel/chat.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ func (ui *chatUI) onReceiveMessage(
196196
defer ui.List.RefreshItem(prevLen)
197197
defer ui.MessagesHistoryLocker.ManualUnlock(ctx)
198198
ui.MessagesHistory = append(ui.MessagesHistory, msg)
199+
if time.Since(msg.CreatedAt) > time.Hour {
200+
return
201+
}
199202
notificationsEnabled := xsync.DoR1(ctx, &ui.Panel.configLocker, func() bool {
200203
return ui.Panel.Config.Chat.NotificationsEnabled()
201204
})

pkg/streampanel/color.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ func colorForPlatform(platID streamcontrol.PlatformName) fyne.ThemeColorName {
2727

2828
var brightColors = []fyne.ThemeColorName{
2929
theme.ColorNameError,
30-
theme.ColorNameForeground,
3130
theme.ColorNameHyperlink,
3231
theme.ColorNamePrimary,
33-
theme.ColorNameSelection,
3432
theme.ColorNameSuccess,
3533
theme.ColorNameWarning,
3634
}

pkg/streampanel/dashboard.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ func (p *Panel) newDashboardWindow(
313313
c := w.chat.List
314314
w.chat.OnAdd = func(ctx context.Context, _ api.ChatMessage) {
315315
screenHeight := w.Canvas().Size().Height
316+
switch runtime.GOOS {
317+
case "android":
318+
screenHeight -= 110
319+
}
316320
demandedHeight := float32(w.chat.TotalListHeight) + c.Theme().Size(theme.SizeNamePadding)*float32(c.Length())
317321
logger.Tracef(ctx, "demanded height: %v; screen height: %v", demandedHeight, screenHeight)
318322
allowedHeight := math.Min(
@@ -328,6 +332,8 @@ func (p *Panel) newDashboardWindow(
328332

329333
c.ScrollToBottom()
330334
c.Refresh()
335+
c.ScrollToBottom()
336+
c.Refresh()
331337
}
332338
w.chat.OnAdd(ctx, api.ChatMessage{})
333339
layers = append(layers,

pkg/streampanel/panel.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ func (p *Panel) Loop(ctx context.Context, opts ...LoopOption) (_err error) {
251251
}
252252

253253
p.app = fyneapp.New()
254+
p.app.Settings().SetTheme(theme.DarkTheme())
254255
p.app.Driver().SetDisableScreenBlanking(true)
255256
logger.Tracef(ctx, "SetDisableScreenBlanking(true)")
256257
p.createMainWindow(ctx)

0 commit comments

Comments
 (0)