fix build

This commit is contained in:
Lightczx
2024-05-24 14:58:36 +08:00
parent f71a2a3d40
commit e15c06a194
6 changed files with 29 additions and 27 deletions

View File

@@ -143,10 +143,11 @@ internal sealed class NotifyIconMessageWindow : IDisposable
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
[UnconditionalSuppressMessage("", "CS0649")]
private readonly struct LPARAM2
{
#pragma warning disable CS0649
public readonly uint Low;
public readonly uint High;
#pragma warning restore CS0649
}
}

View File

@@ -20,7 +20,7 @@ internal sealed class AppDbContextDesignTimeFactory : IDesignTimeDbContextFactor
string userdataDbName = @"D:\Hutao\Userdata.db";
return AppDbContext.Create(default!, $"Data Source={userdataDbName}");
#else
throw Must.NeverHappen();
throw Core.ExceptionService.HutaoException.NotSupported();
#endif
}
}

View File

@@ -48,29 +48,9 @@ internal sealed partial class DailyNoteNotificationOperation
return;
}
string? attribution = SH.ServiceDailyNoteNotifierAttribution;
if (entry.UserGameRole is not null)
{
attribution = entry.UserGameRole.ToString();
}
else
{
Response<ListWrapper<UserGameRole>> rolesResponse;
using (IServiceScope scope = serviceScopeFactory.CreateScope())
{
BindingClient bindingClient = scope.ServiceProvider.GetRequiredService<BindingClient>();
rolesResponse = await bindingClient
.GetUserGameRolesOverseaAwareAsync(entry.User)
.ConfigureAwait(false);
}
if (rolesResponse.IsOk())
{
List<UserGameRole> roles = rolesResponse.Data.List;
attribution = roles.SingleOrDefault(r => r.GameUid == entry.Uid)?.ToString() ?? ToastAttributionUnknown;
}
}
string attribution = entry.UserGameRole is not null
? entry.UserGameRole.ToString()
: await GetUserUidAsync(entry).ConfigureAwait(false);
ToastContentBuilder builder = new ToastContentBuilder()
.AddHeader(ToastHeaderIdArgument, SH.ServiceDailyNoteNotifierTitle, ToastHeaderIdArgument)
@@ -130,4 +110,24 @@ internal sealed partial class DailyNoteNotificationOperation
// Prevent notify when we are in game && silent mode.
return options.IsSilentWhenPlayingGame && gameService.IsGameRunning();
}
private async ValueTask<string> GetUserUidAsync(DailyNoteEntry entry)
{
Response<ListWrapper<UserGameRole>> rolesResponse;
using (IServiceScope scope = serviceScopeFactory.CreateScope())
{
BindingClient bindingClient = scope.ServiceProvider.GetRequiredService<BindingClient>();
rolesResponse = await bindingClient
.GetUserGameRolesOverseaAwareAsync(entry.User)
.ConfigureAwait(false);
}
if (rolesResponse.IsOk())
{
List<UserGameRole> roles = rolesResponse.Data.List;
return roles.SingleOrDefault(r => r.GameUid == entry.Uid)?.ToString() ?? ToastAttributionUnknown;
}
return SH.ServiceDailyNoteNotifierAttribution;
}
}

View File

@@ -18,6 +18,7 @@ internal static class NotifySuppressionInvoker
context.Invoke<ExpeditionNotifySuppressionChecker>();
}
[SuppressMessage("", "CA1859")]
private static void Invoke<T>(this INotifySuppressionContext context)
where T : INotifySuppressionChecker, new()
{

View File

@@ -59,7 +59,7 @@ internal sealed partial class GachaStatisticsFactory : IGachaStatisticsFactory
HomaGachaLogClient gachaLogClient,
List<Model.Entity.GachaItem> items,
List<HistoryWishBuilder> historyWishBuilders,
in GachaLogServiceMetadataContext context,
GachaLogServiceMetadataContext context,
AppOptions appOptions)
{
TypedWishSummaryBuilderContext standardContext = TypedWishSummaryBuilderContext.StandardWish(taskContext, gachaLogClient);

View File

@@ -191,7 +191,7 @@ internal class MiHoYoJSBridge
Data = new()
{
["language"] = cultureOptions.LanguageCode,
["timeZone"] = $"GMT{(offset.Hours >= 0 ? "+" : " - ")}{offset.Hours:D1}",
["timeZone"] = $"GMT{(offset.Hours >= 0 ? "+" : " - ")}{Math.Abs(offset.Hours):D1}",
},
};
}