Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CU-868a1kgf7 fixing iOS critical notification bug. #154

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Providers/Resgrid.Providers.Bus/Models/ApnsHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public class ApnsHeader
public ApnsAlert alert { get; set; }
public string category { get; set; }
public int badge { get; set; }
public string sound { get; set; }
public ApnsSound sound { get; set; }
}
}
9 changes: 9 additions & 0 deletions Providers/Resgrid.Providers.Bus/Models/ApnsSound.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Resgrid.Providers.Bus.Models
{
public class ApnsSound
{
public float volume { get; set; }
public int critical { get; set; }
public string name { get; set; }
}
}
9 changes: 8 additions & 1 deletion Providers/Resgrid.Providers.Bus/NotificationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ public async Task<NotificationOutcomeState> SendAppleNotification(string title,
category = "chats";
else if (eventCode.ToLower().StartsWith("g")) // group chat
category = "chats";
else
category = "notifications";

var apnsPayload = new ApnsPayload
{
Expand All @@ -359,7 +361,12 @@ public async Task<NotificationOutcomeState> SendAppleNotification(string title,
},
badge = count,
category = category,
sound = GetSoundFileNameFromType(Platforms.iPhone, type)
sound = new ApnsSound
{
name = GetSoundFileNameFromType(Platforms.iPhone, type),
critical = category == "calls" ? 1 : 0,
volume = 1.0f
}
},
eventCode = eventCode,
type = type
Expand Down
9 changes: 8 additions & 1 deletion Providers/Resgrid.Providers.Bus/UnitNotificationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ public async Task<NotificationOutcomeState> SendAppleNotification(string title,
category = "chats";
else if (eventCode.ToLower().StartsWith("g")) // group chat
category = "chats";
else
category = "notifications";

var apnsPayload = new ApnsPayload
{
Expand All @@ -354,7 +356,12 @@ public async Task<NotificationOutcomeState> SendAppleNotification(string title,
},
badge = count,
category = category,
sound = GetSoundFileNameFromType(Platforms.iPhone, type, enableCustomSounds)
sound = new ApnsSound
{
name = GetSoundFileNameFromType(Platforms.iPhone, type, enableCustomSounds),
critical = category == "calls" ? 1 : 0,
volume = 1.0f
}
},
eventCode = eventCode,
type = type
Expand Down
Loading