Merge branch 'v3-alpha' into notifications_darwin

This commit is contained in:
Lea Anthony 2025-04-12 12:56:26 +10:00 committed by GitHub
commit 0b546a1856
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 269 additions and 2632 deletions

View file

@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add prepared statement support to `sqlite` service with JS bindings by [@fbbdev](https://github.com/fbbdev) in [#4067](https://github.com/wailsapp/wails/pull/4067)
- Add `SetMenu()` on window to allow for setting a menu on a window by [@leaanthony](https://github.com/leaanthony)
- Add Notification support by [@popaprozac] in [#4098](https://github.com/wailsapp/wails/pull/4098)
-  Add File Association support for mac by [@wimaha](https://github.com/wimaha) in [#4177](https://github.com/wailsapp/wails/pull/4177)
### Fixed
@ -112,6 +113,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed initially-hidden menu items by [@IanVS](https://github.com/IanVS) in [#4116](https://github.com/wailsapp/wails/pull/4116)
- Fixed assetFileServer not serving `.html` files when non-extension request when `[request]` doesn't exist but `[request].html` does
- Fixed icon generation paths by [@robin-samuel](https://github.com/robin-samuel) in [#4125](https://github.com/wailsapp/wails/pull/4125)
- Fixed Dialogs runtime function returning escaped paths on Windows by [TheGB0077](https://github.com/TheGB0077) in [#4188](https://github.com/wailsapp/wails/pull/4188)
### Changed
@ -140,6 +142,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Built-in service types are now consistently called `Service` by [@fbbdev](https://github.com/fbbdev) in [#4067](https://github.com/wailsapp/wails/pull/4067)
- Built-in service creation functions with options are now consistently called `NewWithConfig` by [@fbbdev](https://github.com/fbbdev) in [#4067](https://github.com/wailsapp/wails/pull/4067)
- `Select` method on `sqlite` service is now named `Query` for consistency with Go APIs by [@fbbdev](https://github.com/fbbdev) in [#4067](https://github.com/wailsapp/wails/pull/4067)
- Templates: moved runtime to "dependencies", organized package.json files by [@IanVS](https://github.com/IanVS) in [#4133](https://github.com/wailsapp/wails/pull/4133)
- Creates and ad-hoc signs app bundles in dev to enable certain macOS APIs by [@popaprozac] in [#4171](https://github.com/wailsapp/wails/pull/4171)
## v3.0.0-alpha.9 - 2025-01-13

View file

@ -62,6 +62,7 @@ fileAssociations:
| description | Description shown in file properties | Windows |
| iconName | Name of the icon file (without extension) in the build folder | All |
| role | Application's role for this file type (e.g., `Editor`, `Viewer`) | macOS |
| mimeType | MIME type for the file (e.g., `image/jpeg`) | macOS |
## Listening for File Open Events
@ -105,6 +106,8 @@ Let's walk through setting up file associations for a simple text editor:
Run `wails3 generate icons --help` for more information.
:::
- For macOS add copy statement like `cp build/darwin/documenticon.icns {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources` in the `create:app:bundle:` task.
2. ### Configure File Associations
Edit the `build/config.yml` file to add your file associations:

View file

@ -123,6 +123,7 @@ the application on macOS. Key features include:
- Building binaries for amd64, arm64 and universal (both) architectures
- Generating `.icns` icon file
- Creating an `.app` bundle for distributing
- Ad-hoc signing `.app` bundles
- Setting macOS-specific build flags and environment variables
## Task Execution and Command Aliases

View file

@ -4,14 +4,15 @@ import (
"embed"
_ "embed"
"fmt"
"github.com/leaanthony/gosod"
"gopkg.in/yaml.v3"
"io/fs"
"os"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/leaanthony/gosod"
"gopkg.in/yaml.v3"
)
//go:embed build_assets
@ -121,6 +122,7 @@ type FileAssociation struct {
Description string `yaml:"description"`
IconName string `yaml:"iconName"`
Role string `yaml:"role"`
MimeType string `yaml:"mimeType"`
}
type UpdateConfig struct {

View file

@ -56,6 +56,7 @@ fileAssociations:
# description: Image File
# iconName: jpegFileIcon
# role: Editor
# mimeType: image/jpeg # (optional)
# Other data
other:

View file

@ -69,7 +69,13 @@ tasks:
- cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS
- cp build/darwin/Info.plist {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents
- codesign --force --deep --sign - {{.BIN_DIR}}/{{.APP_NAME}}.app
run:
cmds:
- '{{.BIN_DIR}}/{{.APP_NAME}}'
- mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/{MacOS,Resources}
- cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Resources
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS
- cp build/darwin/Info.dev.plist {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Info.plist
- codesign --force --deep --sign - {{.BIN_DIR}}/{{.APP_NAME}}.dev.app
- '{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS/{{.APP_NAME}}'

View file

@ -2,27 +2,50 @@
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<string>APPL</string>
<key>CFBundleName</key>
<string>{{.ProductName}}</string>
<string>{{.ProductName}}</string>
<key>CFBundleExecutable</key>
<string>{{.BinaryName}}</string>
<string>{{.BinaryName}}</string>
<key>CFBundleIdentifier</key>
<string>{{.ProductIdentifier}}</string>
<string>{{.ProductIdentifier}}</string>
<key>CFBundleVersion</key>
<string>{{.ProductVersion}}</string>
<string>{{.ProductVersion}}</string>
<key>CFBundleGetInfoString</key>
<string>{{.ProductComments}}</string>
<string>{{.ProductComments}}</string>
<key>CFBundleShortVersionString</key>
<string>{{.ProductVersion}}</string>
<string>{{.ProductVersion}}</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<string>icons</string>
<key>LSMinimumSystemVersion</key>
<string>10.15.0</string>
<string>10.15.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>{{.ProductCopyright}}</string>
<string>{{.ProductCopyright}}</string>
{{- if .FileAssociations}}
<key>CFBundleDocumentTypes</key>
<array>
{{- range .FileAssociations}}
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>{{.Ext}}</string>
</array>
<key>CFBundleTypeName</key>
<string>{{.Name}}</string>
<key>CFBundleTypeRole</key>
<string>{{.Role}}</string>
<key>CFBundleTypeIconFile</key>
<string>{{.IconName}}</string>
{{- if .MimeType}}
<key>CFBundleTypeMimeType</key>
<string>{{.MimeType}}</string>
{{- end}}
</dict>
{{- end}}
</array>
{{- end}}
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>

View file

@ -2,26 +2,49 @@
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<string>APPL</string>
<key>CFBundleName</key>
<string>{{.ProductName}}</string>
<string>{{.ProductName}}</string>
<key>CFBundleExecutable</key>
<string>{{.BinaryName}}</string>
<string>{{.BinaryName}}</string>
<key>CFBundleIdentifier</key>
<string>{{.ProductIdentifier}}</string>
<string>{{.ProductIdentifier}}</string>
<key>CFBundleVersion</key>
<string>{{.ProductVersion}}</string>
<string>{{.ProductVersion}}</string>
<key>CFBundleGetInfoString</key>
<string>{{.ProductComments}}</string>
<string>{{.ProductComments}}</string>
<key>CFBundleShortVersionString</key>
<string>{{.ProductVersion}}</string>
<string>{{.ProductVersion}}</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<string>icons</string>
<key>LSMinimumSystemVersion</key>
<string>10.15.0</string>
<string>10.15.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>{{.ProductCopyright}}</string>
<string>{{.ProductCopyright}}</string>
{{- if .FileAssociations}}
<key>CFBundleDocumentTypes</key>
<array>
{{- range .FileAssociations}}
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>{{.Ext}}</string>
</array>
<key>CFBundleTypeName</key>
<string>{{.Name}}</string>
<key>CFBundleTypeRole</key>
<string>{{.Role}}</string>
<key>CFBundleTypeIconFile</key>
<string>{{.IconName}}</string>
{{- if .MimeType}}
<key>CFBundleTypeMimeType</key>
<string>{{.MimeType}}</string>
{{- end}}
</dict>
{{- end}}
</array>
{{- end}}
</dict>
</plist>

View file

@ -10,11 +10,11 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"lit": "^3.1.0"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.0",
"@wailsio/runtime": "latest"
"vite": "^5.0.0"
}
}
}

View file

@ -10,10 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"lit": "^3.1.0"
},
"devDependencies": {
"vite": "^5.0.0",
"@wailsio/runtime": "latest"
"vite": "^5.0.0"
}
}
}

View file

@ -10,12 +10,12 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"preact": "^10.19.3"
},
"devDependencies": {
"@preact/preset-vite": "^2.7.0",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}
}

View file

@ -10,11 +10,11 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"preact": "^10.19.3"
},
"devDependencies": {
"@preact/preset-vite": "^2.7.0",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}
}

View file

@ -9,12 +9,12 @@
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8"
},
"dependencies": {
"@builder.io/qwik": "^1.3.0",
"@wailsio/runtime": "latest"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8"
}
}

View file

@ -9,12 +9,12 @@
"build": "vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8"
},
"dependencies": {
"@builder.io/qwik": "^1.3.0",
"@wailsio/runtime": "latest"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8"
}
}

View file

@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
@ -18,7 +19,6 @@
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.5.0",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}

View file

@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
@ -17,7 +18,6 @@
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.5.0",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}

View file

@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
@ -18,7 +19,6 @@
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}

View file

@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
@ -17,7 +18,6 @@
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}

View file

@ -10,12 +10,12 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"solid-js": "^1.8.7"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.8",
"vite-plugin-solid": "^2.8.0",
"@wailsio/runtime": "latest"
"vite-plugin-solid": "^2.8.0"
}
}

View file

@ -10,11 +10,11 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"solid-js": "^1.8.7"
},
"devDependencies": {
"vite": "^5.0.8",
"vite-plugin-solid": "^2.8.0",
"@wailsio/runtime": "latest"
"vite-plugin-solid": "^2.8.0"
}
}

View file

@ -10,6 +10,9 @@
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
"@wailsio/runtime": "latest"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@tsconfig/svelte": "^5.0.2",
@ -17,7 +20,6 @@
"svelte-check": "^3.6.2",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}
}

View file

@ -9,10 +9,12 @@
"build": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"svelte": "^4.2.8",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"vite": "^5.0.8"
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,26 +1,26 @@
{
"name": "frontend",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
"@sveltejs/adapter-static": "^3.0.5",
"@wailsio/runtime": "^3.0.0-alpha.28"
}
"name": "frontend",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"dependencies": {
"@wailsio/runtime": "^3.0.0-alpha.28"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^5.0.3"
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,25 +1,24 @@
{
"name": "frontend",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
"@sveltejs/adapter-static": "^3.0.5",
"@wailsio/runtime": "^3.0.0-alpha.28"
}
"name": "frontend",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build:dev": "vite build --minify false --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
},
"dependencies": {
"@wailsio/runtime": "^3.0.0-alpha.28"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"vite": "^5.0.3"
}
}

View file

@ -9,9 +9,11 @@
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest"
},
"devDependencies": {
"typescript": "^4.9.3",
"vite": "^5.0.0",
"@wailsio/runtime": "latest"
"vite": "^5.0.0"
}
}
}

View file

@ -9,8 +9,10 @@
"build": "vite build --mode production",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^5.0.0",
"dependencies": {
"@wailsio/runtime": "latest"
},
"devDependencies": {
"vite": "^5.0.0"
}
}
}

View file

@ -10,13 +10,13 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"vue": "^3.2.45"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.0.0",
"typescript": "^4.9.3",
"vite": "^5.0.0",
"@wailsio/runtime": "latest",
"vue-tsc": "^1.0.11"
}
}
}

View file

@ -10,11 +10,11 @@
"preview": "vite preview"
},
"dependencies": {
"@wailsio/runtime": "latest",
"vue": "^3.2.45"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.0.0",
"vite": "^5.0.0",
"@wailsio/runtime": "latest"
"vite": "^5.0.0"
}
}
}

View file

@ -291,6 +291,9 @@ func (d *OpenFileDialogStruct) PromptForMultipleSelection() ([]string, error) {
}
selections, err := InvokeSyncWithResultAndError(d.impl.show)
if err != nil {
return nil, err
}
var result []string
for filename := range selections {

View file

@ -247,7 +247,20 @@ func showCfdDialog(newDlg func() (cfd.Dialog, error), isMultiSelect bool) (any,
}()
if multi, _ := dlg.(cfd.OpenMultipleFilesDialog); multi != nil && isMultiSelect {
return multi.ShowAndGetResults()
paths, err := multi.ShowAndGetResults()
if err != nil {
return nil, err
}
for i, path := range paths {
paths[i] = filepath.Clean(path)
}
return paths, nil
}
return dlg.ShowAndGetResult()
path, err := dlg.ShowAndGetResult()
if err != nil {
return nil, err
}
return filepath.Clean(path), nil
}

View file

@ -0,0 +1,57 @@
//go:build windows
package application_test
import (
"path/filepath"
"testing"
"github.com/matryer/is"
)
func TestCleanPath(t *testing.T) {
i := is.New(t)
tests := []struct {
name string
inputPath string
expected string
}{
{
name: "path with double separators",
inputPath: `C:\\temp\\folder`,
expected: `C:\temp\folder`,
},
{
name: "path with forward slashes",
inputPath: `C://temp//folder`,
expected: `C:\temp\folder`,
},
{
name: "path with trailing separator",
inputPath: `C:\\temp\\folder\\`,
expected: `C:\temp\folder`,
},
{
name: "path with escaped tab character",
inputPath: `C:\\Users\\test\\tab.txt`,
expected: `C:\Users\test\tab.txt`,
},
{
name: "newline character",
inputPath: `C:\\Users\\test\\newline\\n.txt`,
expected: `C:\Users\test\newline\n.txt`,
},
{
name: "UNC path with multiple separators",
inputPath: `\\\\\\\\host\\share\\test.txt`,
expected: `\\\\host\share\test.txt`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cleaned := filepath.Clean(tt.inputPath)
i.Equal(cleaned, tt.expected)
})
}
}

View file

@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Fixed locking issue on Windows when multiselect dialog returns an error. Fixed in [PR](https://github.com/wailsapp/wails/pull/4156) by @johannes-luebke
## v2.9.1 - 2024-06-18
### Fixed