mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-09-27 11:52:11 +08:00
Fixes as a result of an actual test
This commit is contained in:
@@ -5,4 +5,4 @@ Website = "https://github.com/xaionaro/streamctl"
|
|||||||
Name = "streampanel"
|
Name = "streampanel"
|
||||||
ID = "center.dx.streampanel"
|
ID = "center.dx.streampanel"
|
||||||
Version = "0.1.0"
|
Version = "0.1.0"
|
||||||
Build = 374
|
Build = 382
|
||||||
|
@@ -30,6 +30,7 @@ func (s *ChatMessagesStorage) getMessagesSinceLocked(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !s.IsSorted {
|
if !s.IsSorted {
|
||||||
|
logger.Tracef(ctx, "not sorted, sorting")
|
||||||
s.sortAndDeduplicateAndTruncate(ctx)
|
s.sortAndDeduplicateAndTruncate(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,20 +9,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func msgLess(ctx context.Context, a *api.ChatMessage, b *api.ChatMessage) bool {
|
func msgLess(ctx context.Context, a *api.ChatMessage, b *api.ChatMessage) bool {
|
||||||
if a.CreatedAt.Before(b.CreatedAt) {
|
if a.CreatedAt != b.CreatedAt {
|
||||||
return true
|
return a.CreatedAt.Before(b.CreatedAt)
|
||||||
}
|
}
|
||||||
if a.Platform < b.Platform {
|
if a.Platform != b.Platform {
|
||||||
return true
|
return a.Platform < b.Platform
|
||||||
}
|
}
|
||||||
if a.Username < b.Username {
|
if a.Username != b.Username {
|
||||||
return true
|
return a.Username < b.Username
|
||||||
}
|
}
|
||||||
if a.MessageID < b.MessageID {
|
if a.MessageID != b.MessageID {
|
||||||
return true
|
return a.MessageID < b.MessageID
|
||||||
}
|
}
|
||||||
if a.Message < b.Message {
|
if a.Message != b.Message {
|
||||||
return true
|
return a.Message < b.Message
|
||||||
}
|
}
|
||||||
if a != b {
|
if a != b {
|
||||||
logger.Errorf(ctx, "msgs A and B look equal, but are not: A:%#+v B:%#+v", a, b)
|
logger.Errorf(ctx, "msgs A and B look equal, but are not: A:%#+v B:%#+v", a, b)
|
||||||
|
@@ -196,6 +196,9 @@ func (ui *chatUI) onReceiveMessage(
|
|||||||
defer ui.List.RefreshItem(prevLen)
|
defer ui.List.RefreshItem(prevLen)
|
||||||
defer ui.MessagesHistoryLocker.ManualUnlock(ctx)
|
defer ui.MessagesHistoryLocker.ManualUnlock(ctx)
|
||||||
ui.MessagesHistory = append(ui.MessagesHistory, msg)
|
ui.MessagesHistory = append(ui.MessagesHistory, msg)
|
||||||
|
if time.Since(msg.CreatedAt) > time.Hour {
|
||||||
|
return
|
||||||
|
}
|
||||||
notificationsEnabled := xsync.DoR1(ctx, &ui.Panel.configLocker, func() bool {
|
notificationsEnabled := xsync.DoR1(ctx, &ui.Panel.configLocker, func() bool {
|
||||||
return ui.Panel.Config.Chat.NotificationsEnabled()
|
return ui.Panel.Config.Chat.NotificationsEnabled()
|
||||||
})
|
})
|
||||||
|
@@ -27,10 +27,8 @@ func colorForPlatform(platID streamcontrol.PlatformName) fyne.ThemeColorName {
|
|||||||
|
|
||||||
var brightColors = []fyne.ThemeColorName{
|
var brightColors = []fyne.ThemeColorName{
|
||||||
theme.ColorNameError,
|
theme.ColorNameError,
|
||||||
theme.ColorNameForeground,
|
|
||||||
theme.ColorNameHyperlink,
|
theme.ColorNameHyperlink,
|
||||||
theme.ColorNamePrimary,
|
theme.ColorNamePrimary,
|
||||||
theme.ColorNameSelection,
|
|
||||||
theme.ColorNameSuccess,
|
theme.ColorNameSuccess,
|
||||||
theme.ColorNameWarning,
|
theme.ColorNameWarning,
|
||||||
}
|
}
|
||||||
|
@@ -313,6 +313,10 @@ func (p *Panel) newDashboardWindow(
|
|||||||
c := w.chat.List
|
c := w.chat.List
|
||||||
w.chat.OnAdd = func(ctx context.Context, _ api.ChatMessage) {
|
w.chat.OnAdd = func(ctx context.Context, _ api.ChatMessage) {
|
||||||
screenHeight := w.Canvas().Size().Height
|
screenHeight := w.Canvas().Size().Height
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "android":
|
||||||
|
screenHeight -= 110
|
||||||
|
}
|
||||||
demandedHeight := float32(w.chat.TotalListHeight) + c.Theme().Size(theme.SizeNamePadding)*float32(c.Length())
|
demandedHeight := float32(w.chat.TotalListHeight) + c.Theme().Size(theme.SizeNamePadding)*float32(c.Length())
|
||||||
logger.Tracef(ctx, "demanded height: %v; screen height: %v", demandedHeight, screenHeight)
|
logger.Tracef(ctx, "demanded height: %v; screen height: %v", demandedHeight, screenHeight)
|
||||||
allowedHeight := math.Min(
|
allowedHeight := math.Min(
|
||||||
@@ -328,6 +332,8 @@ func (p *Panel) newDashboardWindow(
|
|||||||
|
|
||||||
c.ScrollToBottom()
|
c.ScrollToBottom()
|
||||||
c.Refresh()
|
c.Refresh()
|
||||||
|
c.ScrollToBottom()
|
||||||
|
c.Refresh()
|
||||||
}
|
}
|
||||||
w.chat.OnAdd(ctx, api.ChatMessage{})
|
w.chat.OnAdd(ctx, api.ChatMessage{})
|
||||||
layers = append(layers,
|
layers = append(layers,
|
||||||
|
@@ -251,6 +251,7 @@ func (p *Panel) Loop(ctx context.Context, opts ...LoopOption) (_err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.app = fyneapp.New()
|
p.app = fyneapp.New()
|
||||||
|
p.app.Settings().SetTheme(theme.DarkTheme())
|
||||||
p.app.Driver().SetDisableScreenBlanking(true)
|
p.app.Driver().SetDisableScreenBlanking(true)
|
||||||
logger.Tracef(ctx, "SetDisableScreenBlanking(true)")
|
logger.Tracef(ctx, "SetDisableScreenBlanking(true)")
|
||||||
p.createMainWindow(ctx)
|
p.createMainWindow(ctx)
|
||||||
|
Reference in New Issue
Block a user