2 Commits

Author SHA1 Message Date
aynakeya
8674e936e2 update deps 2025-11-26 23:14:02 +08:00
aynakeya
0bea12d0b3 fix source login using fyne.Do 2025-11-26 23:13:01 +08:00
4 changed files with 28 additions and 14 deletions

3
go.mod
View File

@@ -12,7 +12,7 @@ replace (
)
require (
fyne.io/fyne/v2 v2.7.0
fyne.io/fyne/v2 v2.7.1
github.com/AynaLivePlayer/liveroom-sdk v0.1.0
github.com/AynaLivePlayer/miaosic v0.2.5
github.com/adrg/libvlc-go/v3 v3.1.6
@@ -66,7 +66,6 @@ require (
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade // indirect
github.com/jinzhu/copier v0.4.0 // indirect
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 // indirect
github.com/k0kubun/pp/v3 v3.5.0 // indirect
github.com/makiuchi-d/gozxing v0.1.1 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/nicksnyder/go-i18n/v2 v2.5.1 // indirect

4
go.sum
View File

@@ -1,5 +1,5 @@
fyne.io/fyne/v2 v2.7.0 h1:GvZSpE3X0liU/fqstInVvRsaboIVpIWQ4/sfjDGIGGQ=
fyne.io/fyne/v2 v2.7.0/go.mod h1:xClVlrhxl7D+LT+BWYmcrW4Nf+dJTvkhnPgji7spAwE=
fyne.io/fyne/v2 v2.7.1 h1:ja7rNHWWEooha4XBIZNnPP8tVFwmTfwMJdpZmLxm2Zc=
fyne.io/fyne/v2 v2.7.1/go.mod h1:xClVlrhxl7D+LT+BWYmcrW4Nf+dJTvkhnPgji7spAwE=
fyne.io/systray v1.11.1-0.20250603113521-ca66a66d8b58 h1:eA5/u2XRd8OUkoMqEv3IBlFYSruNlXD8bRHDiqm0VNI=
fyne.io/systray v1.11.1-0.20250603113521-ca66a66d8b58/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs=
github.com/AynaLivePlayer/blivedm-go v0.0.0-20250629154348-690af765bfbc h1:t1fMdqUjB2lR9uuGQ9yWJ7LJ3h1hXhI+LhbTpElPueI=

View File

@@ -19,3 +19,8 @@ func RunInFyneThread(fn func()) {
//fn()
fyne.Do(fn)
}
func RunInFyneThreadAndWait(fn func()) {
//fn()
fyne.DoAndWait(fn)
}

View File

@@ -60,7 +60,7 @@ func (w *SourceLogin) Disable() error {
if p, ok := miaosic.GetProvider(pname); ok {
pl, ok2 := p.(miaosic.Loginable)
if ok2 {
w.log.Info("save session for %s", pname)
w.log.Infof("save session for %s", pname)
w.sessions[pname] = pl.SaveSession()
}
}
@@ -129,7 +129,9 @@ func (w *SourceLogin) CreatePanel() fyne.CanvasObject {
events.ErrorUpdateEvent{Error: err})
return
}
currentUser.SetText(i18n.T("plugin.sourcelogin.current_user.notlogin"))
fyne.DoAndWait(func() {
currentUser.SetText(i18n.T("plugin.sourcelogin.current_user.notlogin"))
})
w.sessions[providerChoice.Selected] = ""
},
)
@@ -147,7 +149,9 @@ func (w *SourceLogin) CreatePanel() fyne.CanvasObject {
if providerChoice.Selected == "" {
return
}
qrStatus.SetText("")
fyne.DoAndWait(func() {
qrStatus.SetText("")
})
w.log.Info("getting a new qr code for login")
pvdr, _ := miaosic.GetProvider(providerChoice.Selected)
provider := pvdr.(miaosic.Loginable)
@@ -165,9 +169,11 @@ func (w *SourceLogin) CreatePanel() fyne.CanvasObject {
return
}
//w.log.Debug("create img from raw data")
pic := canvas.NewImageFromReader(bytes.NewReader(data), "qrcode")
qrcodeImg.Resource = pic.Resource
qrcodeImg.Refresh()
fyne.DoAndWait(func() {
pic := canvas.NewImageFromReader(bytes.NewReader(data), "qrcode")
qrcodeImg.Resource = pic.Resource
qrcodeImg.Refresh()
})
},
)
finishQrBtn := component.NewAsyncButton(
@@ -189,12 +195,16 @@ func (w *SourceLogin) CreatePanel() fyne.CanvasObject {
events.ErrorUpdateEvent{Error: err})
return
}
qrStatus.SetText(result.Message)
fyne.DoAndWait(func() {
qrStatus.SetText(result.Message)
})
if result.Success {
currentLoginSession = nil
qrcodeImg.Resource = resource.ImageEmptyQrCode
qrcodeImg.Refresh()
providerChoice.OnChanged(currentProvider)
fyne.DoAndWait(func() {
qrcodeImg.Resource = resource.ImageEmptyQrCode
qrcodeImg.Refresh()
providerChoice.OnChanged(currentProvider)
})
w.sessions[currentProvider] = provider.SaveSession()
}
},