-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
104 lines (90 loc) · 2.31 KB
/
Copy pathmain.go
File metadata and controls
104 lines (90 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package main
import (
"ayo/internal/auth"
"ayo/internal/fileops"
"ayo/internal/platform/database"
"ayo/internal/settings"
"context"
"fmt"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/mac"
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
return fmt.Sprintf("Hello %s, It's show time!", name)
}
func main() {
// Create an instance of the app structure
app := NewApp()
// Internal Services
// Use local data directory for development simplicity
db, err := database.NewDatabase("data/ayo.db")
if err != nil {
panic(err)
}
// Initialize Auth Module
authRepository := auth.NewRepository(db)
authService := auth.NewService(authRepository)
// Initialize File Operations Service
fileOpsService := fileops.NewService()
// Initialize Settings Service
settingsService := settings.NewService(authService)
// Create application with options
err = wails.Run(&options.App{
Title: "ayo",
Width: 1024,
Height: 768,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: func(ctx context.Context) {
app.startup(ctx)
fileOpsService.Startup(ctx)
settingsService.Startup(ctx)
},
DisableResize: false,
Mac: &mac.Options{
TitleBar: &mac.TitleBar{
TitlebarAppearsTransparent: false,
HideTitle: false,
HideTitleBar: false,
FullSizeContent: false,
UseToolbar: false,
HideToolbarSeparator: true,
},
Appearance: mac.NSAppearanceNameDarkAqua,
WebviewIsTransparent: false,
WindowIsTranslucent: false,
About: &mac.AboutInfo{
Title: "ayo",
Message: "A Wails Application",
Icon: nil,
},
},
Bind: []interface{}{
app,
authService,
fileOpsService,
settingsService,
},
})
if err != nil {
println("Error:", err.Error())
}
}