From 41944b645e174727b8ecec0e12767c3fa95f2c76 Mon Sep 17 00:00:00 2001 From: inkeliz Date: Fri, 7 Jul 2023 14:07:07 +0100 Subject: [PATCH 01/12] gogio: add deeplink support [WIP] Signed-off-by: inkeliz --- gogio/androidbuild.go | 10 ++++++++++ gogio/build_info.go | 6 ++++++ gogio/help.go | 2 ++ gogio/main.go | 1 + 4 files changed, 19 insertions(+) diff --git a/gogio/androidbuild.go b/gogio/androidbuild.go index 79943de..0d00198 100644 --- a/gogio/androidbuild.go +++ b/gogio/androidbuild.go @@ -48,6 +48,7 @@ type manifestData struct { Features []string IconSnip string AppName string + Scheme []string } const ( @@ -445,6 +446,7 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe Features: features, IconSnip: iconSnip, AppName: appName, + Scheme: bi.deeplink, } tmpl, err := template.New("test").Parse( ` @@ -466,6 +468,14 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe + {{range .Scheme}} + + + + + + + {{end}} `) diff --git a/gogio/build_info.go b/gogio/build_info.go index 1797296..62e5c6f 100644 --- a/gogio/build_info.go +++ b/gogio/build_info.go @@ -30,6 +30,7 @@ type buildInfo struct { notaryAppleID string notaryPassword string notaryTeamID string + deeplink []string } type Semver struct { @@ -51,6 +52,10 @@ func newBuildInfo(pkgPath string) (*buildInfo, error) { if *name != "" { appName = *name } + deeplinkSchemes := strings.Split(*deeplink, ",") + for i, scheme := range deeplinkSchemes { + deeplinkSchemes[i] = strings.TrimSpace(scheme) + } ver, err := parseSemver(*version) if err != nil { return nil, err @@ -72,6 +77,7 @@ func newBuildInfo(pkgPath string) (*buildInfo, error) { notaryAppleID: *notaryID, notaryPassword: *notaryPass, notaryTeamID: *notaryTeamID, + deeplink: deeplinkSchemes, } return bi, nil } diff --git a/gogio/help.go b/gogio/help.go index 2561c2b..53fe9ce 100644 --- a/gogio/help.go +++ b/gogio/help.go @@ -77,4 +77,6 @@ for details. If not provided, the password will be prompted. The -notaryteamid flag specifies the team ID to use for notarization of MacOS app, ignored if -notaryid is not provided. + +The -deeplink flag specifies a list of comma separated schemes to be used for deep linking. ` diff --git a/gogio/main.go b/gogio/main.go index 5fe373e..fea67ba 100644 --- a/gogio/main.go +++ b/gogio/main.go @@ -40,6 +40,7 @@ var ( notaryID = flag.String("notaryid", "", "specify the apple id to use for notarization.") notaryPass = flag.String("notarypass", "", "specify app-specific password of the Apple ID to be used for notarization.") notaryTeamID = flag.String("notaryteamid", "", "specify the team id to use for notarization.") + deeplink = flag.String("deeplink", "", "specify a list of comma separated schemes to be used for deep linking.") ) func main() { From 0d5ad97ced7a70c7e88157ab171dc1311031517f Mon Sep 17 00:00:00 2001 From: inkeliz Date: Fri, 7 Jul 2023 16:39:04 +0100 Subject: [PATCH 02/12] gogio: [iOS/macOS] add deeplink plist Signed-off-by: inkeliz --- gogio/iosbuild.go | 75 +++++++++++++++++++++++++++++++++++++-------- gogio/macosbuild.go | 36 +++++++++++++++++----- 2 files changed, 91 insertions(+), 20 deletions(-) diff --git a/gogio/iosbuild.go b/gogio/iosbuild.go index 1126cd5..848af9e 100644 --- a/gogio/iosbuild.go +++ b/gogio/iosbuild.go @@ -4,6 +4,7 @@ package main import ( "archive/zip" + "bytes" "crypto/sha1" "encoding/hex" "errors" @@ -14,6 +15,7 @@ import ( "path/filepath" "strconv" "strings" + "text/template" "time" "golang.org/x/sync/errgroup" @@ -203,7 +205,10 @@ func exeIOS(tmpDir, target, app string, bi *buildInfo) error { if _, err := runCmd(lipo); err != nil { return err } - infoPlist := buildInfoPlist(bi) + infoPlist, err := buildInfoPlist(bi) + if err != nil { + return err + } plistFile := filepath.Join(app, "Info.plist") if err := os.WriteFile(plistFile, []byte(infoPlist), 0660); err != nil { return err @@ -291,7 +296,7 @@ func iosIcons(bi *buildInfo, tmpDir, appDir, icon string) (string, error) { return assetPlist, err } -func buildInfoPlist(bi *buildInfo) string { +func buildInfoPlist(bi *buildInfo) (string, error) { appName := UppercaseName(bi.name) platform := iosPlatformFor(bi.target) var supportPlatform string @@ -301,36 +306,57 @@ func buildInfoPlist(bi *buildInfo) string { case "tvos": supportPlatform = "AppleTVOS" } - return fmt.Sprintf(` + + manifestSrc := struct { + AppName string + AppID string + Version string + VersionCode uint32 + Platform string + MinVersion int + SupportPlatform string + Scheme []string + }{ + AppName: appName, + AppID: bi.appID, + Version: bi.version.String(), + VersionCode: bi.version.VersionCode, + Platform: platform, + MinVersion: minIOSVersion, + SupportPlatform: supportPlatform, + Scheme: bi.scheme, + } + + tmpl, err := template.New("manifest").Parse(` CFBundleDevelopmentRegion en CFBundleExecutable - %s + {{.AppName}} CFBundleIdentifier - %s + {{.AppID}} CFBundleInfoDictionaryVersion 6.0 CFBundleName - %s + {{.AppName}} CFBundlePackageType APPL CFBundleShortVersionString - %s + {{.Version}} CFBundleVersion - %d + {{.VersionCode}} UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities arm64 DTPlatformName - %s + {{.Platform}} DTPlatformVersion 12.4 MinimumOSVersion - %d + {{.MinOS}} UIDeviceFamily 1 @@ -338,7 +364,7 @@ func buildInfoPlist(bi *buildInfo) string { CFBundleSupportedPlatforms - %s + {{.SupportPlatform}} UISupportedInterfaceOrientations @@ -353,13 +379,36 @@ func buildInfoPlist(bi *buildInfo) string { DTSDKBuild 16G73 DTSDKName - %s12.4 + {{.Platform}}12.4 DTXcode 1030 DTXcodeBuild 10G8 + {{if .Scheme}} + CFBundleURLTypes + + {{range .Scheme}} + + CFBundleURLSchemes + + {{.}} + + + {{end}} + + {{end}} -`, appName, bi.appID, appName, bi.version, bi.version.VersionCode, platform, minIOSVersion, supportPlatform, platform) +`) + if err != nil { + return "", err + } + + var manifestBuffer bytes.Buffer + if err := tmpl.Execute(&manifestBuffer, manifestSrc); err != nil { + return "", err + } + + return manifestBuffer.String(), nil } func iosPlatformFor(target string) string { diff --git a/gogio/macosbuild.go b/gogio/macosbuild.go index 88e9463..06ed8fe 100644 --- a/gogio/macosbuild.go +++ b/gogio/macosbuild.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "errors" "fmt" "os" @@ -124,6 +125,19 @@ func (b *macBuilder) setIcon(path string) (err error) { } func (b *macBuilder) setInfo(buildInfo *buildInfo, name string) error { + + manifestSrc := struct { + Name string + Bundle string + Version int + Scheme []string + }{ + Name: name, + Bundle: buildInfo.appID, + Version: buildInfo.version, + Scheme: buildInfo.deeplink, + } + t, err := template.New("manifest").Parse(` @@ -138,19 +152,27 @@ func (b *macBuilder) setInfo(buildInfo *buildInfo, name string) error { CFBundlePackageType APPL + {{if .Scheme}} + CFBundleURLTypes + + {{range .Scheme}} + + CFBundleURLSchemes + + {{.}} + + + {{end}} + + {{end}} `) if err != nil { return err } - var manifest bufferCoff - if err := t.Execute(&manifest, struct { - Name, Bundle string - }{ - Name: name, - Bundle: buildInfo.appID, - }); err != nil { + var manifest bytes.Buffer + if err := t.Execute(&manifest, manifestSrc); err != nil { return err } b.Manifest = manifest.Bytes() From f94a5024b5d0e67e659083878faaeb095b178b0d Mon Sep 17 00:00:00 2001 From: inkeliz Date: Sat, 8 Jul 2023 13:21:53 +0100 Subject: [PATCH 03/12] gogio: [iOS/Windows] add deeplink support That change adds `-deeplink` flag. Signed-off-by: inkeliz --- gogio/iosbuild.go | 4 ++-- gogio/windowsbuild.go | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gogio/iosbuild.go b/gogio/iosbuild.go index 848af9e..11a71ca 100644 --- a/gogio/iosbuild.go +++ b/gogio/iosbuild.go @@ -324,7 +324,7 @@ func buildInfoPlist(bi *buildInfo) (string, error) { Platform: platform, MinVersion: minIOSVersion, SupportPlatform: supportPlatform, - Scheme: bi.scheme, + Scheme: bi.deeplink, } tmpl, err := template.New("manifest").Parse(` @@ -356,7 +356,7 @@ func buildInfoPlist(bi *buildInfo) (string, error) { DTPlatformVersion 12.4 MinimumOSVersion - {{.MinOS}} + {{.MinVersion}} UIDeviceFamily 1 diff --git a/gogio/windowsbuild.go b/gogio/windowsbuild.go index c867e03..11be8ab 100644 --- a/gogio/windowsbuild.go +++ b/gogio/windowsbuild.go @@ -202,10 +202,15 @@ func (b *windowsBuilder) buildProgram(buildInfo *buildInfo, name string, arch st dest = filepath.Join(filepath.Dir(b.DestDir), name+"_"+arch+".exe") } + ldflags := buildInfo.ldflags + if buildInfo.deeplink != nil { + ldflags += ` -X "gioui.org/app.schemesDeeplink=` + strings.Join(buildInfo.deeplink, ",") + `" ` + } + cmd := exec.Command( "go", "build", - "-ldflags=-H=windowsgui "+buildInfo.ldflags, + "-ldflags=-H=windowsgui "+ldflags, "-tags="+buildInfo.tags, "-o", dest, buildInfo.pkgPath, From 4884def3a983dba252912ca4020a18a2680f6133 Mon Sep 17 00:00:00 2001 From: inkeliz Date: Wed, 19 Jul 2023 15:30:47 +0100 Subject: [PATCH 04/12] gogio: [windows] rename ldflag variable name Signed-off-by: inkeliz --- gogio/windowsbuild.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gogio/windowsbuild.go b/gogio/windowsbuild.go index 11be8ab..bcdb12a 100644 --- a/gogio/windowsbuild.go +++ b/gogio/windowsbuild.go @@ -204,7 +204,7 @@ func (b *windowsBuilder) buildProgram(buildInfo *buildInfo, name string, arch st ldflags := buildInfo.ldflags if buildInfo.deeplink != nil { - ldflags += ` -X "gioui.org/app.schemesDeeplink=` + strings.Join(buildInfo.deeplink, ",") + `" ` + ldflags += ` -X "gioui.org/app.schemesURI=` + strings.Join(buildInfo.deeplink, ",") + `" ` } cmd := exec.Command( From f4d53a2bb3c3cbd27337a852bb30d42078acc9ff Mon Sep 17 00:00:00 2001 From: inkeliz Date: Wed, 19 Jul 2023 16:05:02 +0100 Subject: [PATCH 05/12] gogio: rename deeplink to schemes Signed-off-by: inkeliz --- gogio/androidbuild.go | 2 +- gogio/build_info.go | 10 +++++----- gogio/help.go | 5 ++++- gogio/iosbuild.go | 2 +- gogio/macosbuild.go | 2 +- gogio/main.go | 2 +- gogio/windowsbuild.go | 4 ++-- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/gogio/androidbuild.go b/gogio/androidbuild.go index 0d00198..8a0b9b7 100644 --- a/gogio/androidbuild.go +++ b/gogio/androidbuild.go @@ -446,7 +446,7 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe Features: features, IconSnip: iconSnip, AppName: appName, - Scheme: bi.deeplink, + Scheme: bi.schemes, } tmpl, err := template.New("test").Parse( ` diff --git a/gogio/build_info.go b/gogio/build_info.go index 62e5c6f..a7ca51a 100644 --- a/gogio/build_info.go +++ b/gogio/build_info.go @@ -30,7 +30,7 @@ type buildInfo struct { notaryAppleID string notaryPassword string notaryTeamID string - deeplink []string + schemes []string } type Semver struct { @@ -52,9 +52,9 @@ func newBuildInfo(pkgPath string) (*buildInfo, error) { if *name != "" { appName = *name } - deeplinkSchemes := strings.Split(*deeplink, ",") - for i, scheme := range deeplinkSchemes { - deeplinkSchemes[i] = strings.TrimSpace(scheme) + schemes := strings.Split(*schemes, ",") + for i, scheme := range schemes { + schemes[i] = strings.TrimSpace(scheme) } ver, err := parseSemver(*version) if err != nil { @@ -77,7 +77,7 @@ func newBuildInfo(pkgPath string) (*buildInfo, error) { notaryAppleID: *notaryID, notaryPassword: *notaryPass, notaryTeamID: *notaryTeamID, - deeplink: deeplinkSchemes, + schemes: schemes, } return bi, nil } diff --git a/gogio/help.go b/gogio/help.go index 53fe9ce..cd98457 100644 --- a/gogio/help.go +++ b/gogio/help.go @@ -78,5 +78,8 @@ for details. If not provided, the password will be prompted. The -notaryteamid flag specifies the team ID to use for notarization of MacOS app, ignored if -notaryid is not provided. -The -deeplink flag specifies a list of comma separated schemes to be used for deep linking. +The -schemes flag specifies a list of comma separated URI schemes, which the program can +handle. For example, use -schemes yourAppName to get transfer.URLEvent when access URI +starting with yourAppName://. It is only supported on Android, iOS, macOS and Windows. +On Windows, it will restrict the program to a single instance. ` diff --git a/gogio/iosbuild.go b/gogio/iosbuild.go index 11a71ca..ae8d784 100644 --- a/gogio/iosbuild.go +++ b/gogio/iosbuild.go @@ -324,7 +324,7 @@ func buildInfoPlist(bi *buildInfo) (string, error) { Platform: platform, MinVersion: minIOSVersion, SupportPlatform: supportPlatform, - Scheme: bi.deeplink, + Scheme: bi.schemes, } tmpl, err := template.New("manifest").Parse(` diff --git a/gogio/macosbuild.go b/gogio/macosbuild.go index 06ed8fe..29eb2ad 100644 --- a/gogio/macosbuild.go +++ b/gogio/macosbuild.go @@ -135,7 +135,7 @@ func (b *macBuilder) setInfo(buildInfo *buildInfo, name string) error { Name: name, Bundle: buildInfo.appID, Version: buildInfo.version, - Scheme: buildInfo.deeplink, + Scheme: buildInfo.schemes, } t, err := template.New("manifest").Parse(` diff --git a/gogio/main.go b/gogio/main.go index fea67ba..8bed57d 100644 --- a/gogio/main.go +++ b/gogio/main.go @@ -40,7 +40,7 @@ var ( notaryID = flag.String("notaryid", "", "specify the apple id to use for notarization.") notaryPass = flag.String("notarypass", "", "specify app-specific password of the Apple ID to be used for notarization.") notaryTeamID = flag.String("notaryteamid", "", "specify the team id to use for notarization.") - deeplink = flag.String("deeplink", "", "specify a list of comma separated schemes to be used for deep linking.") + schemes = flag.String("schemes", "", "specify a list of comma separated schemes to be used for deep linking.") ) func main() { diff --git a/gogio/windowsbuild.go b/gogio/windowsbuild.go index bcdb12a..c312658 100644 --- a/gogio/windowsbuild.go +++ b/gogio/windowsbuild.go @@ -203,8 +203,8 @@ func (b *windowsBuilder) buildProgram(buildInfo *buildInfo, name string, arch st } ldflags := buildInfo.ldflags - if buildInfo.deeplink != nil { - ldflags += ` -X "gioui.org/app.schemesURI=` + strings.Join(buildInfo.deeplink, ",") + `" ` + if buildInfo.schemes != nil { + ldflags += ` -X "gioui.org/app.schemesURI=` + strings.Join(buildInfo.schemes, ",") + `" ` } cmd := exec.Command( From b2271c88e0bc3000cc475af97afb25d8cf584148 Mon Sep 17 00:00:00 2001 From: inkeliz Date: Wed, 19 Jul 2023 16:08:39 +0100 Subject: [PATCH 06/12] gogio: change flag description Signed-off-by: inkeliz --- gogio/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gogio/main.go b/gogio/main.go index 8bed57d..3834710 100644 --- a/gogio/main.go +++ b/gogio/main.go @@ -40,7 +40,7 @@ var ( notaryID = flag.String("notaryid", "", "specify the apple id to use for notarization.") notaryPass = flag.String("notarypass", "", "specify app-specific password of the Apple ID to be used for notarization.") notaryTeamID = flag.String("notaryteamid", "", "specify the team id to use for notarization.") - schemes = flag.String("schemes", "", "specify a list of comma separated schemes to be used for deep linking.") + schemes = flag.String("schemes", "", "specify a list of comma separated deep-linking schemes that the program accepts") ) func main() { From 5710d994b9a7ab1813acb512385ef4781622430c Mon Sep 17 00:00:00 2001 From: inkeliz Date: Wed, 19 Jul 2023 16:11:27 +0100 Subject: [PATCH 07/12] gogio: rename scheme to schemes Signed-off-by: inkeliz --- gogio/androidbuild.go | 6 +++--- gogio/iosbuild.go | 8 ++++---- gogio/macosbuild.go | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gogio/androidbuild.go b/gogio/androidbuild.go index 8a0b9b7..0df7fd5 100644 --- a/gogio/androidbuild.go +++ b/gogio/androidbuild.go @@ -48,7 +48,7 @@ type manifestData struct { Features []string IconSnip string AppName string - Scheme []string + Schemes []string } const ( @@ -446,7 +446,7 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe Features: features, IconSnip: iconSnip, AppName: appName, - Scheme: bi.schemes, + Schemes: bi.schemes, } tmpl, err := template.New("test").Parse( ` @@ -468,7 +468,7 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe - {{range .Scheme}} + {{range .Schemes}} diff --git a/gogio/iosbuild.go b/gogio/iosbuild.go index ae8d784..5865e6f 100644 --- a/gogio/iosbuild.go +++ b/gogio/iosbuild.go @@ -315,7 +315,7 @@ func buildInfoPlist(bi *buildInfo) (string, error) { Platform string MinVersion int SupportPlatform string - Scheme []string + Schemes []string }{ AppName: appName, AppID: bi.appID, @@ -324,7 +324,7 @@ func buildInfoPlist(bi *buildInfo) (string, error) { Platform: platform, MinVersion: minIOSVersion, SupportPlatform: supportPlatform, - Scheme: bi.schemes, + Schemes: bi.schemes, } tmpl, err := template.New("manifest").Parse(` @@ -384,10 +384,10 @@ func buildInfoPlist(bi *buildInfo) (string, error) { 1030 DTXcodeBuild 10G8 - {{if .Scheme}} + {{if .Schemes}} CFBundleURLTypes - {{range .Scheme}} + {{range .Schemes}} CFBundleURLSchemes diff --git a/gogio/macosbuild.go b/gogio/macosbuild.go index 29eb2ad..3182059 100644 --- a/gogio/macosbuild.go +++ b/gogio/macosbuild.go @@ -130,12 +130,12 @@ func (b *macBuilder) setInfo(buildInfo *buildInfo, name string) error { Name string Bundle string Version int - Scheme []string + Schemes []string }{ Name: name, Bundle: buildInfo.appID, Version: buildInfo.version, - Scheme: buildInfo.schemes, + Schemes: buildInfo.schemes, } t, err := template.New("manifest").Parse(` @@ -152,10 +152,10 @@ func (b *macBuilder) setInfo(buildInfo *buildInfo, name string) error { CFBundlePackageType APPL - {{if .Scheme}} + {{if .Schemes}} CFBundleURLTypes - {{range .Scheme}} + {{range .Schemes}} CFBundleURLSchemes From 4ce1804bc41b97c3ea65de34a01e3d3c08ea8b59 Mon Sep 17 00:00:00 2001 From: inkeliz Date: Thu, 27 Jul 2023 10:31:34 +0100 Subject: [PATCH 08/12] gogio: fix go.mod/go.sum and rebase Signed-off-by: inkeliz --- gogio/build_info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gogio/build_info.go b/gogio/build_info.go index a7ca51a..0dc8edc 100644 --- a/gogio/build_info.go +++ b/gogio/build_info.go @@ -77,7 +77,7 @@ func newBuildInfo(pkgPath string) (*buildInfo, error) { notaryAppleID: *notaryID, notaryPassword: *notaryPass, notaryTeamID: *notaryTeamID, - schemes: schemes, + schemes: schemes, } return bi, nil } From b489bb7591ee3c859e244e30c82832daf47832fa Mon Sep 17 00:00:00 2001 From: inkeliz Date: Sat, 26 Aug 2023 08:52:07 +0100 Subject: [PATCH 09/12] gogio: [windows] add appID Signed-off-by: inkeliz --- gogio/windowsbuild.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gogio/windowsbuild.go b/gogio/windowsbuild.go index c312658..8e22ebd 100644 --- a/gogio/windowsbuild.go +++ b/gogio/windowsbuild.go @@ -206,6 +206,9 @@ func (b *windowsBuilder) buildProgram(buildInfo *buildInfo, name string, arch st if buildInfo.schemes != nil { ldflags += ` -X "gioui.org/app.schemesURI=` + strings.Join(buildInfo.schemes, ",") + `" ` } + if buildInfo.appID != "" { + ldflags += ` -X "gioui.org/app.appID=` + buildInfo.appID + `" ` + } cmd := exec.Command( "go", From f1c443a3a83ec7ea6006ff88c1ee16e9d1169aad Mon Sep 17 00:00:00 2001 From: inkeliz Date: Mon, 18 Sep 2023 22:32:08 +0100 Subject: [PATCH 10/12] [gogio] add AppID -X flags Signed-off-by: inkeliz --- gogio/windowsbuild.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gogio/windowsbuild.go b/gogio/windowsbuild.go index 8e22ebd..5404893 100644 --- a/gogio/windowsbuild.go +++ b/gogio/windowsbuild.go @@ -207,7 +207,7 @@ func (b *windowsBuilder) buildProgram(buildInfo *buildInfo, name string, arch st ldflags += ` -X "gioui.org/app.schemesURI=` + strings.Join(buildInfo.schemes, ",") + `" ` } if buildInfo.appID != "" { - ldflags += ` -X "gioui.org/app.appID=` + buildInfo.appID + `" ` + ldflags += ` -X "gioui.org/app.ID=` + buildInfo.appID + `" ` } cmd := exec.Command( From 3e8335e3452555a92e9df589b26fe77cdc896e14 Mon Sep 17 00:00:00 2001 From: inkeliz Date: Mon, 3 Jun 2024 19:00:15 +0100 Subject: [PATCH 11/12] gogio: fix darwin builds with custom schemes Signed-off-by: inkeliz --- gogio/iosbuild.go | 4 ++-- gogio/macosbuild.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gogio/iosbuild.go b/gogio/iosbuild.go index 5865e6f..d59c319 100644 --- a/gogio/iosbuild.go +++ b/gogio/iosbuild.go @@ -311,7 +311,7 @@ func buildInfoPlist(bi *buildInfo) (string, error) { AppName string AppID string Version string - VersionCode uint32 + VersionCode uint32 Platform string MinVersion int SupportPlatform string @@ -320,7 +320,7 @@ func buildInfoPlist(bi *buildInfo) (string, error) { AppName: appName, AppID: bi.appID, Version: bi.version.String(), - VersionCode: bi.version.VersionCode, + VersionCode: bi.version.VersionCode, Platform: platform, MinVersion: minIOSVersion, SupportPlatform: supportPlatform, diff --git a/gogio/macosbuild.go b/gogio/macosbuild.go index 3182059..8fbae43 100644 --- a/gogio/macosbuild.go +++ b/gogio/macosbuild.go @@ -129,7 +129,7 @@ func (b *macBuilder) setInfo(buildInfo *buildInfo, name string) error { manifestSrc := struct { Name string Bundle string - Version int + Version Semver Schemes []string }{ Name: name, From 45c150bac261349d46ba129552f1e4d874e8b459 Mon Sep 17 00:00:00 2001 From: inkeliz Date: Mon, 3 Jun 2024 19:00:41 +0100 Subject: [PATCH 12/12] gogio: [android] make singleInstance if schemes in use Signed-off-by: inkeliz --- gogio/androidbuild.go | 1 + gogio/help.go | 4 ++-- gogio/iosbuild.go | 4 ++-- gogio/macosbuild.go | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gogio/androidbuild.go b/gogio/androidbuild.go index 0df7fd5..23d21d7 100644 --- a/gogio/androidbuild.go +++ b/gogio/androidbuild.go @@ -463,6 +463,7 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe android:theme="@style/Theme.GioApp" android:configChanges="screenSize|screenLayout|smallestScreenSize|orientation|keyboardHidden" android:windowSoftInputMode="adjustResize" + android:launchMode= "singleInstance" android:exported="true"> diff --git a/gogio/help.go b/gogio/help.go index cd98457..b2dfe21 100644 --- a/gogio/help.go +++ b/gogio/help.go @@ -78,8 +78,8 @@ for details. If not provided, the password will be prompted. The -notaryteamid flag specifies the team ID to use for notarization of MacOS app, ignored if -notaryid is not provided. -The -schemes flag specifies a list of comma separated URI schemes, which the program can -handle. For example, use -schemes yourAppName to get transfer.URLEvent when access URI +The -schemes flag specifies a list of comma separated URI schemes that the program can +handle. For example, use -schemes yourAppName to receive a transfer.URLEvent for URIs starting with yourAppName://. It is only supported on Android, iOS, macOS and Windows. On Windows, it will restrict the program to a single instance. ` diff --git a/gogio/iosbuild.go b/gogio/iosbuild.go index d59c319..79b0e2f 100644 --- a/gogio/iosbuild.go +++ b/gogio/iosbuild.go @@ -400,12 +400,12 @@ func buildInfoPlist(bi *buildInfo) (string, error) { `) if err != nil { - return "", err + panic(err) } var manifestBuffer bytes.Buffer if err := tmpl.Execute(&manifestBuffer, manifestSrc); err != nil { - return "", err + panic(err) } return manifestBuffer.String(), nil diff --git a/gogio/macosbuild.go b/gogio/macosbuild.go index 8fbae43..d95e34a 100644 --- a/gogio/macosbuild.go +++ b/gogio/macosbuild.go @@ -168,12 +168,12 @@ func (b *macBuilder) setInfo(buildInfo *buildInfo, name string) error { `) if err != nil { - return err + panic(err) } var manifest bytes.Buffer if err := t.Execute(&manifest, manifestSrc); err != nil { - return err + panic(err) } b.Manifest = manifest.Bytes()