diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index bad46f7d0..163076e87 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -13,30 +13,31 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest, macos-11] - go-version: [1.20, 1.21] + go-version: ['1.20'] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install linux dependencies if: matrix.os == 'ubuntu-latest' run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config - name: Setup Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: ./v2/go.sum - name: Run tests (mac) - if: matrix.os == 'macos-latest' + if: matrix.os == 'macos-latest' || matrix.os == 'macos-11' env: CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13 working-directory: ./v2 run: go test -v ./... - name: Run tests (!mac) - if: matrix.os != 'macos-latest' + if: matrix.os != 'macos-latest' && matrix.os != 'macos-11' working-directory: ./v2 run: go test -v ./... @@ -50,7 +51,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 @@ -89,15 +90,16 @@ jobs: vanilla-ts, plain, ] - go-version: [1.18, 1.19] + go-version: ['1.20'] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: ./v2/go.sum - name: Build Wails CLI run: | diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 46acb8ee4..55bed637a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,28 +26,28 @@ jobs: run: | echo "::warning::Feature branch does not contain any changes to the website." - lint_go: - name: Run Go Linters - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: "1.21" - - - name: Update go modules - working-directory: ./v2 - run: go mod tidy - - - name: Run Linter - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54 - working-directory: ./v2 - args: --timeout=10m0s --config ./.golangci.yml +# lint_go: +# name: Run Go Linters +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v4 +# +# - name: Setup Go +# uses: actions/setup-go@v4 +# with: +# go-version: "1.21" +# +# - name: Update go modules +# working-directory: ./v2 +# run: go mod tidy +# +# - name: Run Linter +# uses: golangci/golangci-lint-action@v3 +# with: +# version: v1.54 +# working-directory: ./v2 +# args: --timeout=10m0s --config ./.golangci.yml test_go: name: Run Go Tests @@ -56,7 +56,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - go-version: [1.18, 1.19] + go-version: [1.19] steps: - name: Checkout code diff --git a/v2/go.mod b/v2/go.mod index 61384b9ed..a2d0ab416 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -1,8 +1,6 @@ module github.com/wailsapp/wails/v2 -go 1.21 - -toolchain go1.21.0 +go 1.20 require ( github.com/Masterminds/semver v1.5.0 diff --git a/v2/go.sum b/v2/go.sum index 6b9ebb71d..fdc18d024 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -208,8 +208,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/tc-hib/winres v0.1.5 h1:2dA5yfjdoEA3UyRaOC92HNMt3jap66pLzoW4MjpC/0M= -github.com/tc-hib/winres v0.1.5/go.mod h1:pe6dOR40VOrGz8PkzreVKNvEKnlE8t4yR8A8naL+t7A= github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA= github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk= github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= @@ -257,9 +255,6 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc= golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.10.0 h1:gXjUUtwtx5yOE0VKWq1CH4IJAClq4UGgUA3i+rpON9M= -golang.org/x/image v0.10.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0= golang.org/x/image v0.12.0 h1:w13vZbU4o5rKOFFR8y7M+c4A5jXDC0uXTdHYRP8X2DQ= golang.org/x/image v0.12.0/go.mod h1:Lu90jvHG7GfemOIcldsh9A2hS01ocl6oNO7ype5mEnk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -320,7 +315,6 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/v2/internal/frontend/desktop/darwin/Application.m b/v2/internal/frontend/desktop/darwin/Application.m index aa35b2a6b..c428b4ce6 100644 --- a/v2/internal/frontend/desktop/darwin/Application.m +++ b/v2/internal/frontend/desktop/darwin/Application.m @@ -396,7 +396,7 @@ void ReleaseContext(void *inctx) { // Credit: https://stackoverflow.com/q/33319295 void WindowPrint(void *inctx) { - // Check if macOS 11.0 or newer +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 if (@available(macOS 11.0, *)) { ON_MAIN_THREAD( WailsContext *ctx = (__bridge WailsContext*) inctx; @@ -424,4 +424,5 @@ void WindowPrint(void *inctx) { [po runOperationModalForWindow:ctx.mainWindow delegate:ctx.mainWindow.delegate didRunSelector:nil contextInfo:nil]; ) } +#endif } diff --git a/v2/internal/frontend/desktop/darwin/WailsContext.m b/v2/internal/frontend/desktop/darwin/WailsContext.m index bf191e472..fd15465a8 100644 --- a/v2/internal/frontend/desktop/darwin/WailsContext.m +++ b/v2/internal/frontend/desktop/darwin/WailsContext.m @@ -219,23 +219,27 @@ typedef void (^schemeTaskCaller)(id); config.preferences.tabFocusesLinks = *preferences.tabFocusesLinks; } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110300 if (@available(macOS 11.3, *)) { if (preferences.textInteractionEnabled != NULL) { config.preferences.textInteractionEnabled = *preferences.textInteractionEnabled; } } +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120300 if (@available(macOS 12.3, *)) { - if (preferences.fullscreenEnabled != NULL) { - config.preferences.elementFullscreenEnabled = *preferences.fullscreenEnabled; - } + if (preferences.fullscreenEnabled != NULL) { + config.preferences.elementFullscreenEnabled = *preferences.fullscreenEnabled; + } } - -// [config.preferences setValue:[NSNumber numberWithBool:true] forKey:@"developerExtrasEnabled"]; +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 if (@available(macOS 10.15, *)) { config.preferences.fraudulentWebsiteWarningEnabled = fraudulentWebsiteWarningEnabled; } +#endif WKUserContentController* userContentController = [WKUserContentController new]; [userContentController addScriptMessageHandler:self name:@"external"]; @@ -431,10 +435,11 @@ typedef void (^schemeTaskCaller)(id); NSOpenPanel *openPanel = [NSOpenPanel openPanel]; openPanel.allowsMultipleSelection = parameters.allowsMultipleSelection; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { openPanel.canChooseDirectories = parameters.allowsDirectories; } - +#endif [openPanel beginSheetModalForWindow:webView.window completionHandler:^(NSInteger result) { @@ -558,14 +563,18 @@ typedef void (^schemeTaskCaller)(id); #ifdef USE_NEW_FILTERS NSMutableArray *contentTypes = [[NSMutableArray new] autorelease]; for (NSString *filter in filterList) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 if (@available(macOS 11.0, *)) { UTType *t = [UTType typeWithFilenameExtension:filter]; [contentTypes addObject:t]; } +#endif } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 if (@available(macOS 11.0, *)) { [dialog setAllowedContentTypes:contentTypes]; } +#endif #else [dialog setAllowedFileTypes:filterList]; #endif @@ -638,17 +647,21 @@ typedef void (^schemeTaskCaller)(id); #ifdef USE_NEW_FILTERS NSMutableArray *contentTypes = [[NSMutableArray new] autorelease]; for (NSString *filter in filterList) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 if (@available(macOS 11.0, *)) { UTType *t = [UTType typeWithFilenameExtension:filter]; [contentTypes addObject:t]; } +#endif } if( contentTypes.count == 0) { [dialog setAllowsOtherFileTypes:true]; } else { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 if (@available(macOS 11.0, *)) { [dialog setAllowedContentTypes:contentTypes]; } +#endif } #else diff --git a/v2/internal/frontend/desktop/darwin/inspector_dev.go b/v2/internal/frontend/desktop/darwin/inspector_dev.go index f3520cb3e..e79b9c3e7 100644 --- a/v2/internal/frontend/desktop/darwin/inspector_dev.go +++ b/v2/internal/frontend/desktop/darwin/inspector_dev.go @@ -23,6 +23,7 @@ extern void processMessage(const char *message); @end void showInspector(void *inctx) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000 ON_MAIN_THREAD( if (@available(macOS 12.0, *)) { WailsContext *ctx = (__bridge WailsContext*) inctx; @@ -47,7 +48,7 @@ void showInspector(void *inctx) { NSLog(@"Opening the inspector needs at least MacOS 12"); } ); - +#endif } void setupF12hotkey() {