Skip to content

Commit

Permalink
Remove redundant method
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Nov 28, 2024
1 parent fae16e9 commit c64f5b2
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
4 changes: 0 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,6 @@ func newAppWithDriver(d fyne.Driver, clipboard fyne.Clipboard, id string) fyne.A
return newApp
}

func rootConfigDir() string {
return app.RootConfigDir()
}

// marker interface to pass system tray to supporting drivers
type systrayDriver interface {
SetSystemTrayMenu(*fyne.Menu)
Expand Down
4 changes: 3 additions & 1 deletion app/app_mobile_and_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import (
"os"
"testing"

"fyne.io/fyne/v2/internal/app"

"github.com/stretchr/testify/assert"
)

func Test_RootConfigDir(t *testing.T) {
oldEnv := os.Getenv("FILESPATH")
os.Setenv("FILESPATH", "/tmp")

assert.Equal(t, "/tmp", rootConfigDir())
assert.Equal(t, "/tmp", app.RootConfigDir())
os.Setenv("FILESPATH", oldEnv)
}

Expand Down
8 changes: 6 additions & 2 deletions app/preferences_android.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

package app

import "path/filepath"
import (
"path/filepath"

"fyne.io/fyne/v2/internal/app"
)

// storagePath returns the location of the settings storage
func (p *preferences) storagePath() string {
Expand All @@ -12,7 +16,7 @@ func (p *preferences) storagePath() string {

// storageRoot returns the location of the app storage
func (a *fyneApp) storageRoot() string {
return rootConfigDir() // we are in a sandbox, so no app ID added to this path
return app.RootConfigDir() // we are in a sandbox, so no app ID added to this path
}

func (p *preferences) watch() {
Expand Down
4 changes: 3 additions & 1 deletion app/preferences_ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package app

import (
"path/filepath"

"fyne.io/fyne/v2/internal/app"
)
import "C"

Expand All @@ -15,7 +17,7 @@ func (p *preferences) storagePath() string {

// storageRoot returns the location of the app storage
func (a *fyneApp) storageRoot() string {
return rootConfigDir() // we are in a sandbox, so no app ID added to this path
return app.RootConfigDir() // we are in a sandbox, so no app ID added to this path
}

func (p *preferences) watch() {
Expand Down
8 changes: 6 additions & 2 deletions app/preferences_mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

package app

import "path/filepath"
import (
"path/filepath"

"fyne.io/fyne/v2/internal/app"
)

// storagePath returns the location of the settings storage
func (p *preferences) storagePath() string {
Expand All @@ -11,7 +15,7 @@ func (p *preferences) storagePath() string {

// storageRoot returns the location of the app storage
func (a *fyneApp) storageRoot() string {
return filepath.Join(rootConfigDir(), a.UniqueID())
return filepath.Join(app.RootConfigDir(), a.UniqueID())
}

func (p *preferences) watch() {
Expand Down
8 changes: 6 additions & 2 deletions app/preferences_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

package app

import "path/filepath"
import (
"path/filepath"

"fyne.io/fyne/v2/internal/app"
)

// storagePath returns the location of the settings storage
func (p *preferences) storagePath() string {
Expand All @@ -11,7 +15,7 @@ func (p *preferences) storagePath() string {

// storageRoot returns the location of the app storage
func (a *fyneApp) storageRoot() string {
return filepath.Join(rootConfigDir(), a.UniqueID())
return filepath.Join(app.RootConfigDir(), a.UniqueID())
}

func (p *preferences) watch() {
Expand Down
8 changes: 4 additions & 4 deletions app/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"

"fyne.io/fyne/v2"
internalapp "fyne.io/fyne/v2/internal/app"
"fyne.io/fyne/v2/internal/app"
"fyne.io/fyne/v2/internal/build"
"fyne.io/fyne/v2/theme"
)
Expand All @@ -27,7 +27,7 @@ type SettingsSchema struct {

// StoragePath returns the location of the settings storage
func (sc *SettingsSchema) StoragePath() string {
return filepath.Join(rootConfigDir(), "settings.json")
return filepath.Join(app.RootConfigDir(), "settings.json")
}

// Declare conformity with Settings interface
Expand Down Expand Up @@ -129,7 +129,7 @@ func (s *settings) fileChanged() {
}

func (s *settings) loadSystemTheme() fyne.Theme {
path := filepath.Join(rootConfigDir(), "theme.json")
path := filepath.Join(app.RootConfigDir(), "theme.json")
data, err := fyne.LoadResourceFromPath(path)
if err != nil {
if !os.IsNotExist(err) {
Expand All @@ -153,7 +153,7 @@ func (s *settings) setupTheme() {
name = env
}

variant := internalapp.DefaultVariant()
variant := app.DefaultVariant()
effectiveTheme := s.theme
if !s.themeSpecified {
effectiveTheme = s.loadSystemTheme()
Expand Down

0 comments on commit c64f5b2

Please sign in to comment.