Skip to content

Commit

Permalink
Merge branch 'release/v1.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Apr 13, 2020
2 parents ed30d67 + 1516337 commit 25c18bb
Show file tree
Hide file tree
Showing 195 changed files with 15,605 additions and 1,227 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ gobuild_args: "-v -tags ci"
install: true

before_script:
- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/ | grep -v /cmd/fyne/internal/mobile)
- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/)
- GO111MODULE=off go get golang.org/x/tools/cmd/goimports
- GO111MODULE=off go get github.com/fzipp/gocyclo
- GO111MODULE=off go get golang.org/x/lint/golint
Expand All @@ -34,7 +34,7 @@ script:
- test -z "$(goimports -e -d $GO_FILES | tee /dev/stderr)"
- go test -tags ci ./...
- go vet -tags ci -unsafeptr=false ./...
- golint -set_exit_status $(go list -tags ci ./... | grep -v /cmd/fyne/internal/mobile)
- golint -set_exit_status $(go list -tags ci ./...)
- gocyclo -over 50 $GO_FILES
- |
set -e
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@
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.2.4 - 13 April 2020

### Added

* Added Direction field to ScrollContainer and NewHScrollContainer, NewVScrollContainer constructors (#763)
* Added Scroller.SetMinSize() to enable better defaults for scrolled content
* Added "fyne vendor" subcommand to help packaging fyne dependencies in projects
* Added "fyne version" subcommand to help with bug reporting (#656)
* Clipboard (cut/copy/paste) is now supported on iOS and Android (#414)
* Preferences.RemoveValue() now allows deletion of a stored user preference

### Changed

* Report keys based on name not key code - fixes issue with shortcuts with AZERTY (#790)

### Fixed

* Mobile builds now support go modules (#660)
* Building for mobile would try to run desktop build first
* Mobile apps now draw the full safe area on a screen (#799)
* Preferences were not stored on mobile apps (#779)
* Window on Windows is not controllable after exiting FullScreen mode (#727)
* Soft keyboard not working on some Samsung/LG smart phones (#787)
* Selecting a tab on extended TabContainer doesn't refresh button (#810)
* Appending tab to empty TabContainer causes divide by zero on mobile (#820)
* Application crashes on startup (#816)
* Form does not always update on theme change (#842)


## 1.2.3 - 2 March 2020

### Added
Expand Down
7 changes: 4 additions & 3 deletions 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.2.3" title="1.2.3 Release" rel="nofollow"><img src="https://img.shields.io/badge/version-1.2.3-blue.svg?style=flat" alt="1.2.3 release"></a>
<a href="https://github.com/fyne-io/fyne/releases/tag/v1.2.4" title="1.2.4 Release" rel="nofollow"><img src="https://img.shields.io/badge/version-1.2.4-blue.svg?style=flat" alt="1.2.4 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 All @@ -17,8 +17,9 @@ single codebase.

Version 1.2 is the current release which added support for iOS and Android devices
as well as providing much simpler ways to write custom widgets.
We are now working towards 1.3 which will add data binding and some more advanced
widgets such as tables and lists.
We are now working towards [1.3](https://github.com/fyne-io/fyne/milestone/7)
which will add data file dialogs, notifications and many new widgets to create more
complete applications.

# Prerequisites

Expand Down
5 changes: 4 additions & 1 deletion app/app_darwin.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build !ci

// +build !mobile,!ios
// +build !ios

package app

Expand All @@ -14,6 +14,9 @@ import (
)

func defaultTheme() fyne.Theme {
if fyne.CurrentDevice().IsMobile() { // this is called in mobile simulate mode
return theme.LightTheme()
}
// TODO read the macOS setting in Mojave onwards
return theme.DarkTheme()
}
Expand Down
13 changes: 8 additions & 5 deletions app/app_mobile_and.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// +build !ci

// +build android mobile
// +build android

package app

import (
"log"
"net/url"
"os"
"path/filepath"

"fyne.io/fyne"
"fyne.io/fyne/theme"
Expand All @@ -25,8 +25,11 @@ func (app *fyneApp) OpenURL(url *url.URL) error {
}

func rootConfigDir() string {
homeDir := "/data" //, _ := os.UserHomeDir()
filesDir := os.Getenv("FILESDIR")
if filesDir == "" {
log.Println("FILESDIR env was not set by android native code")
return "/data/data" // probably won't work, but we can't make a better guess
}

desktopConfig := filepath.Join(homeDir, "data")
return filepath.Join(desktopConfig, "fyne")
return filesDir
}
30 changes: 30 additions & 0 deletions app/app_mobile_and_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// +build !ci

// +build android

package app

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
)

func Test_RootConfigDir(t *testing.T) {
oldEnv := os.Getenv("FILESPATH")
os.Setenv("FILESPATH", "/tmp")

assert.Equal(t, "/tmp", rootConfigDir())
os.Setenv("FILESPATH", oldEnv)
}

func Test_StoragePath(t *testing.T) {
oldEnv := os.Getenv("FILESPATH")
os.Setenv("FILESPATH", "/tmp")
defer os.Setenv("FILESPATH", oldEnv)

p := &preferences{}
expected := "/tmp/storage/preferences.json"
assert.Equal(t, expected, p.storagePath())
}
3 changes: 2 additions & 1 deletion app/app_mobile_ios.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// +build darwin
// +build !ci

// +build ios

#import <UIKit/UIKit.h>
Expand Down
2 changes: 1 addition & 1 deletion app/app_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build !ci

// +build !mobile,!android,!ios
// +build !android,!ios

package app

Expand Down
2 changes: 1 addition & 1 deletion app/app_xdg.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// +build !ci

// +build linux openbsd freebsd netbsd
// +build !android,!mobile
// +build !android

package app

Expand Down
7 changes: 2 additions & 5 deletions app/preferences.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !ios

package app

import (
Expand Down Expand Up @@ -30,11 +32,6 @@ func (p *preferences) uniqueID() string {
return p.appID
}

// storagePath returns the location of the settings storage
func (p *preferences) storagePath() string {
return filepath.Join(rootConfigDir(), p.uniqueID(), "preferences.json")
}

func (p *preferences) save() error {
return p.saveToFile(p.storagePath())
}
Expand Down
11 changes: 11 additions & 0 deletions app/preferences_android.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build android

package app

import "path/filepath"

// storagePath returns the location of the settings storage
func (p *preferences) storagePath() string {
// we have no global storage, use app global instead - rootConfigDir looks up in app_mobile_and.go
return filepath.Join(rootConfigDir(), "storage", "preferences.json")
}
123 changes: 123 additions & 0 deletions app/preferences_ios.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// +build ios

package app

import (
"unsafe"

"fyne.io/fyne"
)

/*
#import <stdbool.h>
#import <stdlib.h>
#import <Foundation/Foundation.h>
bool getPreferenceBool(const char* key, bool fallback);
void setPreferenceBool(const char* key, bool value);
float getPreferenceFloat(const char* key, float fallback);
void setPreferenceFloat(const char* key, float value);
int getPreferenceInt(const char* key, int fallback);
void setPreferenceInt(const char* key, int value);
const char* getPreferenceString(const char* key, const char* fallback);
void setPreferenceString(const char* key, const char* value);
void removePreferenceValue(const char* key);
*/
import "C"

type iOSPreferences struct {
}

// Declare conformity with Preferences interface
var _ fyne.Preferences = (*iOSPreferences)(nil)

func (p *iOSPreferences) Bool(key string) bool {
return p.BoolWithFallback(key, false)
}

func (p *iOSPreferences) BoolWithFallback(key string, fallback bool) bool {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

return bool(C.getPreferenceBool(cKey, C.bool(fallback)))
}

func (p *iOSPreferences) SetBool(key string, value bool) {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

C.setPreferenceBool(cKey, C.bool(value))
}

func (p *iOSPreferences) Float(key string) float64 {
return p.FloatWithFallback(key, 0.0)
}

func (p *iOSPreferences) FloatWithFallback(key string, fallback float64) float64 {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

return float64(C.getPreferenceFloat(cKey, C.float(fallback)))
}

func (p *iOSPreferences) SetFloat(key string, value float64) {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

C.setPreferenceFloat(cKey, C.float(value))
}

func (p *iOSPreferences) Int(key string) int {
return p.IntWithFallback(key, 0)
}

func (p *iOSPreferences) IntWithFallback(key string, fallback int) int {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

return int(C.getPreferenceInt(cKey, C.int(fallback)))
}

func (p *iOSPreferences) SetInt(key string, value int) {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

C.setPreferenceInt(cKey, C.int(value))
}

func (p *iOSPreferences) String(key string) string {
return p.StringWithFallback(key, "")
}

func (p *iOSPreferences) StringWithFallback(key, fallback string) string {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))
cFallback := C.CString(fallback)
defer C.free(unsafe.Pointer(cFallback))

return C.GoString(C.getPreferenceString(cKey, cFallback))
}

func (p *iOSPreferences) SetString(key string, value string) {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))
cValue := C.CString(value)
defer C.free(unsafe.Pointer(cValue))

C.setPreferenceString(cKey, cValue)
}

func (p *iOSPreferences) RemoveValue(key string) {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))

C.removePreferenceValue(cKey)
}

func newPreferences() *iOSPreferences {
return &iOSPreferences{}
}

func loadPreferences(_ string) *iOSPreferences {
return newPreferences() // iOS stores the ID itself so load == new
}
Loading

0 comments on commit 25c18bb

Please sign in to comment.