Add hover code

This way the app can be built for desktop platforms. There is still a
lot of work to do in order to get it to work, but this is a start.

Related to #137
This commit is contained in:
Vishesh Handa
2020-05-31 09:07:29 +02:00
parent e5d904b2a7
commit 453fac784d
12 changed files with 229 additions and 0 deletions

3
go/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build
.last_goflutter_check
.last_go-flutter_check

BIN
go/assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -0,0 +1,13 @@
package main
// DO NOT EDIT, this file is generated by hover at compile-time for the image_picker plugin.
import (
flutter "github.com/go-flutter-desktop/go-flutter"
image_picker "github.com/go-flutter-desktop/plugins/image_picker"
)
func init() {
// Only the init function can be tweaked by plugin maker.
options = append(options, flutter.AddPlugin(&image_picker.ImagePickerPlugin{}))
}

View File

@ -0,0 +1,13 @@
package main
// DO NOT EDIT, this file is generated by hover at compile-time for the package_info plugin.
import (
flutter "github.com/go-flutter-desktop/go-flutter"
package_info "github.com/go-flutter-desktop/plugins/package_info"
)
func init() {
// Only the init function can be tweaked by plugin maker.
options = append(options, flutter.AddPlugin(&package_info.PackageInfoPlugin{}))
}

View File

@ -0,0 +1,16 @@
package main
// DO NOT EDIT, this file is generated by hover at compile-time for the path_provider plugin.
import (
flutter "github.com/go-flutter-desktop/go-flutter"
path_provider "github.com/go-flutter-desktop/plugins/path_provider"
)
func init() {
// Only the init function can be tweaked by plugin maker.
options = append(options, flutter.AddPlugin(&path_provider.PathProviderPlugin{
VendorName: flutter.ProjectOrganizationName,
ApplicationName: flutter.ProjectName,
}))
}

View File

@ -0,0 +1,16 @@
package main
// DO NOT EDIT, this file is generated by hover at compile-time for the shared_preferences plugin.
import (
flutter "github.com/go-flutter-desktop/go-flutter"
shared_preferences "github.com/go-flutter-desktop/plugins/shared_preferences"
)
func init() {
// Only the init function can be tweaked by plugin maker.
options = append(options, flutter.AddPlugin(&shared_preferences.SharedPreferencesPlugin{
VendorName: flutter.ProjectOrganizationName,
ApplicationName: flutter.ProjectName,
}))
}

View File

@ -0,0 +1,13 @@
package main
// DO NOT EDIT, this file is generated by hover at compile-time for the url_launcher plugin.
import (
flutter "github.com/go-flutter-desktop/go-flutter"
url_launcher "github.com/go-flutter-desktop/plugins/url_launcher"
)
func init() {
// Only the init function can be tweaked by plugin maker.
options = append(options, flutter.AddPlugin(&url_launcher.UrlLauncherPlugin{}))
}

49
go/cmd/main.go Normal file
View File

@ -0,0 +1,49 @@
package main
import (
"fmt"
"image"
_ "image/png"
"os"
"path/filepath"
"strings"
"github.com/go-flutter-desktop/go-flutter"
"github.com/pkg/errors"
)
// vmArguments may be set by hover at compile-time
var vmArguments string
func main() {
// DO NOT EDIT, add options in options.go
mainOptions := []flutter.Option{
flutter.OptionVMArguments(strings.Split(vmArguments, ";")),
flutter.WindowIcon(iconProvider),
}
err := flutter.Run(append(options, mainOptions...)...)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
func iconProvider() ([]image.Image, error) {
execPath, err := os.Executable()
if err != nil {
return nil, errors.Wrap(err, "failed to resolve executable path")
}
execPath, err = filepath.EvalSymlinks(execPath)
if err != nil {
return nil, errors.Wrap(err, "failed to eval symlinks for executable path")
}
imgFile, err := os.Open(filepath.Join(filepath.Dir(execPath), "assets", "icon.png"))
if err != nil {
return nil, errors.Wrap(err, "failed to open assets/icon.png")
}
img, _, err := image.Decode(imgFile)
if err != nil {
return nil, errors.Wrap(err, "failed to decode image")
}
return []image.Image{img}, nil
}

9
go/cmd/options.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"github.com/go-flutter-desktop/go-flutter"
)
var options = []flutter.Option{
flutter.WindowInitialDimensions(800, 1280),
}

13
go/go.mod Normal file
View File

@ -0,0 +1,13 @@
module github.com/GitJournal/GitJournal/go
go 1.13
require (
github.com/go-flutter-desktop/go-flutter v0.41.0
github.com/go-flutter-desktop/plugins/image_picker v0.1.5
github.com/go-flutter-desktop/plugins/package_info v0.0.0-20200525155813-01ec2ef9f118
github.com/go-flutter-desktop/plugins/path_provider v0.4.0
github.com/go-flutter-desktop/plugins/shared_preferences v0.4.3
github.com/go-flutter-desktop/plugins/url_launcher v0.1.2
github.com/pkg/errors v0.9.1
)

77
go/go.sum Normal file
View File

@ -0,0 +1,77 @@
github.com/Xuanwo/go-locale v0.2.0 h1:1N8SGG2VNpLl6VVa8ueZm3Nm+dxvk8ffY9aviKHl4IE=
github.com/Xuanwo/go-locale v0.2.0/go.mod h1:6qbT9M726OJgyiGZro2YwPmx63wQzlH+VvtjJWQoftw=
github.com/adrg/xdg v0.2.1 h1:VSVdnH7cQ7V+B33qSJHTCRlNgra1607Q8PzEmnvb2Ic=
github.com/adrg/xdg v0.2.1/go.mod h1:ZuOshBmzV4Ta+s23hdfFZnBsdzmoR3US0d7ErpqSbTQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-flutter-desktop/go-flutter v0.30.0/go.mod h1:NCryd/AqiRbYSd8pMzQldYkgH1tZIFGt2ToUghZcWGA=
github.com/go-flutter-desktop/go-flutter v0.37.0/go.mod h1:8tjt3yZ3lTNLqgzWeH90f1uhCR9BL68LFoiy/n0aw/w=
github.com/go-flutter-desktop/go-flutter v0.41.0 h1:YzGy0+r0Haj9vdMckxyfqM0JOmj/2ONgow2Z9yVN//A=
github.com/go-flutter-desktop/go-flutter v0.41.0/go.mod h1:VNXgUO61Nxa9y/5jHQJFFuWVK9oNQF56MPKPUgQXwlU=
github.com/go-flutter-desktop/plugins v0.0.0-20200525155813-01ec2ef9f118 h1:xD8uXq0EZXXGVbqrCKWTIu69UJBJwAoVxCgetUg7+UE=
github.com/go-flutter-desktop/plugins/image_picker v0.1.5 h1:VQza8aA+Els+trCLqNJa7phNJDBetLWVQMyzAIqYjts=
github.com/go-flutter-desktop/plugins/image_picker v0.1.5/go.mod h1:lOmQKrMiJNsA55VM4ww3u78ufo//ptu2om+B3Ime+6o=
github.com/go-flutter-desktop/plugins/package_info v0.0.0-20200525155813-01ec2ef9f118 h1:Bhikel50hc8xyCA/J8iJh6cOTyy8nR8fuRF8IbI4AAY=
github.com/go-flutter-desktop/plugins/package_info v0.0.0-20200525155813-01ec2ef9f118/go.mod h1:By7bu3Rh1+rWVoPqWZVoFlNpQ85hwSgPSL8KCSt1edk=
github.com/go-flutter-desktop/plugins/path_provider v0.4.0 h1:LhYqOJjwuRjf9MzmbvkejCtLqrEEeBzrsCWkVONG6uw=
github.com/go-flutter-desktop/plugins/path_provider v0.4.0/go.mod h1:e0aUP0dqcGaw5EZpCYzlK7M/T6X0ueWYJXImrE25vb4=
github.com/go-flutter-desktop/plugins/shared_preferences v0.4.3 h1:gFO2I08ll8frTDFrMQfscD4UqIHvFyxGk8xg2O+hPzI=
github.com/go-flutter-desktop/plugins/shared_preferences v0.4.3/go.mod h1:NbG/ABFPBR5SNtZn3qCv4S6aQASMCbtTITraXRChpvI=
github.com/go-flutter-desktop/plugins/url_launcher v0.1.2 h1:oFiIJjotMQvF8rfKWVJrf+1/JgTXShEIsibkiXrQnUw=
github.com/go-flutter-desktop/plugins/url_launcher v0.1.2/go.mod h1:GYgRDaLDAJRYvaASQk8HEmI8YJurbZGW5VVDIMxwzBU=
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw=
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200420212212-258d9bec320e h1:8ywu4ELC/6owgOZlZx75CyYS5AYwUT2L+hzPModKvag=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200420212212-258d9bec320e/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

7
go/hover.yaml Normal file
View File

@ -0,0 +1,7 @@
application-name: "GitJournal"
#executable-name: "gitjournal" # Uncomment to modify this value. Only lowercase a-z, numbers, underscores and no spaces
#package-name: "gitjournal" # Uncomment to modify this value. Only lowercase a-z, numbers and no underscores or spaces
license: "AGPL-3.0-or-later"
target: lib/main.dart
docker: false
engine-version: "" # change to a engine version commit