Skip to content

Commit

Permalink
CU-868a1kgf7 fixing iOS critical notification bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
ucswift committed Oct 5, 2024
1 parent 6043bf3 commit e87254a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
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

0 comments on commit e87254a

Please sign in to comment.