Skip to content

Commit 2b7c8d9

Browse files
committedSep 10, 2024·
chore: open with for mac, and bump version to 1.0.1
1 parent 7c92190 commit 2b7c8d9

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed
 

‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
v ?= 1.0.0
1+
v ?= 1.0.1
22

33
pkg-some:
44
wails build -platform windows/amd64,windows/arm64,linux/amd64

‎backend/app.go

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/wailsapp/wails/v2/pkg/options"
1111
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
1212
"github.com/wailsapp/wails/v2/pkg/options/linux"
13+
"github.com/wailsapp/wails/v2/pkg/options/mac"
1314
)
1415

1516
func NewApp(icon []byte, assets embed.FS) (*App, *options.App) {
@@ -37,6 +38,7 @@ func NewApp(icon []byte, assets embed.FS) (*App, *options.App) {
3738
AssetServer: &assetserver.Options{Assets: assets},
3839
Bind: []interface{}{app},
3940
Linux: &linux.Options{Icon: icon},
41+
Mac: &mac.Options{OnFileOpen: app.openFileForMac},
4042
DragAndDrop: &options.DragAndDrop{
4143
EnableFileDrop: true,
4244
},

‎backend/common.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package backend
22

33
import (
44
"context"
5+
"fmt"
56
"os"
67
"strings"
78
"time"
@@ -11,7 +12,7 @@ import (
1112
)
1213

1314
const (
14-
Version = "1.0.0"
15+
Version = "1.0.1"
1516
Name = "Safelock"
1617
statusUpdateKey = "status_update"
1718
statusEndKey = "status_end"
@@ -66,6 +67,16 @@ func (a App) domReady(ctx context.Context) {
6667
}
6768
}
6869

70+
func (a App) openFileForMac(path string) {
71+
if !strings.HasSuffix(path, ".sla") {
72+
a.ShowErrMsg(fmt.Sprintf("Unsupported file format (%s)", path))
73+
return
74+
}
75+
76+
EventsEmit(a.ctx, openedSlaKey, path)
77+
runtime.WindowShow(a.ctx)
78+
}
79+
6980
func (a App) GetVersion() string {
7081
return Version
7182
}

0 commit comments

Comments
 (0)
Please sign in to comment.