fyne.Do in notification toast
This commit is contained in:
@@ -307,14 +307,18 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
})
|
})
|
||||||
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
||||||
notifySuccess := func(n int) {
|
notifySuccess := func(n int) {
|
||||||
msg := lang.LocalizePluralKey("playlist.addedtracks",
|
fyne.Do(func() {
|
||||||
"Added tracks to playlist", n, map[string]string{"trackCount": strconv.Itoa(n)})
|
msg := lang.LocalizePluralKey("playlist.addedtracks",
|
||||||
m.ToastProvider.ShowSuccessToast(msg)
|
"Added tracks to playlist", n, map[string]string{"trackCount": strconv.Itoa(n)})
|
||||||
|
m.ToastProvider.ShowSuccessToast(msg)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
notifyError := func() {
|
notifyError := func() {
|
||||||
m.ToastProvider.ShowErrorToast(
|
fyne.Do(func() {
|
||||||
lang.L("An error occurred adding tracks to the playlist"),
|
m.ToastProvider.ShowErrorToast(
|
||||||
)
|
lang.L("An error occurred adding tracks to the playlist"),
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
pop.Hide()
|
pop.Hide()
|
||||||
m.App.Config.Application.AddToPlaylistSkipDuplicates = sp.SkipDuplicates
|
m.App.Config.Application.AddToPlaylistSkipDuplicates = sp.SkipDuplicates
|
||||||
@@ -324,7 +328,7 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
notifySuccess(len(trackIDs))
|
notifySuccess(len(trackIDs))
|
||||||
} else {
|
} else {
|
||||||
log.Println("error adding tracks to playlist: %s", err.Error())
|
log.Printf("error adding tracks to playlist: %s", err.Error())
|
||||||
notifyError()
|
notifyError()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -348,7 +352,7 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
notifySuccess(len(filterTrackIDs))
|
notifySuccess(len(filterTrackIDs))
|
||||||
} else {
|
} else {
|
||||||
log.Println("error adding tracks to playlist: %s", err.Error())
|
log.Printf("error adding tracks to playlist: %s", err.Error())
|
||||||
notifyError()
|
notifyError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -359,7 +363,7 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
notifySuccess(len(trackIDs))
|
notifySuccess(len(trackIDs))
|
||||||
} else {
|
} else {
|
||||||
log.Println("error adding tracks to playlist: %s", err.Error())
|
log.Printf("error adding tracks to playlist: %s", err.Error())
|
||||||
notifyError()
|
notifyError()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ func (t *ToastOverlay) showToast(isErr bool, message string) {
|
|||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
t.dismissToast()
|
fyne.Do(t.dismissToast)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user