Resolved further linting issues
This commit is contained in:
parent
a77a40fdf4
commit
b7a7035894
|
@ -101,7 +101,7 @@ func TestDatabase_GetIdentityImage(t *testing.T) {
|
||||||
seedTestDB(t, db)
|
seedTestDB(t, db)
|
||||||
|
|
||||||
cs := []struct {
|
cs := []struct {
|
||||||
KeyUid string
|
KeyUID string
|
||||||
Name string
|
Name string
|
||||||
Expected string
|
Expected string
|
||||||
}{
|
}{
|
||||||
|
@ -123,7 +123,7 @@ func TestDatabase_GetIdentityImage(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cs {
|
for _, c := range cs {
|
||||||
oii, err := db.GetIdentityImage(c.KeyUid, c.Name)
|
oii, err := db.GetIdentityImage(c.KeyUID, c.Name)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
joii, err := json.Marshal(oii)
|
joii, err := json.Marshal(oii)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/status-im/status-go/images"
|
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
"github.com/status-im/markdown"
|
"github.com/status-im/markdown"
|
||||||
"github.com/status-im/markdown/ast"
|
"github.com/status-im/markdown/ast"
|
||||||
|
|
||||||
|
"github.com/status-im/status-go/images"
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/status-im/status-go/images"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/status-im/status-go/eth-node/crypto"
|
"github.com/status-im/status-go/eth-node/crypto"
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
|
"github.com/status-im/status-go/images"
|
||||||
"github.com/status-im/status-go/protocol/common"
|
"github.com/status-im/status-go/protocol/common"
|
||||||
"github.com/status-im/status-go/protocol/encryption/multidevice"
|
"github.com/status-im/status-go/protocol/encryption/multidevice"
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
gethcrypto "github.com/ethereum/go-ethereum/crypto"
|
gethcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/status-im/status-go/multiaccounts"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
@ -25,6 +24,7 @@ import (
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
enstypes "github.com/status-im/status-go/eth-node/types/ens"
|
enstypes "github.com/status-im/status-go/eth-node/types/ens"
|
||||||
userimage "github.com/status-im/status-go/images"
|
userimage "github.com/status-im/status-go/images"
|
||||||
|
"github.com/status-im/status-go/multiaccounts"
|
||||||
"github.com/status-im/status-go/protocol/audio"
|
"github.com/status-im/status-go/protocol/audio"
|
||||||
"github.com/status-im/status-go/protocol/common"
|
"github.com/status-im/status-go/protocol/common"
|
||||||
"github.com/status-im/status-go/protocol/encryption"
|
"github.com/status-im/status-go/protocol/encryption"
|
||||||
|
|
|
@ -590,8 +590,8 @@ func (api *PublicAPI) Echo(ctx context.Context, message string) (string, error)
|
||||||
//
|
//
|
||||||
|
|
||||||
// GetIdentityImages returns an array of json marshalled IdentityImages assigned to the user's identity
|
// GetIdentityImages returns an array of json marshalled IdentityImages assigned to the user's identity
|
||||||
func (api *PublicAPI) GetIdentityImages(keyUid string) (string, error) {
|
func (api *PublicAPI) GetIdentityImages(keyUID string) (string, error) {
|
||||||
iis, err := api.service.multiAccountsDB.GetIdentityImages(keyUid)
|
iis, err := api.service.multiAccountsDB.GetIdentityImages(keyUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -602,8 +602,8 @@ func (api *PublicAPI) GetIdentityImages(keyUid string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIdentityImage returns a json object representing the image with the given name
|
// GetIdentityImage returns a json object representing the image with the given name
|
||||||
func (api *PublicAPI) GetIdentityImage(keyUid, name string) (string, error) {
|
func (api *PublicAPI) GetIdentityImage(keyUID, name string) (string, error) {
|
||||||
ii, err := api.service.multiAccountsDB.GetIdentityImage(keyUid, name)
|
ii, err := api.service.multiAccountsDB.GetIdentityImage(keyUID, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -617,13 +617,13 @@ func (api *PublicAPI) GetIdentityImage(keyUid, name string) (string, error) {
|
||||||
// The resulting image(s) will be stored in the DB along with other user account information.
|
// The resulting image(s) will be stored in the DB along with other user account information.
|
||||||
// aX and aY represent the pixel coordinates of the upper left corner of the image's cropping area
|
// aX and aY represent the pixel coordinates of the upper left corner of the image's cropping area
|
||||||
// bX and bY represent the pixel coordinates of the lower right corner of the image's cropping area
|
// bX and bY represent the pixel coordinates of the lower right corner of the image's cropping area
|
||||||
func (api *PublicAPI) StoreIdentityImage(keyUid, filepath string, aX, aY, bX, bY int) (string, error) {
|
func (api *PublicAPI) StoreIdentityImage(keyUID, filepath string, aX, aY, bX, bY int) (string, error) {
|
||||||
iis, err := images.GenerateIdentityImages(filepath, aX, aY, bX, bY)
|
iis, err := images.GenerateIdentityImages(filepath, aX, aY, bX, bY)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = api.service.multiAccountsDB.StoreIdentityImages(keyUid, iis)
|
err = api.service.multiAccountsDB.StoreIdentityImages(keyUID, iis)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -634,8 +634,8 @@ func (api *PublicAPI) StoreIdentityImage(keyUid, filepath string, aX, aY, bX, bY
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteIdentityImage deletes an IdentityImage from the db with the given name
|
// DeleteIdentityImage deletes an IdentityImage from the db with the given name
|
||||||
func (api *PublicAPI) DeleteIdentityImage(keyUid string) error {
|
func (api *PublicAPI) DeleteIdentityImage(keyUID string) error {
|
||||||
return api.service.multiAccountsDB.DeleteIdentityImage(keyUid)
|
return api.service.multiAccountsDB.DeleteIdentityImage(keyUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----
|
// -----
|
||||||
|
|
Loading…
Reference in New Issue