Skip to content

Commit

Permalink
User notify ready to fly
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Sep 21, 2024
1 parent 6c53e59 commit a4cf762
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ CancellationToken cancellationToken
var section = configuration.GetHandlerSection("UserNotify", request!, requestHandler);
if (section == null)
return await next().ConfigureAwait(false);


var key = CultureInfo.CurrentUICulture.Name;
// TODO: if key for locale not found, default somehow?
var locale = section.GetSection(key);
if (!locale.Exists())
{
locale = section.GetSection("*");
if (!locale.Exists())
logger.LogError("No locale found for {RequestType}", typeof(TRequest).FullName);
}

var result = default(TResult);
try
Expand All @@ -35,15 +40,13 @@ CancellationToken cancellationToken
}
catch (Exception ex)
{
logger.LogError(ex, $"Error executing pipeline for {typeof(TRequest).FullName}");
// try
// {
// var msg = config.ShowFullException ? ex.ToString() : attribute.ErrorMessage ?? config.ErrorMessage;
// await Application.Current!.MainPage!.DisplayAlert(attribute.ErrorTitle ?? config.ErrorTitle, msg, config.ErrorConfirm);
// }
// catch
// {
// }
logger.LogError(ex, "Error executing pipeline for {Error}", typeof(TRequest).FullName);
if (locale.Exists())
{
var title = locale.GetValue<string>("Title", "ERROR");
var msg = locale.GetValue<string>("Message", "An error occurred with your request");
alerts.Display(title!, msg!);
}
}

return result!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ namespace Shiny.Mediator.Infrastructure;
public class AlertDialogService(IJSRuntime jsRuntime) : IAlertDialogService
{
public void Display(string title, string message)
{
throw new NotImplementedException();
}
=> ((IJSInProcessRuntime)jsRuntime).InvokeVoid("alert", $"{title}\n{message}");
}
4 changes: 1 addition & 3 deletions src/Shiny.Mediator.Maui/Infrastructure/AlertDialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ namespace Shiny.Mediator.Infrastructure;
public class AlertDialogService : IAlertDialogService
{
public void Display(string title, string message)
{
throw new NotImplementedException();
}
=> Application.Current.MainPage.DisplayAlert(title, message, "OK");
}

0 comments on commit a4cf762

Please sign in to comment.