From 9cabfd15ba8b5cc708e1932ea27c69c4f4867b75 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Sun, 18 Aug 2024 23:35:47 +0200 Subject: [PATCH] Make iOS StatusBarBehavior more robust and not throw exceptions (#2128) * Update StatusBar.ios.cs * Rename to `TryUpdateStatusBarAppearance` Since it it no longer guaranteed that the status bar will update we will prepend the method name with `Try` and return a `bool` noting its success. We will also print to `Trace.WriteLine` the status when it fails * Fix StatusBarBehaviorPage bug --------- Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> --- .../Behaviors/StatusBarBehaviorPage.xaml | 6 +- .../Behaviors/StatusBarBehaviorViewModel.cs | 2 +- .../Platform/StatusBar/StatusBar.ios.cs | 95 +++++++++++-------- 3 files changed, 58 insertions(+), 45 deletions(-) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml index 9d0ccb88c4..2c08158c8b 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml @@ -86,7 +86,7 @@