-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #318 from LiamMorrow/backup-alerts
- Loading branch information
Showing
11 changed files
with
171 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
@inherits Fluxor.Blazor.Web.Components.FluxorComponent | ||
|
||
@inject IState<SettingsState> SettingsState | ||
@inject IDispatcher Dispatcher | ||
|
||
<Dialog @ref="dialog" @ondialog-cancel="No" type="alert"> | ||
<span slot="headline">Back up data</span> | ||
<span slot="content" class="block text-left"> | ||
It has been a while since you last created a backup. It is HIGHLY recommended you back up your data regularly to prevent data loss. | ||
Would you like to back up your data now? | ||
</span> | ||
<div slot="actions"> | ||
<AppButton Type="AppButtonType.Text" OnClick="DontAsk">Don't ask again</AppButton> | ||
<AppButton Type="AppButtonType.Text" OnClick="No">No</AppButton> | ||
<AppButton Type="AppButtonType.Text" OnClick="BackUp">Yes</AppButton> | ||
</div> | ||
</Dialog> | ||
|
||
@code { | ||
private Dialog? dialog; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
base.OnInitialized(); | ||
|
||
} | ||
|
||
protected override void OnAfterRender(bool firstRender) | ||
{ | ||
base.OnAfterRender(firstRender); | ||
if (firstRender) | ||
{ | ||
var lastBackupTime = SettingsState.Value.LastBackupTime; | ||
var timeSinceLastBackup = DateTimeOffset.Now - lastBackupTime; | ||
if (SettingsState.Value.BackupReminder && timeSinceLastBackup.TotalDays > 7) | ||
{ | ||
dialog?.Open(); | ||
} | ||
} | ||
} | ||
|
||
private void DontAsk() | ||
{ | ||
Dispatcher.Dispatch(new SetBackupReminderAction(false)); | ||
dialog?.Close(); | ||
} | ||
|
||
private void No() | ||
{ | ||
dialog?.Close(); | ||
} | ||
|
||
private async Task BackUp() | ||
{ | ||
await dialog!.CloseWait(); | ||
Dispatcher.Dispatch(new NavigateAction("/settings/backup-and-restore?backup=true")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters