-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement authentication handling and view navigation
Signed-off-by: Russell Camo <[email protected]>
- Loading branch information
Showing
29 changed files
with
379 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2023 Russell Camo (Russkyc).- All Rights Reserved | ||
// | ||
// Unauthorized copying or redistribution of all files, in source and binary forms via any medium | ||
// without written, signed consent from the author is strictly prohibited. | ||
|
||
namespace GroomWise.Application.Enums; | ||
|
||
public enum NavigationPage | ||
{ | ||
Login, | ||
Main | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,43 @@ | ||
// Copyright (C) 2023 Russell Camo (Russkyc).- All Rights Reserved | ||
// | ||
// | ||
// Unauthorized copying or redistribution of all files, in source and binary forms via any medium | ||
// without written, signed consent from the author is strictly prohibited. | ||
|
||
using GroomWise.Application.Enums; | ||
using GroomWise.Domain.Interfaces; | ||
using GroomWise.Infrastructure.Authentication.Enums; | ||
using GroomWise.Infrastructure.Authentication.Interfaces; | ||
using GroomWise.Infrastructure.Navigation; | ||
using MvvmGen; | ||
|
||
namespace GroomWise.Application.ViewModels; | ||
|
||
public class AppViewModel | ||
[Inject(typeof(IAuthenticationService))] | ||
[Inject(typeof(IDialogFactory))] | ||
[ViewModel] | ||
[ViewModelGenerateInterface] | ||
public partial class AppViewModel | ||
{ | ||
|
||
} | ||
[Command] | ||
private async Task Logout() | ||
{ | ||
await Task.Run(async () => | ||
{ | ||
var dialogResult = DialogFactory.Create( | ||
"GroomWise", | ||
"Are you sure you want to log out?" | ||
); | ||
if (dialogResult == true) | ||
{ | ||
var result = AuthenticationService.Logout(); | ||
await Task.Delay(500); | ||
if (result.Equals(AuthenticationStatus.NotAuthenticated)) | ||
{ | ||
NavigationService.Instance?.Navigate(NavigationPage.Login); | ||
} | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2023 Russell Camo (Russkyc).- All Rights Reserved | ||
// | ||
// Unauthorized copying or redistribution of all files, in source and binary forms via any medium | ||
// without written, signed consent from the author is strictly prohibited. | ||
|
||
namespace GroomWise.Domain.Enums; | ||
|
||
public enum Role | ||
{ | ||
Admin, | ||
Manager, | ||
Groomer, | ||
User, | ||
Custom | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2023 Russell Camo (Russkyc).- All Rights Reserved | ||
// | ||
// Unauthorized copying or redistribution of all files, in source and binary forms via any medium | ||
// without written, signed consent from the author is strictly prohibited. | ||
|
||
namespace GroomWise.Domain.Enums; | ||
|
||
public enum ViewIdentifier | ||
{ | ||
Login, | ||
Main | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (C) 2023 Russell Camo (Russkyc).- All Rights Reserved | ||
// | ||
// Unauthorized copying or redistribution of all files, in source and binary forms via any medium | ||
// without written, signed consent from the author is strictly prohibited. | ||
|
||
namespace GroomWise.Domain.Interfaces; | ||
|
||
public interface IDialogFactory | ||
{ | ||
bool? Create(string messageBoxText, string caption); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
GroomWise.Infrastructure/Authentication/Enums/UpdateStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (C) 2023 Russell Camo (Russkyc).- All Rights Reserved | ||
// | ||
// Unauthorized copying or redistribution of all files, in source and binary forms via any medium | ||
// without written, signed consent from the author is strictly prohibited. | ||
|
||
namespace GroomWise.Infrastructure.Authentication.Enums; | ||
|
||
public enum UpdateStatus | ||
{ | ||
InvalidAccount, | ||
Success, | ||
Fail | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,12 @@ | |
<None Remove=".env" /> | ||
</ItemGroup> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</Project> |
15 changes: 15 additions & 0 deletions
15
GroomWise.Infrastructure/Navigation/Interfaces/INavigationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2023 Russell Camo (Russkyc).- All Rights Reserved | ||
// | ||
// Unauthorized copying or redistribution of all files, in source and binary forms via any medium | ||
// without written, signed consent from the author is strictly prohibited. | ||
|
||
namespace GroomWise.Infrastructure.Navigation.Interfaces; | ||
|
||
public interface INavigationService | ||
{ | ||
static INavigationService Instance { get; } | ||
Check warning on line 10 in GroomWise.Infrastructure/Navigation/Interfaces/INavigationService.cs
|
||
IWindow CurrentWindow { get; } | ||
void Add(Enum key, IWindow instance); | ||
void Add(Enum key, IPage instance); | ||
void Navigate(Enum key); | ||
} |
Oops, something went wrong.