Fix title/description editing on Android
Some checks are pending
rolling-release / build (push) Waiting to run
rolling-release / rolling-release (push) Blocked by required conditions

This commit is contained in:
Dmitrii Okunev
2025-05-04 16:04:49 +01:00
parent de0c9f965e
commit fc3ea8cd30
6 changed files with 122 additions and 15 deletions

View File

@@ -5,4 +5,4 @@ Website = "https://github.com/xaionaro/streamctl"
Name = "streampanel"
ID = "center.dx.streampanel"
Version = "0.1.0"
Build = 361
Build = 367

2
go.sum
View File

@@ -1161,8 +1161,6 @@ github.com/xaionaro-go/proxy v0.0.0-20250111150848-1f0e7b262638 h1:w7Dt6Mpj36S2c
github.com/xaionaro-go/proxy v0.0.0-20250111150848-1f0e7b262638/go.mod h1:hOkJBFoMsnCDoZgpSPTHYbnevPgtpD16d9Xga91U+Eo=
github.com/xaionaro-go/pulse v0.0.0-20241023202712-7151fa00d4bb h1:9iHPI27CYbmJDhzEuCABQthE/DGVNvT60ybWvv3BV8w=
github.com/xaionaro-go/pulse v0.0.0-20241023202712-7151fa00d4bb/go.mod h1:cpYspI6YljhkUf1WLXLLDmeaaPFc3CnGLjDZf9dZ4no=
github.com/xaionaro-go/recoder v0.0.0-20250428012439-3fc4b32e59a9 h1:744Nrf5lfHG0lOpivgXHDDsENer25zJlr/f5puIWhGs=
github.com/xaionaro-go/recoder v0.0.0-20250428012439-3fc4b32e59a9/go.mod h1:Twc+NcQQ+afg4RHxwqqo9pRGIaY7+QwpuAiYa7ClSLw=
github.com/xaionaro-go/recoder v0.0.0-20250503155018-6f353978d332 h1:jB5I8UE9UL6g7qQKaZ/g9wt3lIXxgkDDJX1cV37D5go=
github.com/xaionaro-go/recoder v0.0.0-20250503155018-6f353978d332/go.mod h1:Twc+NcQQ+afg4RHxwqqo9pRGIaY7+QwpuAiYa7ClSLw=
github.com/xaionaro-go/secret v0.0.0-20250111141743-ced12e1082c2 h1:QHpTWfyfmz65cE0MtFXe9fScdi+X0VIYR2wgolSYEUk=

View File

@@ -0,0 +1,9 @@
package streampanel
import (
"fyne.io/fyne/v2"
)
func isMobile() bool {
return fyne.CurrentDevice().IsMobile()
}

View File

@@ -37,6 +37,7 @@ My keywords: %s`, tagsString))
return
}
p.streamTitleField.SetText(t)
p.streamTitleLabel.SetText(t)
}
func (p *Panel) generateNewDescription(
@@ -54,6 +55,7 @@ func (p *Panel) generateNewDescription(
return
}
p.streamDescriptionField.SetText(t)
p.streamDescriptionLabel.SetText(t)
}
func (p *Panel) generateAlternativeTextFor(

View File

@@ -84,7 +84,9 @@ type Panel struct {
startStopButton *widget.Button
profilesListWidget *widget.List
streamTitleField *widget.Entry
streamTitleLabel *widget.Label
streamDescriptionField *widget.Entry
streamDescriptionLabel *widget.Label
dashboardLocker xsync.Mutex
dashboardShowHideButton *widget.Button
@@ -1127,19 +1129,17 @@ func resizeWindow(w fyne.Window, newSize fyne.Size) {
}
func setupStreamString() string {
switch runtime.GOOS {
case "android":
if isMobile() {
return "Set!"
default:
} else {
return "Setup stream"
}
}
func startStreamString() string {
switch runtime.GOOS {
case "android":
if isMobile() {
return "Go!"
default:
} else {
return "Start stream"
}
}
@@ -1387,6 +1387,7 @@ func (p *Panel) initMainWindow(
}
p.streamTitleField = widget.NewEntry()
p.streamTitleField.SetPlaceHolder("stream title")
p.streamTitleField.Wrapping = fyne.TextWrapWord
p.streamTitleField.OnChanged = func(s string) {
if len(s) > youtubeTitleLength {
p.streamTitleField.SetText(s[:youtubeTitleLength])
@@ -1400,6 +1401,35 @@ func (p *Panel) initMainWindow(
p.startStopButton.OnTapped()
p.startStopButton.OnTapped()
}
p.streamTitleLabel = widget.NewLabel("")
p.streamTitleLabel.Wrapping = fyne.TextWrapWord
streamTitleButton := widget.NewButtonWithIcon("", theme.SettingsIcon(), func() {
f := widget.NewMultiLineEntry()
f.SetText(p.streamTitleField.Text)
f.Wrapping = fyne.TextWrapWord
w := p.app.NewWindow("title edit")
w.SetContent(container.NewBorder(
nil,
container.NewBorder(
nil,
nil,
widget.NewButtonWithIcon("Cancel", theme.DocumentSaveIcon(), func() {
w.Close()
}),
widget.NewButtonWithIcon("Save", theme.DocumentSaveIcon(), func() {
f.Text = strings.ReplaceAll(f.Text, "\n", " ")
f.Text = f.Text[:youtubeTitleLength]
p.streamTitleField.SetText(f.Text)
p.streamTitleLabel.SetText(f.Text)
w.Close()
}),
),
nil,
nil,
f,
))
w.Show()
})
p.streamDescriptionField = widget.NewMultiLineEntry()
p.streamDescriptionField.SetPlaceHolder("stream description")
@@ -1411,6 +1441,41 @@ func (p *Panel) initMainWindow(
p.startStopButton.OnTapped()
p.startStopButton.OnTapped()
}
p.streamDescriptionLabel = widget.NewLabel("")
streamDescriptionButton := widget.NewButtonWithIcon("", theme.SettingsIcon(), func() {
f := widget.NewMultiLineEntry()
f.SetText(p.streamDescriptionField.Text)
f.Wrapping = fyne.TextWrapWord
w := p.app.NewWindow("title edit")
w.SetContent(container.NewBorder(
nil,
container.NewBorder(
nil,
nil,
widget.NewButtonWithIcon("Cancel", theme.DocumentSaveIcon(), func() {
w.Close()
}),
widget.NewButtonWithIcon("Save", theme.DocumentSaveIcon(), func() {
p.streamDescriptionField.SetText(f.Text)
p.streamDescriptionLabel.SetText(f.Text)
w.Close()
}),
),
nil,
nil,
f,
))
w.Show()
})
if isMobile() {
p.streamTitleField.Hide()
} else {
p.streamTitleLabel.Hide()
streamTitleButton.Hide()
p.streamDescriptionLabel.Hide()
streamDescriptionButton.Hide()
}
p.twitchCheck = widget.NewCheck("Twitch", nil)
p.twitchCheck.SetChecked(true)
@@ -1433,8 +1498,27 @@ func (p *Panel) initMainWindow(
})
bottomPanel := container.NewVBox(
container.NewBorder(nil, nil, regenerateTitleButton, nil, p.streamTitleField),
container.NewBorder(nil, nil, regenerateDescriptionButton, nil, p.streamDescriptionField),
container.NewBorder(
nil, nil,
regenerateTitleButton, nil,
container.NewStack(
p.streamTitleField,
container.NewBorder(
nil, nil, streamTitleButton, nil,
container.NewHScroll(p.streamTitleLabel),
)),
),
container.NewBorder(
nil, nil,
regenerateDescriptionButton, nil,
container.NewStack(
p.streamDescriptionField,
container.NewBorder(
nil, nil, streamDescriptionButton, nil,
//container.NewHScroll(p.streamDescriptionLabel),
),
),
),
container.NewBorder(
nil,
nil,

View File

@@ -638,8 +638,18 @@ func (p *Panel) profileWindow(
}),
)
w.SetContent(
container.NewBorder(
var content fyne.CanvasObject
if isMobile() {
content = container.NewVScroll(container.NewVBox(
profileName,
defaultStreamTitle,
defaultStreamDescription,
container.NewVBox(bottomContentLeft...),
container.NewVBox(bottomContentRight...),
container.NewVBox(bottomContentCommon...),
))
} else {
content = container.NewBorder(
nil,
container.NewVBox(bottomContentCommon...),
nil,
@@ -661,8 +671,10 @@ func (p *Panel) profileWindow(
bottomContentRight...,
),
),
),
)
)
}
w.SetContent(content)
w.Show()
return w
}
@@ -916,7 +928,9 @@ func (p *Panel) onProfilesListSelect(
})
p.selectedProfileName = ptrCopy(profileName)
p.streamTitleField.SetText(profile.DefaultStreamTitle)
p.streamTitleLabel.SetText(profile.DefaultStreamTitle)
p.streamDescriptionField.SetText(profile.DefaultStreamDescription)
p.streamDescriptionLabel.SetText(profile.DefaultStreamDescription)
}
func (p *Panel) onProfilesListUnselect(