Migration plan v1
This commit is contained in:
@@ -479,8 +479,8 @@ public partial class App : WinoApplication,
|
||||
|
||||
EnsureAppNotificationRegistration();
|
||||
|
||||
await Services.GetRequiredService<ReleaseLocalAccountDataCleanupService>()
|
||||
.RunIfNeededAsync();
|
||||
await Services.GetRequiredService<ILegacyLocalMigrationService>()
|
||||
.DetectAsync();
|
||||
|
||||
await InitializeServicesAsync();
|
||||
|
||||
@@ -490,6 +490,9 @@ public partial class App : WinoApplication,
|
||||
|
||||
_hasConfiguredAccounts = (await _accountService.GetAccountsAsync()).Any();
|
||||
|
||||
await Services.GetRequiredService<ReleaseLocalAccountDataCleanupService>()
|
||||
.RunIfNeededAsync();
|
||||
|
||||
_activationInfrastructureInitialized = true;
|
||||
}
|
||||
finally
|
||||
@@ -1502,7 +1505,9 @@ public partial class App : WinoApplication,
|
||||
|
||||
Services.GetRequiredService<IMailDialogService>().InfoBarMessage(
|
||||
Translator.GeneralTitle_Info,
|
||||
Translator.WinoAccount_Management_ImportReloginReminder,
|
||||
string.IsNullOrWhiteSpace(message.CompletionMessage)
|
||||
? Translator.WinoAccount_Management_ImportReloginReminder
|
||||
: message.CompletionMessage,
|
||||
InfoBarMessageType.Information);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Wino.Mail.WinUI.Services;
|
||||
public sealed class ReleaseLocalAccountDataCleanupService
|
||||
{
|
||||
private const string CleanupCompletedSettingKey = "ReleaseLocalAccountDataCleanup_v1_Completed";
|
||||
private const string LegacyDatabaseFileName = "Wino180.db";
|
||||
|
||||
private readonly IConfigurationService _configurationService;
|
||||
private readonly IApplicationConfiguration _applicationConfiguration;
|
||||
@@ -29,7 +28,6 @@ public sealed class ReleaseLocalAccountDataCleanupService
|
||||
return;
|
||||
|
||||
var localFolderPath = _applicationConfiguration.ApplicationDataFolderPath;
|
||||
var publisherPath = _applicationConfiguration.PublisherSharedFolderPath;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(localFolderPath) || !Directory.Exists(localFolderPath))
|
||||
{
|
||||
@@ -41,8 +39,7 @@ public sealed class ReleaseLocalAccountDataCleanupService
|
||||
{
|
||||
Path.Combine(localFolderPath, "Mime"),
|
||||
Path.Combine(localFolderPath, "contacts"),
|
||||
Path.Combine(localFolderPath, "CalendarAttachments"),
|
||||
Path.Combine(publisherPath, LegacyDatabaseFileName)
|
||||
Path.Combine(localFolderPath, "CalendarAttachments")
|
||||
};
|
||||
|
||||
foreach (var targetPath in cleanupTargets)
|
||||
|
||||
@@ -221,6 +221,25 @@
|
||||
<SymbolIcon Symbol="Account" />
|
||||
</winuiControls:SettingsCard.HeaderIcon>
|
||||
</winuiControls:SettingsCard>
|
||||
<winuiControls:SettingsCard
|
||||
Description="{x:Bind ViewModel.LegacyMigrationSummary, Mode=OneWay}"
|
||||
Header="{x:Bind domain:Translator.LegacyLocalMigration_SettingsSectionTitle, Mode=OneTime}"
|
||||
Visibility="{x:Bind ViewModel.HasLegacyImportAvailable, Mode=OneWay}">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind ViewModel.LegacyMigrationWarningSummary, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords"
|
||||
Visibility="{x:Bind ViewModel.HasLegacyImportWarnings, Mode=OneWay}" />
|
||||
<Button
|
||||
Command="{x:Bind ViewModel.ImportLegacyDatabaseCommand}"
|
||||
Content="{x:Bind domain:Translator.LegacyLocalMigration_ImportAction, Mode=OneTime}" />
|
||||
</StackPanel>
|
||||
<winuiControls:SettingsCard.HeaderIcon>
|
||||
<SymbolIcon Symbol="Sync" />
|
||||
</winuiControls:SettingsCard.HeaderIcon>
|
||||
</winuiControls:SettingsCard>
|
||||
<winuiControls:SettingsCard Description="{x:Bind domain:Translator.WinoAccount_Management_LocalDataSectionDescription}" Header="{x:Bind domain:Translator.WinoAccount_Management_LocalDataSectionTitle}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Button Command="{x:Bind ViewModel.ImportLocalDataCommand}" Content="{x:Bind domain:Translator.WinoAccount_Management_LocalDataImportAction}" />
|
||||
|
||||
@@ -15,21 +15,43 @@
|
||||
MaxWidth="900"
|
||||
Padding="20"
|
||||
HorizontalAlignment="Stretch">
|
||||
<winuiControls:SettingsCard
|
||||
Description="{x:Bind domain:Translator.WinoAccount_Management_LocalDataSectionDescription}"
|
||||
Header="{x:Bind domain:Translator.WinoAccount_Management_LocalDataSectionTitle}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Button
|
||||
Command="{x:Bind ViewModel.ImportLocalDataCommand}"
|
||||
Content="{x:Bind domain:Translator.WinoAccount_Management_LocalDataImportAction}" />
|
||||
<Button
|
||||
Command="{x:Bind ViewModel.ExportLocalDataCommand}"
|
||||
Content="{x:Bind domain:Translator.WinoAccount_Management_LocalDataExportAction}" />
|
||||
</StackPanel>
|
||||
<winuiControls:SettingsCard.HeaderIcon>
|
||||
<SymbolIcon Symbol="Sync" />
|
||||
</winuiControls:SettingsCard.HeaderIcon>
|
||||
</winuiControls:SettingsCard>
|
||||
<StackPanel Spacing="12">
|
||||
<winuiControls:SettingsCard
|
||||
Description="{x:Bind ViewModel.LegacyMigrationSummary, Mode=OneWay}"
|
||||
Header="{x:Bind domain:Translator.LegacyLocalMigration_SettingsSectionTitle, Mode=OneTime}"
|
||||
Visibility="{x:Bind ViewModel.HasLegacyImportAvailable, Mode=OneWay}">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind ViewModel.LegacyMigrationWarningSummary, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords"
|
||||
Visibility="{x:Bind ViewModel.HasLegacyImportWarnings, Mode=OneWay}" />
|
||||
<Button
|
||||
Command="{x:Bind ViewModel.ImportLegacyDatabaseCommand}"
|
||||
Content="{x:Bind domain:Translator.LegacyLocalMigration_ImportAction, Mode=OneTime}" />
|
||||
</StackPanel>
|
||||
<winuiControls:SettingsCard.HeaderIcon>
|
||||
<SymbolIcon Symbol="Sync" />
|
||||
</winuiControls:SettingsCard.HeaderIcon>
|
||||
</winuiControls:SettingsCard>
|
||||
|
||||
<winuiControls:SettingsCard
|
||||
Description="{x:Bind domain:Translator.WinoAccount_Management_LocalDataSectionDescription}"
|
||||
Header="{x:Bind domain:Translator.WinoAccount_Management_LocalDataSectionTitle}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Button
|
||||
Command="{x:Bind ViewModel.ImportLocalDataCommand}"
|
||||
Content="{x:Bind domain:Translator.WinoAccount_Management_LocalDataImportAction}" />
|
||||
<Button
|
||||
Command="{x:Bind ViewModel.ExportLocalDataCommand}"
|
||||
Content="{x:Bind domain:Translator.WinoAccount_Management_LocalDataExportAction}" />
|
||||
</StackPanel>
|
||||
<winuiControls:SettingsCard.HeaderIcon>
|
||||
<SymbolIcon Symbol="Sync" />
|
||||
</winuiControls:SettingsCard.HeaderIcon>
|
||||
</winuiControls:SettingsCard>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</abstract:ManageAccountsPageAbstract>
|
||||
|
||||
@@ -127,6 +127,40 @@
|
||||
Grid.Row="3"
|
||||
MaxWidth="600"
|
||||
HorizontalAlignment="Center">
|
||||
<Border
|
||||
Margin="0,0,0,16"
|
||||
Padding="16"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{ThemeResource CardBackgroundFillColorSecondaryBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="12"
|
||||
Visibility="{x:Bind ViewModel.HasLegacyImportPreview, Mode=OneWay}">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Text="{x:Bind domain:Translator.LegacyLocalMigration_WelcomeSectionTitle, Mode=OneTime}" />
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind domain:Translator.LegacyLocalMigration_WelcomeSectionDescription, Mode=OneTime}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
<TextBlock
|
||||
Text="{x:Bind ViewModel.LegacyImportSummary, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind ViewModel.LegacyImportWarnings, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords"
|
||||
Visibility="{x:Bind ViewModel.HasLegacyImportWarnings, Mode=OneWay}" />
|
||||
<Button
|
||||
HorizontalAlignment="Left"
|
||||
Command="{x:Bind ViewModel.ImportLegacyDatabaseCommand}"
|
||||
Content="{x:Bind domain:Translator.LegacyLocalMigration_ImportAction, Mode=OneTime}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<HyperlinkButton
|
||||
HorizontalAlignment="Center"
|
||||
Command="{x:Bind ViewModel.ImportFromWinoAccountCommand}"
|
||||
|
||||
Reference in New Issue
Block a user