Skip to content

Commit

Permalink
Merge tag 'v1.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Nov 20, 2020
2 parents 0ca05dc + b0e67eb commit a2bf921
Show file tree
Hide file tree
Showing 64 changed files with 732 additions and 200 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
This file lists the main changes with each version of the Fyne toolkit.
More detailed release notes can be found on the [releases page](https://github.com/fyne-io/fyne/releases).

## 1.4.1 - Ongoing

### Changed

* Table columns can now be different sizes using SetColumnWidth
* Avoid unnecessary validation check on Refresh in widget.Form

### Fixed

* Tree could flicker on mouse hover (#1488)
* Content of table cells could overflow when sized correctly
* file:// based URI on Android would fail to list folder (#1495)
* Images in iOS release were not all correct size (#1498)
* iOS compile failed with Go 1.15 (#1497)
* Possible crash when minimising app containing List on Windows
* File chooser dialog ignores drive Z (#1513)
* Entry copy/paste is crashing on android 7.1 (#1511)
* Fyne package creating invalid windows packages (#1521)
* Menu bar initially doesn't respond to mouse input on macOS (#505)
* iOS: Missing CFBundleIconName and asset catalog (#1504)
* CenterOnScreen causes crash on MacOS when called from goroutine (#1539)
* desktop.MouseHover Button state is not reliable (#1533)
* Initial validation status in widget.Form is not respected
* Fix nil reference in disabled buttons (#1558)


## 1.4 - 1 November 2020

### Added (highlights)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://pkg.go.dev/fyne.io/fyne?tab=doc" title="Go API Reference" rel="nofollow"><img src="https://img.shields.io/badge/go-documentation-blue.svg?style=flat" alt="Go API Reference"></a>
<a href="https://github.com/fyne-io/fyne/releases/tag/v1.4.0" title="1.4.0 Release" rel="nofollow"><img src="https://img.shields.io/badge/version-1.4.0-blue.svg?style=flat" alt="1.4.0 release"></a>
<a href="https://github.com/fyne-io/fyne/releases/tag/v1.4.1" title="1.4.1 Release" rel="nofollow"><img src="https://img.shields.io/badge/version-1.4.1-blue.svg?style=flat" alt="1.4.1 release"></a>
<a href='http://gophers.slack.com/messages/fyne'><img src='https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=blue' alt='Join us on Slack' /></a>
<br />
<a href="https://goreportcard.com/report/fyne.io/fyne"><img src="https://goreportcard.com/badge/fyne.io/fyne" alt="Code Status" /></a>
Expand Down
3 changes: 3 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@ func CurrentApp() App {
appLock.RLock()
defer appLock.RUnlock()

if app == nil {
LogError("Attempt to access current Fyne app when none is started", nil)
}
return app
}
3 changes: 2 additions & 1 deletion canvas/raster.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ type Raster struct {

Generator func(w, h int) image.Image // Render the raster image from code

Translucency float64 // Set a translucency value > 0.0 to fade the raster
Translucency float64 // Set a translucency value > 0.0 to fade the raster
ScaleMode ImageScale // Specify the type of scaling interpolation applied to the raster if it is not full-size
}

// Alpha is a convenience function that returns the alpha value for a raster
Expand Down
2 changes: 1 addition & 1 deletion cmd/fyne/commands/package-darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (p *packager) packageDarwin() error {
infoFile, _ := os.Create(info)

tplData := darwinData{Name: p.name, ExeName: exeName, AppID: p.appID, Version: p.appVersion, Build: p.appBuild}
err := templates.PlistDarwin.Execute(infoFile, tplData)
err := templates.InfoPlistDarwin.Execute(infoFile, tplData)
if err != nil {
return errors.Wrap(err, "Failed to write plist template")
}
Expand Down
55 changes: 45 additions & 10 deletions cmd/fyne/commands/package-mobile.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package commands

import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"

"fyne.io/fyne"
"fyne.io/fyne/cmd/fyne/internal/mobile"
"fyne.io/fyne/cmd/fyne/internal/templates"
"fyne.io/fyne/cmd/fyne/internal/util"
"github.com/pkg/errors"
)

func (p *packager) packageAndroid(arch string) error {
Expand All @@ -18,22 +24,51 @@ func (p *packager) packageIOS() error {
return err
}

appDir := filepath.Join(p.dir, mobile.AppOutputName(p.os, p.name))
iconPath := filepath.Join(appDir, "Icon.png")
if err = util.CopyFile(p.icon, iconPath); err != nil {
return err
assetDir := util.EnsureSubDir(p.dir, "Images.xcassets")
defer os.RemoveAll(assetDir)
err = ioutil.WriteFile(filepath.Join(assetDir, "Contents.json"), []byte(`{
"info" : {
"author" : "xcode",
"version" : 1
}
}`), 0644)
if err != nil {
fyne.LogError("Content err", err)
}

if err = copyResizeIcon("120", appDir); err != nil {
iconDir := util.EnsureSubDir(assetDir, "AppIcon.appiconset")
contentFile, _ := os.Create(filepath.Join(iconDir, "Contents.json"))

err = templates.XCAssetsDarwin.Execute(contentFile, nil)
if err != nil {
return errors.Wrap(err, "Failed to write xcassets content template")
}

if err = copyResizeIcon(1024, iconDir, p.icon); err != nil {
return err
}
if err = copyResizeIcon("76", appDir); err != nil {
if err = copyResizeIcon(180, iconDir, p.icon); err != nil {
return err
}
if err = copyResizeIcon(120, iconDir, p.icon); err != nil {
return err
}
if err = copyResizeIcon(76, iconDir, p.icon); err != nil {
return err
}
if err = copyResizeIcon(152, iconDir, p.icon); err != nil {
return err
}
return copyResizeIcon("152", appDir)
}

func copyResizeIcon(size, dir string) error {
cmd := exec.Command("sips", "-o", dir+"/Icon_"+size+".png", "-Z", "120", dir+"/Icon.png")
appDir := filepath.Join(p.dir, mobile.AppOutputName(p.os, p.name))
cmd := exec.Command("xcrun", "actool", "Images.xcassets", "--compile", appDir, "--platform",
"iphoneos", "--target-device", "iphone", "--minimum-deployment-target", "9.0", "--app-icon", "AppIcon",
"--output-partial-info-plist", "/dev/null")
return cmd.Run()
}

func copyResizeIcon(size int, dir, source string) error {
path := fmt.Sprintf("%s/Icon_%d.png", dir, size)
strSize := fmt.Sprintf("%d", size)
return exec.Command("sips", "-o", path, "-Z", strSize, source).Run()
}
2 changes: 1 addition & 1 deletion cmd/fyne/commands/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

const (
defaultAppBuild = 1
defaultAppVersion = "1.0"
defaultAppVersion = "1.0.0"
)

// Declare conformity to Command interface
Expand Down
6 changes: 3 additions & 3 deletions cmd/fyne/internal/mobile/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ func writeFile(filename string, generate func(io.Writer) error) error {
return generate(f)
}

func packagesConfig(targetOS string) *packages.Config {
func packagesConfig(targetOS, targetArch string) *packages.Config {
config := &packages.Config{}
// Add CGO_ENABLED=1 explicitly since Cgo is disabled when GOOS is different from host OS.
config.Env = append(os.Environ(), "GOARCH=arm", "GOOS="+targetOS, "CGO_ENABLED=1")
config.Env = append(os.Environ(), "GOARCH="+targetArch, "GOOS="+targetOS, "CGO_ENABLED=1")
if targetOS == "android" {
// with Cgo enabled we need to ensure the C compiler is set via CC to
// avoid the error: "gcc: error: unrecognized command line option '-marm'"
config.Env = append(os.Environ(), androidEnv["arm"]...)
config.Env = append(os.Environ(), androidEnv[targetArch]...)
}
tags := buildTags
if targetOS == "darwin" {
Expand Down
12 changes: 6 additions & 6 deletions cmd/fyne/internal/mobile/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func runBuildImpl(cmd *command) (*packages.Package, error) {
cmd.usage()
os.Exit(1)
}
pkgs, err := packages.Load(packagesConfig(targetOS), buildPath)
pkgs, err := packages.Load(packagesConfig(targetOS, targetArchs[0]), buildPath)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func runBuildImpl(cmd *command) (*packages.Package, error) {
return nil, fmt.Errorf("-os=ios requires XCode")
}
if buildRelease {
targetArchs = []string{"arm", "arm64"}
targetArchs = []string{"arm64"}
}

if pkg.Name != "main" {
Expand Down Expand Up @@ -381,8 +381,8 @@ func parseBuildTarget(buildTarget string) (os string, archs []string, _ error) {
}

// verify all archs are supported one while deduping.
isSupported := func(arch string) bool {
for _, a := range allArchs {
isSupported := func(os, arch string) bool {
for _, a := range allArchs[os] {
if a == arch {
return true
}
Expand All @@ -395,7 +395,7 @@ func parseBuildTarget(buildTarget string) (os string, archs []string, _ error) {
if _, ok := seen[arch]; ok {
continue
}
if !isSupported(arch) {
if !isSupported(os, arch) {
return "", nil, fmt.Errorf(`unsupported arch: %q`, arch)
}

Expand All @@ -408,7 +408,7 @@ func parseBuildTarget(buildTarget string) (os string, archs []string, _ error) {
targetOS = "darwin"
}
if all {
return targetOS, allArchs, nil
return targetOS, allArchs[os], nil
}
return targetOS, archs, nil
}
38 changes: 26 additions & 12 deletions cmd/fyne/internal/mobile/build_iosapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func goIOSBuild(pkg *packages.Package, bundleID string, archs []string,
// Detect the team ID
teamID, err := DetectIOSTeamID(cert)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to look up certificate %s: %s", cert, err.Error())
}

projPbxproj := new(bytes.Buffer)
Expand Down Expand Up @@ -288,25 +288,39 @@ var infoplistTmpl = template.Must(template.New("infoplist").Parse(`<?xml version
<key>CFBundleVersion</key>
<string>{{.Build}}</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
</array>
<key>CFBundleIconName</key>
<string>AppIcon</string>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon_76.png</string>
<string>Icon_152.png</string>
<string>Icon_120.png</string>
</array>
</dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
<string>AppIcon76x76</string>
</array>
<key>CFBundleIconName</key>
<string>AppIcon</string>
</dict>
</dict>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
<string>arm64</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
Expand Down
26 changes: 15 additions & 11 deletions cmd/fyne/internal/mobile/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ var (

darwinArmNM string

allArchs = []string{"arm", "arm64", "386", "amd64"}
allArchs = map[string][]string{
"android": {"arm", "arm64", "386", "amd64"},
"ios": {"arm64", "amd64"}}

bitcodeEnabled bool
)
Expand Down Expand Up @@ -83,15 +85,17 @@ func envInit() (err error) {
// An arbitrary standard package ('runtime' here) is given to go-list.
// This is because go-list tries to analyze the module at the current directory if no packages are given,
// and if the module doesn't have any Go file, go-list fails. See golang/go#36668.
cmd := exec.Command("go", "list", "-e", "-f", `{{range context.ReleaseTags}}{{if eq . "go1.14"}}{{.}}{{end}}{{end}}`, "runtime")
cmd.Stderr = os.Stderr
out, err := cmd.Output()
if err != nil {
return err
}
if len(strings.TrimSpace(string(out))) > 0 {
bitcodeEnabled = true
}

// TODO re-enable once we find out what broke after September event 2020
//cmd := exec.Command("go", "list", "-e", "-f", `{{range context.ReleaseTags}}{{if eq . "go1.14"}}{{.}}{{end}}{{end}}`, "runtime")
//cmd.Stderr = os.Stderr
//out, err := cmd.Output()
//if err != nil {
// return err
//}
//if len(strings.TrimSpace(string(out))) > 0 {
// bitcodeEnabled = true
//}

// Setup the cross-compiler environments.
if ndkRoot, err := ndkRoot(); err == nil {
Expand Down Expand Up @@ -136,7 +140,7 @@ func envInit() (err error) {

darwinArmNM = "nm"
darwinEnv = make(map[string][]string)
for _, arch := range allArchs {
for _, arch := range allArchs["ios"] {
var env []string
var err error
var clang, cflags string
Expand Down
6 changes: 3 additions & 3 deletions cmd/fyne/internal/mobile/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ var manifestTmpl = template.Must(template.New("manifest").Parse(`
android:versionCode="{{.Build}}"
android:versionName="{{.Version}}">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="{{.Name}}" android:debuggable="{{.Debug}}">
<activity android:name="org.golang.app.GoNativeActivity"
android:label="{{.Name}}"
Expand All @@ -78,4 +75,7 @@ var manifestTmpl = template.Must(template.New("manifest").Parse(`
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>`))
Loading

0 comments on commit a2bf921

Please sign in to comment.