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); return DefWindowProcW(hwnd, uMsg, wParam, lParam);
} }
[UnconditionalSuppressMessage("", "CS0649")]
private readonly struct LPARAM2 private readonly struct LPARAM2
{ {
#pragma warning disable CS0649
public readonly uint Low; public readonly uint Low;
public readonly uint High; 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"; string userdataDbName = @"D:\Hutao\Userdata.db";
return AppDbContext.Create(default!, $"Data Source={userdataDbName}"); return AppDbContext.Create(default!, $"Data Source={userdataDbName}");
#else #else
throw Must.NeverHappen(); throw Core.ExceptionService.HutaoException.NotSupported();
#endif #endif
} }
} }

View File

@@ -48,29 +48,9 @@ internal sealed partial class DailyNoteNotificationOperation
return; return;
} }
string? attribution = SH.ServiceDailyNoteNotifierAttribution; string attribution = entry.UserGameRole is not null
? entry.UserGameRole.ToString()
if (entry.UserGameRole is not null) : await GetUserUidAsync(entry).ConfigureAwait(false);
{
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;
}
}
ToastContentBuilder builder = new ToastContentBuilder() ToastContentBuilder builder = new ToastContentBuilder()
.AddHeader(ToastHeaderIdArgument, SH.ServiceDailyNoteNotifierTitle, ToastHeaderIdArgument) .AddHeader(ToastHeaderIdArgument, SH.ServiceDailyNoteNotifierTitle, ToastHeaderIdArgument)
@@ -130,4 +110,24 @@ internal sealed partial class DailyNoteNotificationOperation
// Prevent notify when we are in game && silent mode. // Prevent notify when we are in game && silent mode.
return options.IsSilentWhenPlayingGame && gameService.IsGameRunning(); 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>(); context.Invoke<ExpeditionNotifySuppressionChecker>();
} }
[SuppressMessage("", "CA1859")]
private static void Invoke<T>(this INotifySuppressionContext context) private static void Invoke<T>(this INotifySuppressionContext context)
where T : INotifySuppressionChecker, new() where T : INotifySuppressionChecker, new()
{ {

View File

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

View File

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