Show sync mode in saved remote summary
This commit is contained in:
@@ -2593,20 +2593,24 @@ func (u *ui) shouldShowSavedRemoteBindingSelectors() bool {
|
||||
return len(profiles) > 1 || len(entries) > 1
|
||||
}
|
||||
|
||||
func (u *ui) savedRemoteBindingSummary() (profileLabel, credentialLabel string, ok bool) {
|
||||
func (u *ui) savedRemoteBindingSummary() (profileLabel, credentialLabel, syncLabel string, ok bool) {
|
||||
profile, ok := u.selectedVaultRemoteProfile()
|
||||
if !ok {
|
||||
return "", "", false
|
||||
return "", "", "", false
|
||||
}
|
||||
entry, ok := u.selectedVaultRemoteCredentialEntry()
|
||||
if !ok {
|
||||
return "", "", false
|
||||
return "", "", "", false
|
||||
}
|
||||
credentialLabel = entry.Title
|
||||
if strings.TrimSpace(entry.Username) != "" {
|
||||
credentialLabel += " · " + strings.TrimSpace(entry.Username)
|
||||
}
|
||||
return profile.Name, credentialLabel, true
|
||||
syncLabel = "Sync manually when you choose Use Remote Sync."
|
||||
if normalizeUISyncMode(u.selectedVaultRemoteSyncMode) == appstate.SyncModeAutomaticOnOpenSave {
|
||||
syncLabel = "Syncs automatically on open and save."
|
||||
}
|
||||
return profile.Name, credentialLabel, syncLabel, true
|
||||
}
|
||||
|
||||
func (u *ui) savedRemoteBindingHeading() string {
|
||||
@@ -5573,7 +5577,7 @@ func (u *ui) syncMenu(gtx layout.Context) layout.Dimensions {
|
||||
if !u.shouldShowSavedRemoteBindingSelectors() {
|
||||
rows = append(rows,
|
||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||
profileLabel, credentialLabel, ok := u.savedRemoteBindingSummary()
|
||||
profileLabel, credentialLabel, syncLabel, ok := u.savedRemoteBindingSummary()
|
||||
if !ok {
|
||||
return layout.Dimensions{}
|
||||
}
|
||||
@@ -5591,6 +5595,12 @@ func (u *ui) syncMenu(gtx layout.Context) layout.Dimensions {
|
||||
lbl.Color = mutedColor
|
||||
return lbl.Layout(gtx)
|
||||
}),
|
||||
layout.Rigid(layout.Spacer{Height: unit.Dp(2)}.Layout),
|
||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||
lbl := material.Label(u.theme, unit.Sp(12), syncLabel)
|
||||
lbl.Color = mutedColor
|
||||
return lbl.Layout(gtx)
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user