Skip to content

Commit c066cab

Browse files
Merge pull request #5 from CoderGamester/develop
Release 0.1.5
2 parents bdcd99d + e2f3e02 commit c066cab

File tree

6 files changed

+49
-3
lines changed

6 files changed

+49
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [0.1.5] - 2020-08-03
8+
9+
**Fixed**:
10+
- Fixed NullReferenceException error when handling *IGameNotification* in the editor
11+
712
## [0.1.4] - 2020-08-03
813

914
**Fixed**:

Runtime/GameNotificationsMonoBehaviour.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public PendingNotification ScheduleNotification(IGameNotification notification)
358358
throw new InvalidOperationException("Must call Initialize() first.");
359359
}
360360

361-
if (notification == null || _platform == null)
361+
if (notification == null)
362362
{
363363
return null;
364364
}
@@ -367,7 +367,7 @@ public PendingNotification ScheduleNotification(IGameNotification notification)
367367
// Also immediately schedule non-time based deliveries (for iOS)
368368
if ((Mode & OperatingMode.Queue) != OperatingMode.Queue || notification.DeliveryTime == null)
369369
{
370-
_platform.ScheduleNotification(notification);
370+
_platform?.ScheduleNotification(notification);
371371
}
372372
else if (!notification.Id.HasValue)
373373
{
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
3+
// ReSharper disable once CheckNamespace
4+
5+
namespace GameLovers.NotificationService
6+
{
7+
/// <summary>
8+
/// Editor specific implementation of <see cref="IGameNotification"/>.
9+
/// </summary>
10+
internal class EditorGameNotification : IGameNotification
11+
{
12+
/// <inheritdoc />
13+
public int? Id { get; set; }
14+
/// <inheritdoc />
15+
public string Title { get; set; }
16+
/// <inheritdoc />
17+
public string Body { get; set; }
18+
/// <inheritdoc />
19+
public string Subtitle { get; set; }
20+
/// <inheritdoc />
21+
public string Channel { get; set; }
22+
/// <inheritdoc />
23+
public int? BadgeNumber { get; set; }
24+
/// <inheritdoc />
25+
public bool ShouldAutoCancel { get; set; }
26+
/// <inheritdoc />
27+
public DateTime? DeliveryTime { get; set; }
28+
/// <inheritdoc />
29+
public bool Scheduled { get; }
30+
/// <inheritdoc />
31+
public string SmallIcon { get; set; }
32+
/// <inheritdoc />
33+
public string LargeIcon { get; set; }
34+
}
35+
}

Runtime/Internal/EditorGameNotification.cs.meta

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

Runtime/MobileNotificationService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public MobileNotificationService(params GameNotificationChannel[] channels)
9191
/// <inheritdoc />
9292
public IGameNotification CreateNotification()
9393
{
94+
#if UNITY_EDITOR
95+
return new EditorGameNotification();
96+
#endif
9497
return _monoBehaviour.CreateNotification();
9598
}
9699

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.gamelovers.notificationservice",
33
"displayName": "Notification Service",
4-
"version": "0.1.4",
4+
"version": "0.1.5",
55
"unity": "2019.4",
66
"description": "This package provides an easier to use service to help manage the notification sent to mobile devices, and based on the Unity's Mobile Notifications package.\nIt allows to schedule local notifications, receive remote notifications and clear any type of notification.",
77
"dependencies": {

0 commit comments

Comments
 (0)