Skip to content

Commit

Permalink
mobile test version
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhiogo Acioli committed Oct 1, 2022
1 parent 92036b5 commit 958adb3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
31 changes: 19 additions & 12 deletions src/VerusDate.Web/Pages/ProfilePrincipal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,30 @@

protected override async Task LoadData()
{
if (ComponenteUtils.IsAuthenticated)
try
{
principal = await Http.Principal_Get(SessionStorage);
if (ComponenteUtils.IsAuthenticated)
{
principal = await Http.Principal_Get(SessionStorage);

if (principal == null) principal = new();
if (principal == null) principal = new();

var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

if (authState != null)
{
principal.UserId = authState.User.Claims.FirstOrDefault(w => w.Type == ClaimTypes.NameIdentifier)?.Value;
principal.IdentityProvider = authState.User.Identity?.AuthenticationType;
principal.UserDetails = authState.User.Identity?.Name;
principal.UserRoles = authState.User.Claims.Where(w => w.Type == ClaimTypes.Role)?.Select(s => s.Value).ToArray();
}
if (authState != null)
{
principal.UserId = authState.User.Claims.FirstOrDefault(w => w.Type == ClaimTypes.NameIdentifier)?.Value;
principal.IdentityProvider = authState.User.Identity?.AuthenticationType;
principal.UserDetails = authState.User.Identity?.Name;
principal.UserRoles = authState.User.Claims.Where(w => w.Type == ClaimTypes.Role)?.Select(s => s.Value).ToArray();
}

principal.Email = principal.UserDetails;
principal.Email = principal.UserDetails;
}
}
catch (Exception ex)
{
ex.ProcessException(Toast, Logger);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/VerusDate.Web/Resources/BuildDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30/09/2022
01/10/2022
34 changes: 27 additions & 7 deletions src/VerusDate.Web/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</BarStart>
</BarMenu>
<Div Style="bottom: 10px; position: absolute; width: 100%;" TextAlignment="TextAlignment.Center">
<Badge Color="Color.Primary" Pill="true">@BuildDateString</Badge>
<Badge Color="Color.Primary" Pill="true">@BuildDateString()</Badge>
</Div>
</Bar>

Expand All @@ -75,17 +75,37 @@
protected async Task LoadData()
{
if (ComponenteUtils.IsAuthenticated)
try
{
profile = await Http.Profile_Get(SessionStorage);

if (profile != null)
if (ComponenteUtils.IsAuthenticated)
{
MainPhoto = profile.GetMainPhoto();
profile = await Http.Profile_Get(SessionStorage);

if (profile != null)
{
MainPhoto = profile.GetMainPhoto();
}
}
}
catch (Exception ex)
{
ex.ProcessException(Toast, Logger);
}
}

//https://swharden.com/blog/2020-12-29-blazor-build-info/
private string BuildDateString => DateTime.Parse(Properties.Resources.BuildDate.ReplaceLineEndings("").Remove(Properties.Resources.BuildDate.ReplaceLineEndings("").Length - 3, 3)).ToString("yyyy.MM.dd");
private string BuildDateString()
{
try
{
return DateTime
.Parse(Properties.Resources.BuildDate.ReplaceLineEndings("").Remove(Properties.Resources.BuildDate.ReplaceLineEndings("").Length - 3, 3))
.ToString("yyyy.MM.dd");
}
catch (Exception ex)
{
ex.ProcessException(Toast, Logger);
return "Version Error";
}
}
}

0 comments on commit 958adb3

Please sign in to comment.