-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from thomasgalliker/subscribe-topic-after-restart
Merge subscribe-topic-after-restart into develop
- Loading branch information
Showing
10 changed files
with
138 additions
and
115 deletions.
There are no files selected for viewing
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
Plugin.FirebasePushNotifications/Platforms/iOS/Extensions/NSDictionaryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Foundation; | ||
|
||
namespace Plugin.FirebasePushNotifications.Extensions | ||
{ | ||
internal static class NSDictionaryExtensions | ||
{ | ||
internal static IDictionary<string, object> GetParameters(this NSDictionary data) | ||
{ | ||
var parameters = new Dictionary<string, object>(); | ||
|
||
var keyAps = new NSString("aps"); | ||
var keyAlert = new NSString("alert"); | ||
|
||
foreach (var val in data) | ||
{ | ||
if (val.Key.Equals(keyAps)) | ||
{ | ||
if (data.ValueForKey(keyAps) is NSDictionary aps) | ||
{ | ||
foreach (var apsVal in aps) | ||
{ | ||
if (apsVal.Value is NSDictionary dictionaryValue) | ||
{ | ||
if (apsVal.Key.Equals(keyAlert)) | ||
{ | ||
foreach (var alertVal in dictionaryValue) | ||
{ | ||
parameters.Add($"aps.alert.{alertVal.Key}", $"{alertVal.Value}"); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
parameters.Add($"aps.{apsVal.Key}", $"{apsVal.Value}"); | ||
} | ||
|
||
} | ||
} | ||
} | ||
else | ||
{ | ||
parameters.Add($"{val.Key}", $"{val.Value}"); | ||
} | ||
} | ||
|
||
return parameters; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.