Skip to content

Commit 2fe6717

Browse files
committed
Fix build
1 parent 314cc2c commit 2fe6717

File tree

7 files changed

+37
-21
lines changed

7 files changed

+37
-21
lines changed

src/Bible.Alarm/Common/ViewHelpers/Converters/PlayStatusIconConverter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Globalization;
2+
using Bible.Alarm.Views;
23

34
namespace Bible.Alarm.Common.ViewHelpers.Converters;
45

src/Bible.Alarm/Common/ViewHelpers/ListViewHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#if WINDOWS
2+
using Microsoft.UI.Xaml;
23
using Microsoft.UI.Xaml.Controls;
34
#endif
45
using System.Runtime.InteropServices;

src/Bible.Alarm/MauiProgram.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
using Bible.Alarm.Platforms.Android.Services.Handlers;
4848
using Bible.Alarm.Platforms.Android.Services.Helpers;
4949
using Bible.Alarm.Platforms.Android.Services.Battery;
50+
using Bible.Alarm.Common.Interfaces.Battery;
5051
using Bible.Alarm.Platforms.Android.Services.Platform;
5152
using Bible.Alarm.Platforms.Android.Services.Storage;
5253
#endif
@@ -57,6 +58,7 @@
5758
using Bible.Alarm.Platforms.Windows.Services.Storage;
5859
using Bible.Alarm.Platforms.Windows.Services.Platform;
5960
using Bible.Alarm.Platforms.Windows.Helpers;
61+
using Windows.Media.Playback;
6062
#endif
6163

6264
namespace Bible.Alarm;
@@ -95,7 +97,7 @@ private static void RegisterServices(IServiceCollection services)
9597
{
9698
// Register platform-specific HttpMessageHandler
9799
#if ANDROID
98-
services.AddSingleton<HttpMessageHandler, AndroidMessageHandler>();
100+
services.AddSingleton<HttpMessageHandler, HttpClientHandler>();
99101
#elif IOS
100102
services.AddSingleton<HttpMessageHandler, HttpClientHandler>();
101103
#elif WINDOWS
@@ -284,9 +286,12 @@ private static void RunBootstrap(IServiceProvider services)
284286

285287
#if ANDROID
286288
// Android bootstrap initialization
287-
var context = Platform.CurrentActivity?.ApplicationContext ?? Application.Context;
289+
var context = Platform.CurrentActivity?.ApplicationContext;
288290
var application = Platform.CurrentActivity?.Application;
289-
BootstrapHelper.Initialize(logger, context, application);
291+
if (context != null && application != null)
292+
{
293+
BootstrapHelper.Initialize(logger, context, application);
294+
}
290295
#elif IOS
291296
// iOS bootstrap initialization
292297
BootstrapHelper.Initialize(logger, isForeground: true);

src/Bible.Alarm/ViewModels/Bible/BookSelectionViewModel.cs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class BookSelectionViewModel : ObservableObject, IDisposable
2020

2121
private readonly MediaService _mediaService;
2222
private readonly IState<ApplicationState> _state;
23+
private EventHandler? _onBibleReadingChanged;
24+
private EventHandler? _onBibleReadingInitialized;
2325

2426
public ICommand BackCommand { get; set; }
2527
public ICommand ChapterSelectionCommand { get; set; }
@@ -58,8 +60,7 @@ public BookSelectionViewModel(MediaService mediaService, INavigation navigation,
5860

5961
//set schedules from initial state.
6062
//this should fire only once
61-
EventHandler onBibleReadingInitialized = null;
62-
onBibleReadingInitialized = (sender, e) =>
63+
_onBibleReadingInitialized = (sender, e) =>
6364
{
6465
var stateValue = _state.Value;
6566
if (stateValue.CurrentBibleReadingSchedule == null ||
@@ -72,9 +73,13 @@ public BookSelectionViewModel(MediaService mediaService, INavigation navigation,
7273
await Initialize(_tentative.LanguageCode, _tentative.PublicationCode);
7374
await MainThread.InvokeOnMainThreadAsync(() => IsBusy = false);
7475
});
75-
_state.StateChanged -= onBibleReadingInitialized;
76+
if (_onBibleReadingInitialized != null)
77+
{
78+
_state.StateChanged -= _onBibleReadingInitialized;
79+
_onBibleReadingInitialized = null;
80+
}
7681
};
77-
_state.StateChanged += onBibleReadingInitialized;
82+
_state.StateChanged += _onBibleReadingInitialized;
7883

7984
// Subscribe to current schedule changes (but skip first one)
8085
BibleReadingSchedule lastCurrent = null;
@@ -88,8 +93,23 @@ void OnBibleReadingChanged(object sender, EventArgs e)
8893
lastCurrent = _current;
8994
}
9095

91-
_state.StateChanged += OnBibleReadingChanged;
96+
_onBibleReadingChanged = OnBibleReadingChanged;
97+
_state.StateChanged += _onBibleReadingChanged;
98+
99+
}
92100

101+
public void Dispose()
102+
{
103+
if (_onBibleReadingChanged != null)
104+
{
105+
_state.StateChanged -= _onBibleReadingChanged;
106+
_onBibleReadingChanged = null;
107+
}
108+
if (_onBibleReadingInitialized != null)
109+
{
110+
_state.StateChanged -= _onBibleReadingInitialized;
111+
_onBibleReadingInitialized = null;
112+
}
93113
}
94114

95115
private void SetSelectedBook()

src/Bible.Alarm/ViewModels/Bible/ChapterSelectionViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ public void Dispose()
304304
UnsubscribeFromChapterEvents(chapter);
305305
}
306306

307-
_subscriptions.ForEach(x => x.Dispose());
308307
_propertyChangedHandlers.Clear();
309308

310309
_lock.Dispose();

src/Bible.Alarm/ViewModels/ScheduleViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class ScheduleViewModel : ObservableObject
3838
private readonly IToastService _popUpService;
3939
private readonly INavigation _navigation;
4040

41-
public Command BatteryOptimizationExcludeCommand { get; private set; }
42-
public Command BatteryOptimizationDismissCommand { get; private set; }
41+
public ICommand BatteryOptimizationExcludeCommand { get; private set; }
42+
public ICommand BatteryOptimizationDismissCommand { get; private set; }
4343

4444
public ICommand PreviousBookCommand { get; set; }
4545
public ICommand NextBookCommand { get; set; }

src/Bible.Alarm/Views/FontFileResources.xaml.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,8 @@ public static string FontAwesomeSolid
5252
}
5353

5454
// Fallback: try to get from ResourceDictionary
55-
56-
<<<<<<<
57-
58-
Unmerged change from project 'Bible.Alarm (net9.0-android)',
59-
return Instance.GetStringResourceForPlatform("FontAwesomeSolidId") ?? "FontAwesomeSolid";
60-
}
61-
=======
6255
return GetStringResourceForPlatform("FontAwesomeSolidId") ?? "FontAwesomeSolid";
6356
}
64-
>>>>>>> After
65-
return FontFileResources.GetStringResourceForPlatform("FontAwesomeSolidId") ?? "FontAwesomeSolid";
66-
}
6757
}
6858

6959
private static string? GetStringResourceForPlatform(string resourceKey)

0 commit comments

Comments
 (0)