Skip to content

Commit 22541b3

Browse files
committed
Fixed #334 And #414
Notification not working on iOS
1 parent 8fc97a2 commit 22541b3

File tree

6 files changed

+6
-20
lines changed

6 files changed

+6
-20
lines changed

Sample/Direct Maui/LocalNotification.Sample/MauiProgram.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public static MauiApp CreateMauiApp()
5959
.AddiOS(iOS =>
6060
{
6161
#if IOS
62-
iOS.UseCustomDelegate = true;
63-
iOS.SetCustomUserNotificationCenterDelegate(new CustomUserNotificationCenterDelegate());
62+
//iOS.SetCustomUserNotificationCenterDelegate(new CustomUserNotificationCenterDelegate());
6463
#endif
6564
});
6665
});

Source/Plugin.LocalNotification/LocalNotificationExtensions.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ public static MauiAppBuilder UseLocalNotification(this MauiAppBuilder builder, A
6464
{
6565
iOS.FinishedLaunching((application, _) =>
6666
{
67-
if (localNotificationBuilder.IOSBuilder.UseCustomDelegate)
68-
{
69-
LocalNotificationCenter.SetCustomUserNotificationCenterDelegate(localNotificationBuilder.IOSBuilder.CustomUserNotificationCenterDelegate);
70-
}
67+
LocalNotificationCenter.SetUserNotificationCenterDelegate(localNotificationBuilder.IOSBuilder.CustomUserNotificationCenterDelegate);
7168
return true;
7269
});
7370
iOS.WillEnterForeground(application =>

Source/Plugin.LocalNotification/Platforms/iOS/LocalNotificationCenter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public partial class LocalNotificationCenter
2121
/// and set it using this method
2222
/// </summary>
2323
/// <param name="notificationDelegate"></param>
24-
public static void SetCustomUserNotificationCenterDelegate(UserNotificationCenterDelegate notificationDelegate = null)
24+
public static void SetUserNotificationCenterDelegate(UserNotificationCenterDelegate notificationDelegate = null)
2525
{
2626
UNUserNotificationCenter.Current.Delegate = notificationDelegate ?? new UserNotificationCenterDelegate();
2727
}

Source/Plugin.LocalNotification/Plugin.LocalNotification.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<Description>The local notification plugin provides a way to show local notifications from Xamarin and MAUI apps.</Description>
2121
<PackageIcon>icon.png</PackageIcon>
2222
<Copyright>Copyright © Elvin (Tharindu) Thudugala</Copyright>
23-
<Version>10.1.5</Version>
23+
<Version>10.1.6</Version>
2424
<PackageReleaseNotes>Check: https://github.com/thudugala/Plugin.LocalNotification/releases </PackageReleaseNotes>
2525

2626
<PublishRepositoryUrl>true</PublishRepositoryUrl>
@@ -71,7 +71,7 @@
7171
<Compile Include="**/Platforms/Android/**/*.cs" />
7272
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" PrivateAssets="All"/>
7373
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.10.1.1" />
74-
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="120.0.0.2" />
74+
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="120.0.0.1" />
7575
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
7676
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
7777
</ItemGroup>
@@ -84,7 +84,7 @@
8484

8585
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
8686
<Compile Include="**/Platforms/Android/**/*.cs" />
87-
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="120.0.0.2" />
87+
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="120.0.0.1" />
8888
</ItemGroup>
8989

9090
<ItemGroup Condition="$(TargetFramework.Contains('-ios'))">

Source/Plugin.LocalNotification/iOSOption/IiOSLocalNotificationBuilder.cs

-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ namespace Plugin.LocalNotification.iOSOption
99
/// </summary>
1010
public interface IiOSLocalNotificationBuilder
1111
{
12-
/// <summary>
13-
///
14-
/// </summary>
15-
bool UseCustomDelegate { get; set; }
16-
1712
#if IOS
1813
/// <summary>
1914
///

Source/Plugin.LocalNotification/iOSOption/iOSLocalNotificationBuilder.cs

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ namespace Plugin.LocalNotification.iOSOption
77
/// <inheritdoc/>
88
public class iOSLocalNotificationBuilder : IiOSLocalNotificationBuilder
99
{
10-
/// <summary>
11-
///
12-
/// </summary>
13-
public bool UseCustomDelegate { get; set; }
14-
1510
#if IOS
1611
/// <summary>
1712
///

0 commit comments

Comments
 (0)