Skip to content

Commit

Permalink
Merge branch 'develop' into stdevAntiD2ta_t298_Log_events_to_file
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiD2ta committed Jan 18, 2020
2 parents 7fbc7a7 + d9032fd commit 2346a76
Show file tree
Hide file tree
Showing 52 changed files with 6,110 additions and 177 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ rcc_cgo_*.go
darwin


# Auto-generates go files.

*.pb.go
44 changes: 17 additions & 27 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ ignored = [
[prune]
go-tests = true
unused-packages = true

[[constraint]]
branch = "master"
name = "golang.org/x/crypto"
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ICONSET := resources/images/icons/appIcon/appIcon.iconset
CONVERT := convert
SIPS := sips
ICONUTIL := iconutil
UNAME_S = $(shell uname -s)
DEFAULT_TARGET ?= desktop
DEFAULT_ARCH ?= linux

# Platform-specific switches
ifeq ($(OS),Windows_NT)
Expand Down Expand Up @@ -245,6 +248,7 @@ clean: clean-test clean-build ## Remove temporary files

gen-mocks: ## Generate mocks for interface types
mockery -all -output src/coin/mocks -outpkg mocks -dir src/core
find src/coin/mocks/ -name '*.go' -type f -print0 | xargs -0 -I PATH sed -i '' -e 's/fibercryptowallet/fibercryptowallet/g' PATH

test-sky: ## Run Skycoin plugin test suite
go test -cover -timeout 30s github.com/fibercrypto/fibercryptowallet/src/coin/skycoin
Expand All @@ -253,6 +257,10 @@ test-sky: ## Run Skycoin plugin test suite
test-core: ## Run tests for API core and helpers
go test -cover -timeout 30s github.com/fibercrypto/fibercryptowallet/src/util

test-data: ## Run tests for data package
go test -coverprofile=src/data/coverage.out -timeout 30s github.com/fibercrypto/fibercryptowallet/src/data


test-sky-launch-html-cover:
go test -cover -timeout 30s github.com/fibercrypto/fibercryptowallet/src/coin/skycoin
go test -coverprofile=$(COVERAGEFILE) -timeout 30s github.com/fibercrypto/fibercryptowallet/src/coin/skycoin/models
Expand All @@ -269,7 +277,7 @@ test-cover-travis:

test-cover: clean-test test-sky-launch-html-cover ## Show more details of test coverage

test: clean-test test-core test-sky ## Run project test suite
test: clean-test test-core test-sky test-data## Run project test suite

run-docker: DOCKER_GOPATH=$(shell docker inspect $(DOCKER_QT):$(DEFAULT_ARCH) | grep '"GOPATH=' | head -n1 | cut -d = -f2 | cut -d '"' -f1)
run-docker: install-docker-deps ## Run CMD inside Docker container
Expand Down
19 changes: 6 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

_ "github.com/fibercrypto/fibercryptowallet/src/coin/skycoin"
_ "github.com/fibercrypto/fibercryptowallet/src/models"
_ "github.com/fibercrypto/fibercryptowallet/src/models/addressBook"
_ "github.com/fibercrypto/fibercryptowallet/src/models/history"
_ "github.com/fibercrypto/fibercryptowallet/src/models/pending"
"github.com/therecipe/qt/core"
Expand Down Expand Up @@ -44,21 +45,13 @@ func main() {
// url := core.NewQUrl3("qrc:/ui/src/ui/main.qml", 0)
url := core.NewQUrl3("src/ui/main.qml", 0) // disable this to make a release

// TODO: Find a way to use a `core.Qt__QueuedConnection`, so we can remove the flag `allOk`
allOk := true
engine.ConnectObjectCreated(func(object *core.QObject, objUrl *core.QUrl) {
if object.Pointer() == nil && url.ToString(0) == objUrl.ToString(0) {
allOk = false
app.Exit(-1) // Ignored because we need a `core.Qt__QueuedConnection`
engine.ConnectSignal(engine.ConnectObjectCreated, func(object *core.QObject, objUrl *core.QUrl) {
if object.Pointer() == nil && url.ToString(0) == objUrl.ToString(0)[len(objUrl.ToString(0)) - len(url.ToString(0)):] {
app.Exit(-1)
}
})
}, core.Qt__QueuedConnection)
engine.Load(url)
splash.QWidget.Close()

// A `core.Qt__QueuedConnection` will allows us to remove the condition bellow, leaving only `app.Exec()`
if allOk == true {
app.Exec()
} else {
app.Exit(-1)
}
app.Exec()
}
1 change: 1 addition & 0 deletions resources/images/icons/user_icon-icons.com_66546.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/coin/skycoin/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/user"
"path/filepath"
"strconv"
"strings"

local "github.com/fibercrypto/fibercryptowallet/src/main"
Expand Down Expand Up @@ -73,6 +74,30 @@ func getValues(prefix string) ([]string, error) {
return sectionManager.GetValues(strings.Split(prefix, "/"))
}

func GetDataRefreshTimeout() uint64 {
cm := local.GetConfigManager()
sm := cm.GetSectionManager("global")
value, err := sm.GetValue("cache", nil)
if err != nil {
return 0
}

keyValue := make(map[string]string)
err = json.Unmarshal([]byte(value), &keyValue)
if err != nil {
return 0
}
strVal, ok := keyValue["lifeTime"]
if !ok {
return 0
}
val, err := strconv.ParseUint(strVal, 10, 64)
if err != nil {
return 0
}
return val
}

func GetWalletSources() ([]*walletSource, error) {
wltsString, err := getValues(SettingPathToWalletSource)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions src/coin/skycoin/models/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/fibercrypto/fibercryptowallet/src/core"
"github.com/fibercrypto/fibercryptowallet/src/errors"
//local "github.com/fibercrypto/fibercryptowallet/src/main"
appParams "github.com/fibercrypto/fibercryptowallet/src/params"
)

// SkyFiberPlugin provide support for SkyFiber coins
Expand Down Expand Up @@ -100,7 +99,7 @@ func (p *SkyFiberPlugin) LoadTransactionAPI(netType string) (core.BlockchainTran
if netType != "MainNet" {
return nil, errors.ErrInvalidNetworkType
}
return NewSkycoinBlockchain(appParams.DataRefreshTimeout), nil
return NewSkycoinBlockchain(config.GetDataRefreshTimeout()), nil
}

// LoadSignService sign service entry point
Expand Down
47 changes: 47 additions & 0 deletions src/core/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,50 @@ const (
// TypeNameWalletStorage WalletStorage type name
TypeNameWalletStorage = "WalletStorage"
)

// AddressBook provides method to manage a contact database.
type AddressBook interface {
Init(secType int, password string) error
Authenticate(password string) error
ChangeSecurity(NewSecType int, oldPassword, newPassword string) error
GetContact(id uint64) (Contact, error)
ListContact() ([]Contact, error)
InsertContact(contact Contact) (uint64, error)
DeleteContact(id uint64) error
UpdateContact(id uint64, contact Contact) error
GetStorage() Storage
HasInit() bool
IsOpen() bool
GetSecType() (int, error)
Close() error
}

type Storage interface {
InsertValue(value interface{}) (uint64, error)
GetValue(key uint64) (interface{}, error)
ListValues() (map[uint64]interface{}, error)
DeleteValue(key uint64) error
UpdateValue(key uint64, newValue interface{}) error
Path() string
GetConfig() map[string]string
InsertConfig(map[string]string) error
Close() error
}

// Contact provides encrypt / decrypt data.
type Contact interface {
GetID() uint64
SetID(id uint64)
GetAddresses() []StringAddress
SetAddresses([]StringAddress)
GetName() string
SetName(string)
IsValid() bool
}
type StringAddress interface {
GetValue() []byte
SetValue(val []byte)
GetCoinType() []byte
SetCoinType(val []byte)
IsValid() bool
}
Loading

0 comments on commit 2346a76

Please sign in to comment.