Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toast #25580

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Templates/src/templates/maui-mobile/AppShell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ public static async Task DisplaySnackbarAsync(string message)
await snackbar.Show(cancellationTokenSource.Token);
}

#if WINDOWS
public static Task DisplayToastAsync(string message)
{
// Toast is currently not working in MCT on Windows
return Task.CompletedTask;
}
#else
public static async Task DisplayToastAsync(string message)
{
var toast = Toast.Make(message, textSize: 18);

var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
await toast.Show(cts.Token);
}
#endif

private void SfSegmentedControl_SelectionChanged(object sender, Syncfusion.Maui.Toolkit.SegmentedControl.SelectionChangedEventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ private async Task AddTag()
private async Task Reset()
{
Preferences.Default.Remove("is_seeded");
await Shell.Current.GoToAsync("//main");
await _seedDataService.LoadSeedDataAsync();
Preferences.Default.Set("is_seeded", true);
await Shell.Current.GoToAsync("//main");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private async Task Save()
_project.Name = Name;
_project.Description = Description;
_project.CategoryID = Category?.ID ?? 0;
_project.Icon = Icon;
_project.Icon = Icon ?? FluentUI.ribbon_24_regular;
await _projectRepository.SaveItemAsync(_project);

if (_project.IsNullOrNew())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ private async Task LoadTaskAsync(IDictionary<string, object> query)
}

// If the project is new, we don't need to load the project dropdown
if (Project is not null && Project.ID != 0)
{
Projects = await _projectRepository.ListAsync();
IsExistingProject = true;
if (Project?.ID == 0)
{
IsExistingProject = false;
}
else
{
IsExistingProject = false;
{
Projects = await _projectRepository.ListAsync();
IsExistingProject = true;
}

if (Project is not null)
Expand Down Expand Up @@ -142,7 +142,7 @@ private async Task Save()
Project.Tasks.Add(_task);

if (_task.ProjectID > 0)
_ = _taskRepository.SaveItemAsync(_task);
_taskRepository.SaveItemAsync(_task).FireAndForgetSafeAsync(_errorHandler);

await Shell.Current.GoToAsync("..?refresh=true");

Expand Down