diff --git a/DysonNetwork.Pass/Wallet/SubscriptionService.cs b/DysonNetwork.Pass/Wallet/SubscriptionService.cs index 27ccbfa..5f5db41 100644 --- a/DysonNetwork.Pass/Wallet/SubscriptionService.cs +++ b/DysonNetwork.Pass/Wallet/SubscriptionService.cs @@ -362,9 +362,12 @@ public class SubscriptionService( Topic = "subscriptions.begun", Title = localizer["SubscriptionAppliedTitle", humanReadableName], Body = localizer["SubscriptionAppliedBody", duration, humanReadableName], + Meta = GrpcTypeHelper.ConvertObjectToByteString(new Dictionary + { + ["subscription_id"] = subscription.Id.ToString() + }), IsSavable = true }; - notification.Meta.Add("subscription_id", Value.ForString(subscription.Id.ToString())); await pusher.SendPushNotificationToUserAsync( new SendPushNotificationToUserRequest { diff --git a/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs b/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs index 9240b09..2dd91e7 100644 --- a/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs +++ b/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs @@ -91,7 +91,7 @@ public class PusherServiceGrpc( request.Notification.Title, request.Notification.Subtitle, request.Notification.Body, - GrpcTypeHelper.ConvertFromValueMap(request.Notification.Meta), + GrpcTypeHelper.ConvertByteStringToObject>(request.Notification.Meta) ?? [], request.Notification.ActionUri, request.Notification.IsSilent, request.Notification.IsSavable @@ -108,7 +108,8 @@ public class PusherServiceGrpc( Title = request.Notification.Title, Subtitle = request.Notification.Subtitle, Content = request.Notification.Body, - Meta = GrpcTypeHelper.ConvertFromValueMap(request.Notification.Meta) + Meta = GrpcTypeHelper.ConvertByteStringToObject>(request.Notification.Meta) ?? + [] }; if (request.Notification.ActionUri is not null) notification.Meta["action_uri"] = request.Notification.ActionUri; diff --git a/DysonNetwork.Shared/Proto/pusher.proto b/DysonNetwork.Shared/Proto/pusher.proto index 5c69b87..0936856 100644 --- a/DysonNetwork.Shared/Proto/pusher.proto +++ b/DysonNetwork.Shared/Proto/pusher.proto @@ -85,7 +85,7 @@ message PushNotification { string title = 2; string subtitle = 3; string body = 4; - map meta = 5; + bytes meta = 5; optional string action_uri = 6; bool is_silent = 7; bool is_savable = 8; diff --git a/DysonNetwork.Sphere/Chat/ChatService.cs b/DysonNetwork.Sphere/Chat/ChatService.cs index b1a7a1b..87214ef 100644 --- a/DysonNetwork.Sphere/Chat/ChatService.cs +++ b/DysonNetwork.Sphere/Chat/ChatService.cs @@ -241,10 +241,10 @@ public partial class ChatService( Body = !string.IsNullOrEmpty(message.Content) ? message.Content[..Math.Min(message.Content.Length, 100)] : "", + Meta = GrpcTypeHelper.ConvertObjectToByteString(metaDict), ActionUri = $"/chat/{room.Id}", IsSavable = false, }; - notification.Meta.Add(GrpcTypeHelper.ConvertToValueMap(metaDict)); List accountsToNotify = []; foreach (var member in members) diff --git a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs index 517b00a..8ce504b 100644 --- a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs +++ b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs @@ -78,10 +78,10 @@ public class PublisherSubscriptionService( Topic = "posts.new", Title = localizer["PostSubscriptionTitle", post.Publisher.Name, title], Body = message, + Meta = GrpcTypeHelper.ConvertObjectToByteString(data), IsSavable = true, ActionUri = $"/posts/{post.Id}" }; - notification.Meta.Add(GrpcTypeHelper.ConvertToValueMap(data)); // Notify each subscriber var notifiedCount = 0;