30
vendor/github.com/status-im/status-go/protocol/wakusync/profile_response.go
generated
vendored
Normal file
30
vendor/github.com/status-im/status-go/protocol/wakusync/profile_response.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package wakusync
|
||||
|
||||
import (
|
||||
"github.com/status-im/status-go/images"
|
||||
"github.com/status-im/status-go/protocol/identity"
|
||||
"github.com/status-im/status-go/services/ens"
|
||||
)
|
||||
|
||||
type BackedUpProfile struct {
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
Images []images.IdentityImage `json:"images,omitempty"`
|
||||
SocialLinks []*identity.SocialLink `json:"socialLinks,omitempty"`
|
||||
EnsUsernameDetails []*ens.UsernameDetail `json:"ensUsernameDetails,omitempty"`
|
||||
}
|
||||
|
||||
func (sfwr *WakuBackedUpDataResponse) SetDisplayName(displayName string) {
|
||||
sfwr.Profile.DisplayName = displayName
|
||||
}
|
||||
|
||||
func (sfwr *WakuBackedUpDataResponse) SetImages(images []images.IdentityImage) {
|
||||
sfwr.Profile.Images = images
|
||||
}
|
||||
|
||||
func (sfwr *WakuBackedUpDataResponse) SetSocialLinks(socialLinks []*identity.SocialLink) {
|
||||
sfwr.Profile.SocialLinks = socialLinks
|
||||
}
|
||||
|
||||
func (sfwr *WakuBackedUpDataResponse) SetEnsUsernameDetails(ensUsernameDetails []*ens.UsernameDetail) {
|
||||
sfwr.Profile.EnsUsernameDetails = ensUsernameDetails
|
||||
}
|
||||
36
vendor/github.com/status-im/status-go/protocol/wakusync/progress_response.go
generated
vendored
Normal file
36
vendor/github.com/status-im/status-go/protocol/wakusync/progress_response.go
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
package wakusync
|
||||
|
||||
import (
|
||||
"github.com/status-im/status-go/protocol/protobuf"
|
||||
)
|
||||
|
||||
type FetchingBackupedDataDetails struct {
|
||||
DataNumber uint32 `json:"dataNumber,omitempty"`
|
||||
TotalNumber uint32 `json:"totalNumber,omitempty"`
|
||||
}
|
||||
|
||||
func (sfwr *WakuBackedUpDataResponse) AddFetchingBackedUpDataDetails(section string, details *protobuf.FetchingBackedUpDataDetails) {
|
||||
if details == nil {
|
||||
return
|
||||
}
|
||||
if sfwr.FetchingDataProgress == nil {
|
||||
sfwr.FetchingDataProgress = make(map[string]*protobuf.FetchingBackedUpDataDetails)
|
||||
}
|
||||
|
||||
sfwr.FetchingDataProgress[section] = details
|
||||
}
|
||||
|
||||
func (sfwr *WakuBackedUpDataResponse) FetchingBackedUpDataDetails() map[string]FetchingBackupedDataDetails {
|
||||
if len(sfwr.FetchingDataProgress) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
result := make(map[string]FetchingBackupedDataDetails)
|
||||
for section, details := range sfwr.FetchingDataProgress {
|
||||
result[section] = FetchingBackupedDataDetails{
|
||||
DataNumber: details.DataNumber,
|
||||
TotalNumber: details.TotalNumber,
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
39
vendor/github.com/status-im/status-go/protocol/wakusync/response.go
generated
vendored
Normal file
39
vendor/github.com/status-im/status-go/protocol/wakusync/response.go
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
package wakusync
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/status-im/status-go/multiaccounts/accounts"
|
||||
"github.com/status-im/status-go/multiaccounts/settings"
|
||||
"github.com/status-im/status-go/protocol/protobuf"
|
||||
)
|
||||
|
||||
type WakuBackedUpDataResponse struct {
|
||||
Clock uint64
|
||||
FetchingDataProgress map[string]*protobuf.FetchingBackedUpDataDetails // key represents the data/section backup details refer to
|
||||
Profile *BackedUpProfile
|
||||
Setting *settings.SyncSettingField
|
||||
Keypair *accounts.Keypair
|
||||
WatchOnlyAccount *accounts.Account
|
||||
}
|
||||
|
||||
func (sfwr *WakuBackedUpDataResponse) MarshalJSON() ([]byte, error) {
|
||||
responseItem := struct {
|
||||
Clock uint64 `json:"clock,omitempty"`
|
||||
FetchingDataProgress map[string]FetchingBackupedDataDetails `json:"fetchingBackedUpDataProgress,omitempty"`
|
||||
Profile *BackedUpProfile `json:"backedUpProfile,omitempty"`
|
||||
Setting *settings.SyncSettingField `json:"backedUpSettings,omitempty"`
|
||||
Keypair *accounts.Keypair `json:"backedUpKeypair,omitempty"`
|
||||
WatchOnlyAccount *accounts.Account `json:"backedUpWatchOnlyAccount,omitempty"`
|
||||
}{
|
||||
Clock: sfwr.Clock,
|
||||
Profile: sfwr.Profile,
|
||||
Setting: sfwr.Setting,
|
||||
Keypair: sfwr.Keypair,
|
||||
WatchOnlyAccount: sfwr.WatchOnlyAccount,
|
||||
}
|
||||
|
||||
responseItem.FetchingDataProgress = sfwr.FetchingBackedUpDataDetails()
|
||||
|
||||
return json.Marshal(responseItem)
|
||||
}
|
||||
Reference in New Issue
Block a user