Skip to content

Commit

Permalink
fix(desktop): change the way we open"
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha <sfroment42@gmail.com>
  • Loading branch information
sfroment committed Apr 17, 2019
1 parent e7c981e commit 10fa321
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/react-native/desktop/Makefile
Expand Up @@ -16,7 +16,7 @@ build: clean
GOPROXY=https://goproxy.berty.io GO111MODULE=on go mod vendor
sed s%TMPL_MAKEFILE_PATH%$(MAKEFILE_DIR)%g bundler.json.tmpl > bundler.json
cp -rf $(MAKEFILE_DIR)/../web/build $(MAKEFILE_DIR)/../desktop/resources/app
GOCACHE=/tmp/gocache astilectron-bundler -v -ldflags X:berty.tech/client/react-native/desktop/vendor/berty.tech/core.GitSha=$(GIT_SHA),berty.tech/client/react-native/desktop/vendor/berty.tech/core.GitTag=$(GIT_TAG),berty.tech/client/react-native/desktop/vendor/berty.tech/core.GitBranch=$(GIT_BRANCH),berty.tech/client/react-native/desktop/vendor/berty.tech/core.BuildMode=$(BUILD_MODE),berty.tech/client/react-native/desktop/vendor/berty.tech/core.commitDate=$(GIT_COMMIT_DATE)
GO111MODULE=on GOCACHE=/tmp/gocache astilectron-bundler -v -ldflags X:berty.tech/client/react-native/desktop/vendor/berty.tech/core.GitSha=$(GIT_SHA),berty.tech/client/react-native/desktop/vendor/berty.tech/core.GitTag=$(GIT_TAG),berty.tech/client/react-native/desktop/vendor/berty.tech/core.GitBranch=$(GIT_BRANCH),berty.tech/client/react-native/desktop/vendor/berty.tech/core.BuildMode=$(BUILD_MODE),berty.tech/client/react-native/desktop/vendor/berty.tech/core.commitDate=$(GIT_COMMIT_DATE)

sign:
ifndef CSC_LINK
Expand Down
12 changes: 10 additions & 2 deletions client/react-native/desktop/coreinterface/core.go
Expand Up @@ -9,6 +9,8 @@ import (
"os/exec"
"regexp"

"github.com/asticode/go-astilectron"

"berty.tech/client/react-native/gomobile/core"
"go.uber.org/zap"

Expand All @@ -17,6 +19,8 @@ import (
"github.com/shibukawa/configdir"
)

var a *astilectron.Astilectron

func getStorageDir() (string, error) {
storagePath := configdir.New("Berty Technologies", "Berty")
storageDirs := storagePath.QueryFolders(configdir.Global)
Expand All @@ -31,6 +35,10 @@ func getStorageDir() (string, error) {
return storageDirs[0].Path, nil
}

func SetAstilectron(w *astilectron.Astilectron) {
a = w
}

func InstallUpdate(url string) (interface{}, error) {
out, err := os.Create("/tmp/bertydl.dmg")
if err != nil {
Expand Down Expand Up @@ -86,12 +94,12 @@ func InstallUpdate(url string) (interface{}, error) {
return nil, err
}

cmd = exec.Command("open", "/Applications/Berty.app")
cmd = exec.Command("open", "-nF", "/Applications/Berty.app")
stdout, err = cmd.CombinedOutput()
if err != nil {
return nil, err
}

a.Stop()
os.Exit(0)

return nil, nil
Expand Down
3 changes: 1 addition & 2 deletions client/react-native/desktop/go.mod
Expand Up @@ -7,9 +7,8 @@ require (
berty.tech/core v0.0.0
github.com/akavel/rsrc v0.0.0-20170831122431-f6a15ece2cfd // indirect
github.com/asticode/go-astiamqp v1.0.0 // indirect
github.com/asticode/go-astilectron v0.8.0
github.com/asticode/go-astilectron v0.8.1-0.20190413132916-5aeb8e509a8d // indirect
github.com/asticode/go-astilectron-bootstrap v0.0.0-20180616141213-b3211646d205
github.com/asticode/go-astilectron-bundler v0.0.0-20190221164801-6b22eafb3c85 // indirect
github.com/asticode/go-astilog v1.0.0
github.com/asticode/go-bindata v0.0.0-20151023091102-a0ff2567cfb7 // indirect
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
Expand Down
4 changes: 4 additions & 0 deletions client/react-native/desktop/go.sum
Expand Up @@ -26,6 +26,10 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
github.com/asticode/go-astiamqp v1.0.0/go.mod h1:PDHG8FjHJDtbDNNHixFCm80+7Ma1dKvwYl325Mj5DI4=
github.com/asticode/go-astilectron v0.8.0 h1:OuLahP7CKcQNyXrFMWRzvK4Mymltd94Orp6SvoE4P4g=
github.com/asticode/go-astilectron v0.8.0/go.mod h1:XN7r4w/s0Eu7D5TgmXuPN07sO8CmYHg95kw2EuW15nE=
github.com/asticode/go-astilectron v0.8.1-0.20190413132916-5aeb8e509a8d h1:fQI8pPREcpS7Dcm6MFb18l18YxteuBlydZ7AKFiOAbE=
github.com/asticode/go-astilectron v0.8.1-0.20190413132916-5aeb8e509a8d/go.mod h1:XN7r4w/s0Eu7D5TgmXuPN07sO8CmYHg95kw2EuW15nE=
github.com/asticode/go-astilectron v0.8.1-0.20190415090856-5d5f14367434 h1:ylfFR303jE+rwqOrT27iRJiM0DD6mLNwNCoj3uRbQYs=
github.com/asticode/go-astilectron v0.8.1-0.20190415090856-5d5f14367434/go.mod h1:XN7r4w/s0Eu7D5TgmXuPN07sO8CmYHg95kw2EuW15nE=
github.com/asticode/go-astilectron-bootstrap v0.0.0-20180616141213-b3211646d205 h1:rCYoIm4F11K8tNUEB0TbNT4QsVx9MBgI09thWJ075S4=
github.com/asticode/go-astilectron-bootstrap v0.0.0-20180616141213-b3211646d205/go.mod h1:SRaKevdZAZLWX+GCK49MNPYnHGjcNEP4XN3swtIWC3Q=
github.com/asticode/go-astilectron-bundler v0.0.0-20190221164801-6b22eafb3c85 h1:IMMknl/D17tmp5hBAf4LbUosnkblirWa7a8emJhiKqs=
Expand Down
1 change: 1 addition & 0 deletions client/react-native/desktop/main.go
Expand Up @@ -49,6 +49,7 @@ func main() {
// Run bootstrap
logger().Debug(fmt.Sprintf("Running app built at %s", BuiltAt))
if err := bootstrap.Run(bootstrap.Options{
Adapter: coreinterface.SetAstilectron,
Asset: Asset,
AssetDir: AssetDir,
RestoreAssets: RestoreAssets,
Expand Down

0 comments on commit 10fa321

Please sign in to comment.