1
0

Other(refactor): Remove bridgeWrap from frontend interface

This commit is contained in:
James Houlahan
2022-08-26 15:12:19 +02:00
committed by Jakub
parent 9786deef48
commit 6bbe2d0e00
16 changed files with 307 additions and 168 deletions

View File

@ -21,7 +21,7 @@ import (
"regexp"
"strings"
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
"github.com/ProtonMail/proton-bridge/v2/internal/users"
"github.com/sirupsen/logrus"
)
@ -57,19 +57,19 @@ func getInitials(fullName string) string {
return strings.ToUpper(initials)
}
// grpcUserFromBridge converts a bridge user to a gRPC user.
func grpcUserFromBridge(user types.User) *User {
// grpcUserFromInfo converts a bridge user to a gRPC user.
func grpcUserFromInfo(user users.UserInfo) *User {
return &User{
Id: user.ID(),
Username: user.Username(),
AvatarText: getInitials(user.Username()),
LoggedIn: user.IsConnected(),
SplitMode: !user.IsCombinedAddressMode(),
Id: user.ID,
Username: user.Username,
AvatarText: getInitials(user.Username),
LoggedIn: user.Connected,
SplitMode: user.Mode == users.SplitMode,
SetupGuideSeen: true, // users listed have already seen the setup guide.
UsedBytes: user.UsedBytes(),
TotalBytes: user.TotalBytes(),
Password: user.GetBridgePassword(),
Addresses: user.GetAddresses(),
UsedBytes: user.UsedBytes,
TotalBytes: user.TotalBytes,
Password: user.Password,
Addresses: user.Addresses,
}
}