Reset remote sync dialog scroll state
This commit is contained in:
@@ -282,6 +282,7 @@ type ui struct {
|
|||||||
detailList widget.List
|
detailList widget.List
|
||||||
apiPolicyList widget.List
|
apiPolicyList widget.List
|
||||||
lifecycleList widget.List
|
lifecycleList widget.List
|
||||||
|
syncDialogList widget.List
|
||||||
phonePanelList widget.List
|
phonePanelList widget.List
|
||||||
securityDialogList widget.List
|
securityDialogList widget.List
|
||||||
remotePrefsDialogList widget.List
|
remotePrefsDialogList widget.List
|
||||||
@@ -629,6 +630,9 @@ func newUIWithState(mode string, sess appstate.CurrentSession, paths statePaths)
|
|||||||
lifecycleList: widget.List{
|
lifecycleList: widget.List{
|
||||||
List: layout.List{Axis: layout.Vertical},
|
List: layout.List{Axis: layout.Vertical},
|
||||||
},
|
},
|
||||||
|
syncDialogList: widget.List{
|
||||||
|
List: layout.List{Axis: layout.Vertical},
|
||||||
|
},
|
||||||
phonePanelList: widget.List{
|
phonePanelList: widget.List{
|
||||||
List: layout.List{Axis: layout.Vertical},
|
List: layout.List{Axis: layout.Vertical},
|
||||||
},
|
},
|
||||||
@@ -1422,6 +1426,7 @@ func (u *ui) openAdvancedSyncDialog() {
|
|||||||
u.syncDialogOpen = true
|
u.syncDialogOpen = true
|
||||||
u.syncMenuOpen = false
|
u.syncMenuOpen = false
|
||||||
u.showSyncPassword = false
|
u.showSyncPassword = false
|
||||||
|
u.syncDialogList.Position = layout.Position{}
|
||||||
u.syncDialogPurpose = syncDialogPurposeAdvanced
|
u.syncDialogPurpose = syncDialogPurposeAdvanced
|
||||||
u.syncSourceMode = u.syncDefaultSourceMode
|
u.syncSourceMode = u.syncDefaultSourceMode
|
||||||
u.syncDirection = u.syncDefaultDirection
|
u.syncDirection = u.syncDefaultDirection
|
||||||
@@ -1436,6 +1441,7 @@ func (u *ui) openRemoteSyncSetupDialog() {
|
|||||||
u.syncDialogOpen = true
|
u.syncDialogOpen = true
|
||||||
u.syncMenuOpen = false
|
u.syncMenuOpen = false
|
||||||
u.showSyncPassword = false
|
u.showSyncPassword = false
|
||||||
|
u.syncDialogList.Position = layout.Position{}
|
||||||
u.syncDialogPurpose = syncDialogPurposeRemoteSetup
|
u.syncDialogPurpose = syncDialogPurposeRemoteSetup
|
||||||
u.syncSourceMode = syncSourceRemote
|
u.syncSourceMode = syncSourceRemote
|
||||||
u.syncDirection = syncDirectionPush
|
u.syncDirection = syncDirectionPush
|
||||||
@@ -5181,7 +5187,7 @@ func (u *ui) syncDialogContent(gtx layout.Context) layout.Dimensions {
|
|||||||
if len(u.syncRemoteCredentialClicks) < len(matchingCredentials) {
|
if len(u.syncRemoteCredentialClicks) < len(matchingCredentials) {
|
||||||
u.syncRemoteCredentialClicks = make([]widget.Clickable, len(matchingCredentials))
|
u.syncRemoteCredentialClicks = make([]widget.Clickable, len(matchingCredentials))
|
||||||
}
|
}
|
||||||
return material.List(u.theme, &u.lifecycleList).Layout(gtx, 1, func(gtx layout.Context, _ int) layout.Dimensions {
|
return material.List(u.theme, &u.syncDialogList).Layout(gtx, 1, func(gtx layout.Context, _ int) layout.Dimensions {
|
||||||
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||||
lbl := material.Label(u.theme, unit.Sp(20), u.syncDialogTitle())
|
lbl := material.Label(u.theme, unit.Sp(20), u.syncDialogTitle())
|
||||||
|
|||||||
@@ -6781,6 +6781,19 @@ func TestUIRemoteSyncSetupMatchingCredentialsUsesMatchingHost(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUIOpenRemoteSyncSetupDialogResetsDialogScrollPosition(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
u := newUIWithModel("desktop", vault.Model{})
|
||||||
|
u.syncDialogList.Position = layout.Position{First: 2, Offset: 48, BeforeEnd: true}
|
||||||
|
|
||||||
|
u.openRemoteSyncSetupDialog()
|
||||||
|
|
||||||
|
if got := u.syncDialogList.Position; got != (layout.Position{}) {
|
||||||
|
t.Fatalf("syncDialogList.Position = %#v, want zero position after opening setup dialog", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestUIAdvancedSyncMatchingRemoteCredentialEntriesUsesSavedBindingForCurrentVault(t *testing.T) {
|
func TestUIAdvancedSyncMatchingRemoteCredentialEntriesUsesSavedBindingForCurrentVault(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user