Skip to content

Commit

Permalink
[App -> Services] Move _CREDENTIAL_FILENAME to AppConstants.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogFeelings committed Aug 14, 2024
1 parent 2a0911d commit c28f3db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Source/Bluechirp.Library/Constants/AppConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ public static class AppConstants
/// The folder name used for the app's log folder.
/// </summary>
public const string LOG_FOLDER = "Logs";

/// <summary>
/// The filename used for the credentials storage file.
/// </summary>
public const string CREDENTIAL_FILENAME = "profiles.ebjson";
}
7 changes: 4 additions & 3 deletions Source/Bluechirp/Services/Security/CredentialService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#endregion

using Bluechirp.Library.Constants;
using Bluechirp.Library.Models;
using Bluechirp.Library.Services.Security;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
Expand All @@ -40,14 +42,13 @@ internal class CredentialService : ICredentialService

private Dictionary<string, ProfileCredentials> _profileCredentials;

private const string _CREDENTIAL_FILENAME = "profiles.ebjson";

public CredentialService(IEncryptionService encryptionService)
{
_encryptionService = encryptionService;
}

/// <inheritdoc/>
[MemberNotNull(nameof(_profileCredentials))]
public async Task LoadProfileDataAsync()
{
StorageFile profilesFile = await GetProfilesFileAsync();
Expand Down Expand Up @@ -116,7 +117,7 @@ public async Task RemoveProfileDataAsync(ProfileCredentials credentials)
private async Task<StorageFile> GetProfilesFileAsync()
{
StorageFolder folder = ApplicationData.Current.LocalFolder;
StorageFile profilesFile = await folder.CreateFileAsync(_CREDENTIAL_FILENAME, CreationCollisionOption.OpenIfExists);
StorageFile profilesFile = await folder.CreateFileAsync(AppConstants.CREDENTIAL_FILENAME, CreationCollisionOption.OpenIfExists);

return profilesFile;
}
Expand Down

0 comments on commit c28f3db

Please sign in to comment.