Skip to content

Commit

Permalink
Fast user switching (keybase#18045)
Browse files Browse the repository at this point in the history
* account switcher: storybook

* account switcher: a bunch of commits
 - account switcher: plumb, make it work
 - work on mobile
 - escape creating a new account
 - escape provisioning with a new account
 - allow entering passwords for users not signed in
 - if choosing a user from the login page that is already logged in, just log in
 - turn on feature flag
 - address chrisnojima feedback
 - stories, pzduniak feedback

* address more feedback

* fix name-with-icon

* scroll fast user switcher

* fix mobile look, stories

* show back button on paper key screen

* Update text.

* address some user switching bugs

* make logged-out users lighter on relogin

* storyshots

* disable fast account switching on mobile

* fix bad merge

* address nojima feedback

* address nojima feedback

* fix new bug, change ore
order of accounts

* sort the other way

* appease eslint

* final feedback
Issue: Y2K-127
  • Loading branch information
aaazalea authored Jul 19, 2019
1 parent 2b5a30a commit c494e46
Show file tree
Hide file tree
Showing 47 changed files with 1,139 additions and 215 deletions.
37 changes: 34 additions & 3 deletions go/libkb/secret_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,55 @@ func NewSecretStore(g *GlobalContext, username NormalizedUsername) SecretStore {
}

func GetConfiguredAccounts(m MetaContext, s SecretStoreAll) ([]keybase1.ConfiguredAccount, error) {

currentUsername, allUsernames, err := GetAllProvisionedUsernames(m)
if err != nil {
return nil, err
}

if !currentUsername.IsNil() {
allUsernames = append(allUsernames, currentUsername)
}

accounts := make(map[NormalizedUsername]keybase1.ConfiguredAccount)

for _, username := range allUsernames {
accounts[username] = keybase1.ConfiguredAccount{
Username: username.String(),
IsCurrent: username.Eq(currentUsername),
}
}

// Get the full names

uids := make([]keybase1.UID, len(allUsernames))
for idx, username := range allUsernames {
uid := m.G().UIDMapper.MapHardcodedUsernameToUID(username)
if !uid.Exists() {
uid = UsernameToUIDPreserveCase(username.String())
}
uids[idx] = uid
}
usernamePackages, err := m.G().UIDMapper.MapUIDsToUsernamePackages(m.Ctx(), m.G(),
uids, time.Hour*24, time.Second*10, false)
if err != nil {
if usernamePackages != nil {
// If data is returned, interpret the error as a warning
m.G().Log.CInfof(m.Ctx(),
"error while retrieving full names: %+v", err)
} else {
return nil, err
}
}
for _, uPackage := range usernamePackages {
if uPackage.FullName == nil {
continue
}
if account, ok := accounts[uPackage.NormalizedUsername]; ok {
account.Fullname = uPackage.FullName.FullName
accounts[uPackage.NormalizedUsername] = account
}
}

// Check for secrets

var storedSecretUsernames []string
if s != nil {
storedSecretUsernames, err = s.GetUsersWithStoredSecrets(m)
Expand Down
8 changes: 5 additions & 3 deletions go/protocol/keybase1/login.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions protocol/avdl/keybase1/login.avdl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ protocol login {

record ConfiguredAccount {
string username;
FullName fullname;
boolean hasStoredSecret;
boolean isCurrent;
}
Expand Down
4 changes: 4 additions & 0 deletions protocol/json/keybase1/login.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions shared/__mocks__/feature-flags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ff: FeatureFlags = {
chatIndexProfilingEnabled: false,
conflictResolution: false,
dbCleanEnabled: false,
fastAccountSwitch: true,
foldersInProfileTab: true,
kbfsOfflineMode: true,
moveOrCopy: true,
Expand Down
13 changes: 12 additions & 1 deletion shared/actions/config-gen.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c494e46

Please sign in to comment.