mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
fix bugs
This commit is contained in:
@@ -50,9 +50,9 @@ public class ChatNotificationService : IChatNotificationService
|
|||||||
var privateChat = await _privateChatsRepository.GetByIdAsync(message.RecipientId);
|
var privateChat = await _privateChatsRepository.GetByIdAsync(message.RecipientId);
|
||||||
|
|
||||||
var text = message.EncryptedContent.Substring(0, Math.Min(40, message.EncryptedContent.Length));
|
var text = message.EncryptedContent.Substring(0, Math.Min(40, message.EncryptedContent.Length));
|
||||||
var userId = message.SenderId == privateChat.UserAId ? privateChat.UserAId : privateChat.UserBId;
|
var userId = message.SenderId == privateChat.UserAId ? privateChat.UserBId : privateChat.UserAId;
|
||||||
|
|
||||||
var profile = await _profileService.GetUserProfileAsync(userId);
|
var profile = await _profileService.GetUserProfileAsync(message.SenderId);
|
||||||
var title = profile.Username;
|
var title = profile.Username;
|
||||||
|
|
||||||
await _notificationService.SendToUserAsync(userId, title,text, "chat_messages");
|
await _notificationService.SendToUserAsync(userId, title,text, "chat_messages");
|
||||||
|
|||||||
@@ -39,15 +39,15 @@ public class FirebasePushProvider : IPushNotificationProvider
|
|||||||
Notification = new Notification
|
Notification = new Notification
|
||||||
{
|
{
|
||||||
Title = message.Title,
|
Title = message.Title,
|
||||||
Body = message.Body
|
Body = message.Body,
|
||||||
},
|
},
|
||||||
Data = message.Data,
|
Data = message.Data,
|
||||||
Android = message.ChannelId != null ? new AndroidConfig
|
Android = message.ChannelId != null ? new AndroidConfig
|
||||||
{
|
{
|
||||||
|
Priority = Priority.High,
|
||||||
Notification = new AndroidNotification
|
Notification = new AndroidNotification
|
||||||
{
|
{
|
||||||
ChannelId = message.ChannelId,
|
ChannelId = message.ChannelId ?? "chat_messages"
|
||||||
Priority = NotificationPriority.HIGH
|
|
||||||
}
|
}
|
||||||
} : null
|
} : null
|
||||||
};
|
};
|
||||||
@@ -82,7 +82,11 @@ public class FirebasePushProvider : IPushNotificationProvider
|
|||||||
{
|
{
|
||||||
var msg = new Message
|
var msg = new Message
|
||||||
{
|
{
|
||||||
Notification = new Notification { Title = pm.Title, Body = pm.Body },
|
Notification = new Notification
|
||||||
|
{
|
||||||
|
Title = pm.Title,
|
||||||
|
Body = pm.Body
|
||||||
|
},
|
||||||
Data = pm.Data,
|
Data = pm.Data,
|
||||||
Token = token
|
Token = token
|
||||||
};
|
};
|
||||||
@@ -91,6 +95,7 @@ public class FirebasePushProvider : IPushNotificationProvider
|
|||||||
{
|
{
|
||||||
msg.Android = new AndroidConfig
|
msg.Android = new AndroidConfig
|
||||||
{
|
{
|
||||||
|
Priority = Priority.High,
|
||||||
Notification = new AndroidNotification { ChannelId = pm.ChannelId }
|
Notification = new AndroidNotification { ChannelId = pm.ChannelId }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public class PushTokenRepository : IPushTokenRepository
|
|||||||
existing.Provider = provider;
|
existing.Provider = provider;
|
||||||
existing.UpdatedAt = DateTime.UtcNow;
|
existing.UpdatedAt = DateTime.UtcNow;
|
||||||
existing.LastUsedAt = DateTime.UtcNow;
|
existing.LastUsedAt = DateTime.UtcNow;
|
||||||
|
existing.Token = token;
|
||||||
existing.IsActive = true;
|
existing.IsActive = true;
|
||||||
|
|
||||||
_context.UserPushTokens.Update(existing);
|
_context.UserPushTokens.Update(existing);
|
||||||
|
|||||||
Reference in New Issue
Block a user