-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
66 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,19 @@ | ||
//+build darwin,systray | ||
//go:build darwin && systray | ||
// +build darwin,systray | ||
|
||
package gui | ||
|
||
import ( | ||
"image/png" | ||
"os" | ||
|
||
"golang.org/x/image/tiff" | ||
) | ||
|
||
const ( | ||
pngIconPath = "/Applications/Skywire.app/Contents/Resources/icon.png" | ||
iconPath = "/Applications/Skywire.app/Contents/Resources/tray_icon.tiff" | ||
iconName = "icons/icon.tiff" | ||
deinstallerPath = "/Applications/Skywire.app/Contents/deinstaller" | ||
appPath = "/Applications/Skywire.app" | ||
appPath = "/Applications/Skywire.app" | ||
) | ||
|
||
func preReadIcon() error { | ||
imgFile, err := os.Open(pngIconPath) | ||
if err != nil { | ||
return err | ||
} | ||
img, err := png.Decode(imgFile) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
tiffFile, err := os.Create(iconPath) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err = tiff.Encode(tiffFile, img, nil); err != nil { | ||
return err | ||
} | ||
|
||
return tiffFile.Close() | ||
} | ||
|
||
func checkIsPackage() bool { | ||
_, err := os.Stat(appPath) | ||
_, err := os.Stat(deinstallerPath) | ||
return err == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//go:build systray | ||
// +build systray | ||
|
||
package gui | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/skycoin/dmsg/cipher" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/skycoin/skywire/pkg/visor/visorconfig" | ||
) | ||
|
||
func TestGetAvailPublicVPNServers(t *testing.T) { | ||
pk, sk := cipher.GenerateKeyPair() | ||
common := &visorconfig.Common{ | ||
Version: "v1.1.0", | ||
SK: sk, | ||
PK: pk, | ||
} | ||
config := visorconfig.MakeBaseConfig(common) | ||
servers := GetAvailPublicVPNServers(config) | ||
require.NotEqual(t, nil, servers) | ||
require.NotEqual(t, []string{}, servers) | ||
t.Logf("Servers: %v", servers) | ||
} | ||
|
||
func TestReadEmbeddedIcon(t *testing.T) { | ||
b, err := ReadSysTrayIcon() | ||
require.NoError(t, err) | ||
require.NotEqual(t, 0, len(b)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
//+build !windows,systray | ||
//go:build !windows && systray | ||
// +build !windows,systray | ||
|
||
package gui | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters