Skip to content

Commit fe362ca

Browse files
committed
Apply code review
1 parent 274f7ac commit fe362ca

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/Sdk/SecureFolderFS.Sdk/ViewModels/Views/Credentials/CredentialsSelectionViewModel.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
using CommunityToolkit.Mvvm.ComponentModel;
1+
using System;
2+
using System.Collections.ObjectModel;
3+
using System.ComponentModel;
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
using CommunityToolkit.Mvvm.ComponentModel;
27
using CommunityToolkit.Mvvm.Input;
38
using OwlCore.Storage;
49
using SecureFolderFS.Sdk.Attributes;
@@ -9,12 +14,6 @@
914
using SecureFolderFS.Shared;
1015
using SecureFolderFS.Shared.ComponentModel;
1116
using SecureFolderFS.Shared.Extensions;
12-
using System;
13-
using System.Collections.ObjectModel;
14-
using System.ComponentModel;
15-
using System.Linq;
16-
using System.Threading;
17-
using System.Threading.Tasks;
1817
using SecureFolderFS.Shared.Models;
1918

2019
namespace SecureFolderFS.Sdk.ViewModels.Views.Credentials

src/Sdk/SecureFolderFS.Sdk/ViewModels/Views/Overlays/CredentialsOverlayViewModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ private void LoginViewModel_VaultUnlocked(object? sender, VaultUnlockedEventArgs
9999

100100
// Seed the register sequence with the already-authenticated first-stage key
101101
// so that when a second-stage method is added, the combined passkey is complete
102-
foreach (var key in _loginKeySequence.Keys)
103-
_registerKeySequence.SetOrAdd(0, key); // First-stage lives at index 0
102+
var firstStageKey = _loginKeySequence.Keys.FirstOrDefault();
103+
if (firstStageKey is not null)
104+
_registerKeySequence.SetOrAdd(0, firstStageKey); // First-stage lives at index 0
104105

105106
SelectionViewModel.RegisterViewModel = RegisterViewModel;
106107
SelectedViewModel = SelectionViewModel;
@@ -130,6 +131,7 @@ public void Dispose()
130131
(SelectedViewModel as IDisposable)?.Dispose();
131132
SelectionViewModel.Dispose();
132133
LoginViewModel.Dispose();
134+
RegisterViewModel.Dispose();
133135
_loginKeySequence.Dispose();
134136
_registerKeySequence.Dispose();
135137
}

0 commit comments

Comments
 (0)