Skip to content

Commit 91d4261

Browse files
More changes.
1 parent 7bb28b8 commit 91d4261

31 files changed

+458
-431
lines changed

sample/Sample.Android/Resources/Resource.designer.cs

Lines changed: 213 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sample/Sample.iOS.Shared/Sample.iOS.Shared.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</ProjectReference>
5151
</ItemGroup>
5252
<ItemGroup>
53-
<PackageReference Include="Notifo.SDK" Version="1.6.1" />
53+
<PackageReference Include="Notifo.SDK" Version="1.6.4" />
5454
</ItemGroup>
5555
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
5656
</Project>

sample/Sample/App.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// All rights reserved. Licensed under the MIT license.
66
// ==========================================================================
77

8+
using Notifo.SDK;
89
using Prism;
910
using Prism.DryIoc;
1011
using Prism.Ioc;

sample/Sample/NotifoStartup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// All rights reserved. Licensed under the MIT license.
66
// ==========================================================================
77

8+
using Notifo.SDK;
9+
using Notifo.SDK.FirebasePlugin;
810
using Xamarin.Forms;
911

1012
namespace Sample

sample/Sample/ViewModels/EventsPageViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private void RefreshEventsAsync()
6767
{
6868
try
6969
{
70-
var notifications = await notifoService.Notifications.GetMyNotificationsAsync();
70+
var notifications = await notifoService.Client.Notifications.GetMyNotificationsAsync();
7171

7272
Notifications.ReplaceRange(notifications.Items);
7373
}

sample/Sample/ViewModels/LoginPageViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// All rights reserved. Licensed under the MIT license.
66
// ==========================================================================
77

8+
using Notifo.SDK;
89
using Prism.Commands;
910
using Prism.Mvvm;
1011

sample/SampleNotificationServiceExtension/SampleNotificationServiceExtension.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
9191
<HintPath>..\..\packages\Newtonsoft.Json.13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
9292
</Reference>
93-
<Reference Include="Notifo.SDK, Version=1.6.1.0, Culture=neutral, processorArchitecture=MSIL">
94-
<HintPath>..\..\packages\Notifo.SDK.1.6.1\lib\netstandard2.1\Notifo.SDK.dll</HintPath>
93+
<Reference Include="Notifo.SDK, Version=1.6.4.0, Culture=neutral, processorArchitecture=MSIL">
94+
<HintPath>..\..\packages\Notifo.SDK.1.6.4\lib\netstandard2.1\Notifo.SDK.dll</HintPath>
9595
</Reference>
9696
<Reference Include="System" />
9797
<Reference Include="System.Xml" />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="xamarinios10" />
4-
<package id="Notifo.SDK" version="1.6.1" targetFramework="xamarinios10" />
4+
<package id="Notifo.SDK" version="1.6.4" targetFramework="xamarinios10" />
55
<package id="System.ComponentModel.Annotations" version="5.0.0" targetFramework="xamarinios10" />
66
</packages>

sdk/Notifo.SDK.FirebasePlugin/Notifo.SDK.FirebasePlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</ItemGroup>
5454

5555
<ItemGroup>
56-
<PackageReference Include="Notifo.SDK" Version="1.6.1" />
56+
<PackageReference Include="Notifo.SDK" Version="1.6.4" />
5757
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
5858
</ItemGroup>
5959

Lines changed: 61 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,61 @@
1-
// ==========================================================================
2-
// Notifo.io
3-
// ==========================================================================
4-
// Copyright (c) Sebastian Stehle
5-
// All rights reserved. Licensed under the MIT license.
6-
// ==========================================================================
7-
8-
using System;
9-
using System.Threading.Tasks;
10-
using Foundation;
11-
using Notifo.SDK.Resources;
12-
using Notifo.SDK;
13-
using Plugin.FirebasePushNotification;
14-
using Serilog;
1+
// ==========================================================================
2+
// Notifo.io
3+
// ==========================================================================
4+
// Copyright (c) Sebastian Stehle
5+
// All rights reserved. Licensed under the MIT license.
6+
// ==========================================================================
7+
8+
using System;
9+
using System.Threading.Tasks;
10+
using Foundation;
11+
using Notifo.SDK.Resources;
12+
using Notifo.SDK;
13+
using Plugin.FirebasePushNotification;
1514
using UserNotifications;
16-
17-
namespace Notifo.SDK.FirebasePlugin
15+
16+
namespace Notifo.SDK.FirebasePlugin
1817
{
1918
/// <summary>
2019
/// Plugin initialization.
21-
/// </summary>
22-
public class NotifoFirebasePlugin
23-
{
20+
/// </summary>
21+
public class NotifoFirebasePlugin
22+
{
2423
/// <summary>
2524
/// Initializes the firebase plugin.
2625
/// </summary>
2726
/// <param name="options">Application launch options.</param>
2827
/// <param name="notifoStartup">The <see cref="INotifoStartup"/> implementation.</param>
2928
/// <param name="notificationHandler">The <see cref="INotificationHandler"/> implementation.</param>
30-
/// <param name="autoRegistration">Automatically register for push notifications.</param>
31-
public static void Initialize(NSDictionary options, INotifoStartup notifoStartup, INotificationHandler notificationHandler = null, bool autoRegistration = true)
32-
{
33-
FirebasePushNotificationManager.Initialize(options, autoRegistration);
34-
35-
NotifoIO.Current.SetNotificationHandler(notificationHandler);
36-
notifoStartup.ConfigureService(NotifoIO.Current);
37-
}
38-
29+
/// <param name="autoRegistration">Automatically register for push notifications.</param>
30+
public static void Initialize(NSDictionary options, INotifoStartup notifoStartup, INotificationHandler notificationHandler = null, bool autoRegistration = true)
31+
{
32+
FirebasePushNotificationManager.Initialize(options, autoRegistration);
33+
34+
NotifoIO.Current.SetNotificationHandler(notificationHandler);
35+
notifoStartup.ConfigureService(NotifoIO.Current);
36+
}
37+
3938
/// <summary>
4039
/// Invoked when the application received a remote notification.
4140
/// </summary>
4241
/// <param name="data">The notification data dictionary.</param>
43-
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
44-
public static async Task DidReceiveMessageAsync(NSDictionary data)
45-
{
46-
Log.Debug(Strings.ReceivedNotification, data);
47-
48-
if (ContainsPullRefreshRequest(data))
49-
{
50-
await NotifoIO.DidReceivePullRefreshRequestAsync();
51-
}
52-
53-
FirebasePushNotificationManager.DidReceiveMessage(data);
54-
}
55-
42+
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
43+
public static async Task DidReceiveMessageAsync(NSDictionary data)
44+
{
45+
NotifoIO.Current.RaiseDebug(Strings.ReceivedNotification, null, data);
46+
47+
if (ContainsPullRefreshRequest(data))
48+
{
49+
await NotifoIO.DidReceivePullRefreshRequestAsync();
50+
}
51+
52+
FirebasePushNotificationManager.DidReceiveMessage(data);
53+
}
54+
5655
/// <summary>
5756
/// Indicates that a call to <see cref="UIKit.UIApplication.RegisterForRemoteNotifications"/> succeeded.
5857
/// </summary>
59-
/// <param name="deviceToken">The device token.</param>
58+
/// <param name="deviceToken">The device token.</param>
6059
public static void DidRegisterRemoteNotifications(NSData deviceToken)
6160
{
6261
FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);
@@ -65,7 +64,7 @@ public static void DidRegisterRemoteNotifications(NSData deviceToken)
6564
/// <summary>
6665
/// Indicates that a call to <see cref="UIKit.UIApplication.RegisterForRemoteNotifications"/> failed.
6766
/// </summary>
68-
/// <param name="error">The error.</param>
67+
/// <param name="error">The error.</param>
6968
public static void RemoteNotificationRegistrationFailed(NSError error)
7069
{
7170
FirebasePushNotificationManager.RemoteNotificationRegistrationFailed(error);
@@ -76,22 +75,22 @@ public static void RemoteNotificationRegistrationFailed(NSError error)
7675
/// </summary>
7776
/// <param name="center">The shared user notification center object that received the notification.</param>
7877
/// <param name="response">The user's response to the notification.</param>
79-
/// <param name="completionHandler">The action to execute when you have finished processing the user's response.</param>
80-
public static void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
81-
{
82-
NotifoIO.DidReceiveNotificationResponse(center, response, completionHandler);
83-
84-
if (CrossFirebasePushNotification.Current is IUNUserNotificationCenterDelegate notificationDelegate)
85-
{
86-
notificationDelegate.DidReceiveNotificationResponse(center, response, completionHandler);
87-
}
88-
}
89-
90-
private static bool ContainsPullRefreshRequest(NSDictionary data)
91-
{
92-
var aps = data?.ObjectForKey(new NSString(Constants.ApsKey)) as NSDictionary;
93-
94-
return aps != null && aps.ContainsKey(new NSString(Constants.ContentAvailableKey));
95-
}
96-
}
97-
}
78+
/// <param name="completionHandler">The action to execute when you have finished processing the user's response.</param>
79+
public static void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
80+
{
81+
NotifoIO.DidReceiveNotificationResponse(center, response, completionHandler);
82+
83+
if (CrossFirebasePushNotification.Current is IUNUserNotificationCenterDelegate notificationDelegate)
84+
{
85+
notificationDelegate.DidReceiveNotificationResponse(center, response, completionHandler);
86+
}
87+
}
88+
89+
private static bool ContainsPullRefreshRequest(NSDictionary data)
90+
{
91+
var aps = data?.ObjectForKey(new NSString(Constants.ApsKey)) as NSDictionary;
92+
93+
return aps != null && aps.ContainsKey(new NSString(Constants.ContentAvailableKey));
94+
}
95+
}
96+
}

0 commit comments

Comments
 (0)