mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Merge pull request #1581 from DGP-Studio/feat/custom_sa_homa_not_login_dialog
This commit is contained in:
@@ -1361,6 +1361,18 @@
|
||||
<data name="ViewDialogSettingDeleteUserDataTitle" xml:space="preserve">
|
||||
<value>是否永久删除用户数据</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginCloseButtonText" xml:space="preserve">
|
||||
<value>前往登录</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginHint" xml:space="preserve">
|
||||
<value>当前未登录胡桃账号,上传深渊数据无法获赠胡桃云时长</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginPrimaryButtonText" xml:space="preserve">
|
||||
<value>继续上传</value>
|
||||
</data>
|
||||
<data name="ViewDialogSpiralAbyssUploadRecordHomaNotLoginTitle" xml:space="preserve">
|
||||
<value>上传深渊数据</value>
|
||||
</data>
|
||||
<data name="ViewDialogUpdatePackageDownloadUpdatelogLinkContent" xml:space="preserve">
|
||||
<value>查看更新日志</value>
|
||||
</data>
|
||||
@@ -1733,12 +1745,6 @@
|
||||
<data name="ViewModelSettingSetGamePathDatabaseFailedTitle" xml:space="preserve">
|
||||
<value>保存游戏路径失败</value>
|
||||
</data>
|
||||
<data name="ViewModelSpiralAbyssUploadRecordHomaNotLoginContent" xml:space="preserve">
|
||||
<value>当前未登录胡桃账号,上传深渊数据无法获赠胡桃云时长</value>
|
||||
</data>
|
||||
<data name="ViewModelSpiralAbyssUploadRecordHomaNotLoginTitle" xml:space="preserve">
|
||||
<value>上传深渊数据</value>
|
||||
</data>
|
||||
<data name="ViewModelUserAdded" xml:space="preserve">
|
||||
<value>用户 [{0}] 添加成功</value>
|
||||
</data>
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
<None Remove="View\Dialog\LaunchGameConfigurationFixDialog.xaml" />
|
||||
<None Remove="View\Dialog\LaunchGamePackageConvertDialog.xaml" />
|
||||
<None Remove="View\Dialog\ReconfirmDialog.xaml" />
|
||||
<None Remove="View\Dialog\SpiralAbyssUploadRecordHomaNotLoginDialog.xaml" />
|
||||
<None Remove="View\Dialog\UpdatePackageDownloadConfirmDialog.xaml" />
|
||||
<None Remove="View\Dialog\UserDialog.xaml" />
|
||||
<None Remove="View\Dialog\UserQRCodeDialog.xaml" />
|
||||
@@ -354,6 +355,11 @@
|
||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnablePreviewMsixTooling)'=='true'">
|
||||
<ProjectCapability Include="Msix" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\SpiralAbyssUploadRecordHomaNotLoginDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\UpdatePackageDownloadConfirmDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<ContentDialog
|
||||
x:Class="Snap.Hutao.View.Dialog.SpiralAbyssUploadRecordHomaNotLoginDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||
Title="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginTitle}"
|
||||
CloseButtonText="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginCloseButtonText}"
|
||||
DefaultButton="Close"
|
||||
PrimaryButtonText="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginPrimaryButtonText}"
|
||||
Style="{StaticResource DefaultContentDialogStyle}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<TextBlock Text="{shcm:ResourceString Name=ViewDialogSpiralAbyssUploadRecordHomaNotLoginHint}"/>
|
||||
</ContentDialog>
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Snap.Hutao.View.Dialog;
|
||||
|
||||
internal sealed partial class SpiralAbyssUploadRecordHomaNotLoginDialog : ContentDialog
|
||||
{
|
||||
private readonly ITaskContext taskContext;
|
||||
|
||||
public SpiralAbyssUploadRecordHomaNotLoginDialog(IServiceProvider serviceProvider)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
|
||||
}
|
||||
|
||||
public async ValueTask<bool> ConfirmAsync()
|
||||
{
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
return await ShowAsync() is ContentDialogResult.Primary;
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,12 @@ using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
using Snap.Hutao.Message;
|
||||
using Snap.Hutao.Service.Hutao;
|
||||
using Snap.Hutao.Service.Navigation;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.Service.SpiralAbyss;
|
||||
using Snap.Hutao.Service.User;
|
||||
using Snap.Hutao.View.Dialog;
|
||||
using Snap.Hutao.View.Page;
|
||||
using Snap.Hutao.ViewModel.Complex;
|
||||
using Snap.Hutao.ViewModel.User;
|
||||
using Snap.Hutao.Web.Hutao.Response;
|
||||
@@ -29,6 +32,7 @@ internal sealed partial class SpiralAbyssRecordViewModel : Abstraction.ViewModel
|
||||
private readonly ISpiralAbyssRecordService spiralAbyssRecordService;
|
||||
private readonly IContentDialogFactory contentDialogFactory;
|
||||
private readonly HutaoSpiralAbyssClient spiralAbyssClient;
|
||||
private readonly INavigationService navigationService;
|
||||
private readonly IInfoBarService infoBarService;
|
||||
private readonly ITaskContext taskContext;
|
||||
private readonly IUserService userService;
|
||||
@@ -135,12 +139,14 @@ internal sealed partial class SpiralAbyssRecordViewModel : Abstraction.ViewModel
|
||||
{
|
||||
if (!hutaoUserOptions.IsLoggedIn)
|
||||
{
|
||||
ContentDialogResult result = await contentDialogFactory
|
||||
.CreateForConfirmCancelAsync(SH.ViewModelSpiralAbyssUploadRecordHomaNotLoginTitle, SH.ViewModelSpiralAbyssUploadRecordHomaNotLoginContent)
|
||||
SpiralAbyssUploadRecordHomaNotLoginDialog dialog = await contentDialogFactory
|
||||
.CreateInstanceAsync<SpiralAbyssUploadRecordHomaNotLoginDialog>()
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (result is not ContentDialogResult.Primary)
|
||||
if (!await dialog.ConfirmAsync().ConfigureAwait(false))
|
||||
{
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
await navigationService.NavigateAsync<SettingPage>(INavigationAwaiter.Default, true).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user