1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-11 02:13:41 +09:00

GO-1132 Add icon to AccountRecoverLegacy

This commit is contained in:
kirillston 2023-04-25 18:17:59 +02:00 committed by Mikhail Iudin
parent b5a434abbe
commit 09ca4fbba1
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
4 changed files with 916 additions and 1855 deletions

View file

@ -743,7 +743,7 @@ func (mw *Middleware) createAccountFromExport(profile *pb.Profile, req *pb.RpcAc
return "", pb.RpcAccountRecoverFromLegacyExportResponseError_UNKNOWN_ERROR, err
}
err = mw.setDetails(profile, err)
err = mw.setDetails(profile, req.Icon, err)
if err != nil {
return "", pb.RpcAccountRecoverFromLegacyExportResponseError_UNKNOWN_ERROR, err
}
@ -780,18 +780,37 @@ func (mw *Middleware) getBootstrapConfig(err error, req *pb.RpcAccountRecoverFro
return cfg, nil
}
func (mw *Middleware) setDetails(profile *pb.Profile, err error) error {
details := []*pb.RpcObjectSetDetailsDetail{{Key: "name", Value: pbtypes.String(profile.Name)}}
details = append(details, &pb.RpcObjectSetDetailsDetail{
func (mw *Middleware) setDetails(profile *pb.Profile, icon int64, err error) error {
profileDetails := []*pb.RpcObjectSetDetailsDetail{{
Key: bundle.RelationKeyName.String(),
Value: pbtypes.String(profile.Name),
}, {
Key: bundle.RelationKeyIconImage.String(),
Value: pbtypes.String(profile.Avatar),
})
}}
if profile.Avatar == "" {
profileDetails = append(profileDetails, &pb.RpcObjectSetDetailsDetail{
Key: bundle.RelationKeyIconOption.String(),
Value: pbtypes.Int64(icon),
})
}
accountDetails := []*pb.RpcObjectSetDetailsDetail{{
Key: bundle.RelationKeyIconOption.String(),
Value: pbtypes.Int64(icon),
}}
bs := mw.app.MustComponent(block.CName).(*block.Service)
coreService := mw.app.MustComponent(core.CName).(core.Service)
if err = bs.SetDetails(nil, pb.RpcObjectSetDetailsRequest{
ContextId: coreService.PredefinedBlocks().Profile,
Details: details,
Details: profileDetails,
}); err != nil {
return err
}
if err = bs.SetDetails(nil, pb.RpcObjectSetDetailsRequest{
ContextId: coreService.PredefinedBlocks().Account,
Details: accountDetails,
}); err != nil {
return err
}

View file

@ -2485,6 +2485,7 @@ Middleware-to-front-end response to an account recover request, that can contain
| ----- | ---- | ----- | ----------- |
| path | [string](#string) | | |
| rootPath | [string](#string) | | |
| icon | [int64](#int64) | | |

File diff suppressed because it is too large Load diff

View file

@ -527,6 +527,7 @@ message Rpc {
option (no_auth) = true;
string path = 1;
string rootPath = 2;
int64 icon = 3;
}
message Response {