Moved profile image handling into geth_backend
This commit is contained in:
parent
c176a7fca0
commit
c8450586fd
|
@ -7,6 +7,7 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/status-im/status-go/images"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -1268,3 +1269,14 @@ func (b *GethStatusBackend) SignHash(hexEncodedHash string) (string, error) {
|
||||||
hexEncodedSignature := types.EncodeHex(signature)
|
hexEncodedSignature := types.EncodeHex(signature)
|
||||||
return hexEncodedSignature, nil
|
return hexEncodedSignature, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *GethStatusBackend) GetProfileImages() (string, error) {
|
||||||
|
// TODO
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *GethStatusBackend) SaveProfileImage(filepath string, aX, aY, bX, bY int) (string, error) {
|
||||||
|
imgs, err := images.GenerateProfileImages(filepath, aX, aY, bX, bY)
|
||||||
|
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import (
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
"github.com/status-im/status-go/exportlogs"
|
"github.com/status-im/status-go/exportlogs"
|
||||||
"github.com/status-im/status-go/extkeys"
|
"github.com/status-im/status-go/extkeys"
|
||||||
"github.com/status-im/status-go/images"
|
|
||||||
"github.com/status-im/status-go/multiaccounts"
|
"github.com/status-im/status-go/multiaccounts"
|
||||||
"github.com/status-im/status-go/multiaccounts/accounts"
|
"github.com/status-im/status-go/multiaccounts/accounts"
|
||||||
"github.com/status-im/status-go/params"
|
"github.com/status-im/status-go/params"
|
||||||
|
@ -630,15 +629,25 @@ func MultiformatDeserializePublicKey(key, outBase string) string {
|
||||||
return pk
|
return pk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetProfileImages returns an array of base64 encoded images related to the user's profile
|
||||||
|
func GetProfileImages() string {
|
||||||
|
pis, err := statusBackend.GetProfileImages()
|
||||||
|
if err != nil {
|
||||||
|
return makeJSONResponse(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return pis
|
||||||
|
}
|
||||||
|
|
||||||
// SaveProfileImage takes the filepath of an image, crops it as per the rect coords and finally resizes the image.
|
// SaveProfileImage takes the filepath of an image, crops it as per the rect coords and finally resizes the image.
|
||||||
// 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 SaveProfileImage(filepath string, aX, aY, bX, bY int) string {
|
func SaveProfileImage(filepath string, aX, aY, bX, bY int) string {
|
||||||
imgs, err := images.GenerateProfileImages(filepath, aX, aY, bX, bY)
|
imgs, err := statusBackend.SaveProfileImage(filepath, aX, aY, bX, bY)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return makeJSONResponse(err)
|
return makeJSONResponse(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return imgs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue