File tree Expand file tree Collapse file tree 8 files changed +26
-25
lines changed
Expand file tree Collapse file tree 8 files changed +26
-25
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ private static void RegisterViewModels(IServiceCollection services)
242242 services . AddTransient < BookSelectionViewModel > ( ) ;
243243 services . AddTransient < ChapterSelectionViewModel > ( ) ;
244244 services . AddTransient < AlarmViewModal > ( ) ;
245- services . AddSingleton < MediaProgressViewModal > ( ) ;
245+ services . AddTransient < MediaProgressViewModal > ( ) ;
246246
247247 // Register ScheduleListItem as transient for list items
248248 services . AddTransient < ScheduleListItem > ( ) ;
Original file line number Diff line number Diff line change @@ -152,11 +152,9 @@ public async Task CloseModalAsync()
152152 var navigation = GetNavigation ( ) ;
153153 if ( navigation . ModalStack . Count > 0 )
154154 {
155- var modal = await navigation . PopModalAsync ( ) ;
156- if ( modal . BindingContext is IDisposable disposable )
157- {
158- disposable . Dispose ( ) ;
159- }
155+ await navigation . PopModalAsync ( ) ;
156+ // Disposal is handled automatically by BaseContentPage.OnNavigatedFrom
157+ // for all modals that inherit from BaseContentPage
160158 }
161159 }
162160}
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22
3- <ContentPage
3+ <views : BaseContentPage
44 x : Class =" Bible.Alarm.Views.General.AlarmModal"
5+ xmlns : views =" clr-namespace:Bible.Alarm.Views"
56 xmlns =" http://schemas.microsoft.com/dotnet/2021/maui"
67 xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
78 xmlns : forms =" http://schemas.microsoft.com/dotnet/2021/maui/design"
1011 xmlns : converters =" clr-namespace:Bible.Alarm.Common.ViewHelpers.Converters"
1112 xmlns : fn =" clr-namespace:Bible.Alarm.Views"
1213 x : DataType =" shared:AlarmViewModal" >
13- <ContentPage .Resources>
14+ <views : BaseContentPage .Resources>
1415 <converters : IsEnabledColorConverter x : Key =" isEnabledConverter" />
15- </ContentPage .Resources>
16- <ContentPage .Content>
16+ </views : BaseContentPage .Resources>
17+ <views : BaseContentPage .Content>
1718 <Grid HorizontalOptions =" Center" VerticalOptions =" Fill" >
1819 <Grid .RowDefinitions>
1920 <RowDefinition Height =" *" />
223224 </Grid >
224225 </Grid >
225226
226- </ContentPage .Content>
227- </ContentPage >
227+ </views : BaseContentPage .Content>
228+ </views : BaseContentPage >
Original file line number Diff line number Diff line change 22
33namespace Bible . Alarm . Views . General ;
44
5- public partial class AlarmModal : ContentPage
5+ public partial class AlarmModal : BaseContentPage
66{
77 public AlarmViewModal ViewModel => BindingContext as AlarmViewModal ;
88
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22
3- <ContentPage
3+ <views : BaseContentPage
44 x : Class =" Bible.Alarm.Views.General.BatteryOptimizationExclusionModal"
5+ xmlns : views =" clr-namespace:Bible.Alarm.Views"
56 xmlns =" http://schemas.microsoft.com/dotnet/2021/maui"
67 xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
78 xmlns : d =" http://schemas.microsoft.com/dotnet/2021/maui/design"
1011 xmlns : converters =" clr-namespace:Bible.Alarm.Common.ViewHelpers.Converters"
1112 x : DataType =" vm:ScheduleViewModel"
1213 mc : Ignorable =" d" >
13- <ContentPage .Resources>
14+ <views : BaseContentPage .Resources>
1415 <converters : NegateBooleanConverter x : Key =" negateBooleanConverter" />
15- </ContentPage .Resources>
16- <ContentPage .Content>
16+ </views : BaseContentPage .Resources>
17+ <views : BaseContentPage .Content>
1718 <StackLayout
1819 Margin =" 0,0,0,125"
1920 AutomationId =" BatteryOptimizationModal"
9899 TextColor =" SlateBlue"
99100 WidthRequest =" 200" />
100101 </StackLayout >
101- </ContentPage .Content>
102- </ContentPage >
102+ </views : BaseContentPage .Content>
103+ </views : BaseContentPage >
Original file line number Diff line number Diff line change 11namespace Bible . Alarm . Views . General ;
22
3- public partial class BatteryOptimizationExclusionModal : ContentPage
3+ public partial class BatteryOptimizationExclusionModal : BaseContentPage
44{
55 public BatteryOptimizationExclusionModal ( )
66 {
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22
3- <ContentPage
3+ <views : BaseContentPage
44 x : Class =" Bible.Alarm.Views.General.MediaProgressModal"
5+ xmlns : views =" clr-namespace:Bible.Alarm.Views"
56 xmlns =" http://schemas.microsoft.com/dotnet/2021/maui"
67 xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
78 xmlns : d =" http://schemas.microsoft.com/dotnet/2021/maui/design"
1011 x : DataType =" vm:MediaProgressViewModal"
1112 BackgroundColor =" White"
1213 mc : Ignorable =" d" >
13- <ContentPage .Content>
14+ <views : BaseContentPage .Content>
1415 <StackLayout
1516 HorizontalOptions =" Center"
1617 Orientation =" Vertical"
2122 Progress =" {Binding Progress}"
2223 ProgressColor =" SlateBlue" />
2324 </StackLayout >
24- </ContentPage .Content>
25- </ContentPage >
25+ </views : BaseContentPage .Content>
26+ </views : BaseContentPage >
Original file line number Diff line number Diff line change 11namespace Bible . Alarm . Views . General ;
22
33[ XamlCompilation ( XamlCompilationOptions . Compile ) ]
4- public partial class MediaProgressModal : ContentPage
4+ public partial class MediaProgressModal : BaseContentPage
55{
66 public MediaProgressModal ( )
77 {
You can’t perform that action at this time.
0 commit comments