Skip to content

Commit

Permalink
Apply something similar for application lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 7, 2024
1 parent 36947b2 commit 2968c87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type fyneApp struct {
uniqueID string

cloud fyne.CloudProvider
lifecycle fyne.Lifecycle
lifecycle app.Lifecycle
settings *settings
storage fyne.Storage
prefs fyne.Preferences
Expand Down Expand Up @@ -97,7 +97,7 @@ func (a *fyneApp) Preferences() fyne.Preferences {
}

func (a *fyneApp) Lifecycle() fyne.Lifecycle {
return a.lifecycle
return &a.lifecycle
}

func (a *fyneApp) newDefaultPreferences() *preferences {
Expand Down Expand Up @@ -131,11 +131,11 @@ func makeStoreDocs(id string, s *store) *internal.Docs {
}

func newAppWithDriver(d fyne.Driver, id string) fyne.App {
newApp := &fyneApp{uniqueID: id, driver: d, lifecycle: &app.Lifecycle{}}
newApp := &fyneApp{uniqueID: id, driver: d}
fyne.SetCurrentApp(newApp)

newApp.prefs = newApp.newDefaultPreferences()
newApp.lifecycle.(*app.Lifecycle).SetOnStoppedHookExecuted(func() {
newApp.lifecycle.SetOnStoppedHookExecuted(func() {
if prefs, ok := newApp.prefs.(*preferences); ok {
prefs.forceImmediateSave()
}
Expand Down

0 comments on commit 2968c87

Please sign in to comment.