feat(communities): add community images to import progress signal
This is needed so clients can render the selected community image while the import is running.
This commit is contained in:
parent
4bf5fcfe61
commit
d216840db8
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/status-im/status-go/images"
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -151,6 +152,7 @@ type ImportTasks map[ImportTask]*ImportTaskProgress
|
||||||
type ImportProgress struct {
|
type ImportProgress struct {
|
||||||
CommunityID string `json:"communityId,omitempty"`
|
CommunityID string `json:"communityId,omitempty"`
|
||||||
CommunityName string `json:"communityName"`
|
CommunityName string `json:"communityName"`
|
||||||
|
CommunityImages map[string]images.IdentityImage `json:"communityImages"`
|
||||||
Tasks []*ImportTaskProgress `json:"tasks"`
|
Tasks []*ImportTaskProgress `json:"tasks"`
|
||||||
Progress float32 `json:"progress"`
|
Progress float32 `json:"progress"`
|
||||||
ErrorsCount uint `json:"errorsCount"`
|
ErrorsCount uint `json:"errorsCount"`
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
|
|
||||||
"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/multiaccounts/accounts"
|
"github.com/status-im/status-go/multiaccounts/accounts"
|
||||||
"github.com/status-im/status-go/protocol/common"
|
"github.com/status-im/status-go/protocol/common"
|
||||||
"github.com/status-im/status-go/protocol/communities"
|
"github.com/status-im/status-go/protocol/communities"
|
||||||
|
@ -2221,6 +2222,13 @@ func (m *Messenger) RequestImportDiscordCommunity(request *requests.ImportDiscor
|
||||||
// marking import as not cancelled
|
// marking import as not cancelled
|
||||||
m.importingCommunities[communityID] = false
|
m.importingCommunities[communityID] = false
|
||||||
importProgress.CommunityID = communityID
|
importProgress.CommunityID = communityID
|
||||||
|
importProgress.CommunityImages = make(map[string]images.IdentityImage)
|
||||||
|
|
||||||
|
imgs := discordCommunity.Images()
|
||||||
|
for t, i := range imgs {
|
||||||
|
importProgress.CommunityImages[t] = images.IdentityImage{Name: t, Payload: i.Payload}
|
||||||
|
}
|
||||||
|
|
||||||
importProgress.UpdateTaskProgress(discord.CommunityCreationTask, 0.75)
|
importProgress.UpdateTaskProgress(discord.CommunityCreationTask, 0.75)
|
||||||
progressUpdates <- importProgress
|
progressUpdates <- importProgress
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue