status-go/protocol/wakusync/progress_response.go
Sale Djenic 1340a55c1d feat: backup profile data to waku and sync them from waku
Changes applied here introduce backing up profile data (display name and identity
images) to waku and fetch them from waku. Information about those data is sent
as a separate signal to a client via `sync.from.waku.profile` signal.

New signal `sync.from.waku.progress` is introduced which will be used to notify a client
about the progress of fetching data from waku.
2022-12-23 15:07:14 +01:00

37 lines
1001 B
Go

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
}