adjusting notifications
This commit is contained in:
@@ -59,7 +59,7 @@ public class BroadcastConfiguration : IBroadcastConfiguration
|
||||
return string.Concat(RedisKeyPrefix, hashedCid);
|
||||
}
|
||||
|
||||
public string BuildPairRequestNotification(string displayName)
|
||||
public string BuildPairRequestNotification()
|
||||
{
|
||||
var template = Options.PairRequestNotificationTemplate;
|
||||
if (string.IsNullOrWhiteSpace(template))
|
||||
@@ -67,8 +67,6 @@ public class BroadcastConfiguration : IBroadcastConfiguration
|
||||
template = DefaultNotificationTemplate;
|
||||
}
|
||||
|
||||
displayName = string.IsNullOrWhiteSpace(displayName) ? "Someone" : displayName;
|
||||
|
||||
return template.Replace("{DisplayName}", displayName, StringComparison.Ordinal);
|
||||
return template;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ public interface IBroadcastConfiguration
|
||||
bool EnableSyncshellBroadcastPayloads { get; }
|
||||
|
||||
string BuildRedisKey(string hashedCid);
|
||||
string BuildPairRequestNotification(string displayName);
|
||||
string BuildPairRequestNotification();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace LightlessSyncServer.Hubs
|
||||
public Task Client_GroupSendProfile(GroupProfileDto groupProfile) => throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
public Task Client_GroupSendInfo(GroupInfoDto dto) => throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
public Task Client_ReceiveServerMessage(MessageSeverity messageSeverity, string message) => throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
public Task Client_ReceiveBroadcastPairRequest(UserPairNotificationDto dto) => throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
public Task Client_UpdateSystemInfo(SystemInfoDto systemInfo) => throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
public Task Client_UserAddClientPair(UserPairDto dto) => throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
public Task Client_UserReceiveCharacterData(OnlineUserCharaDataDto dataDto) => throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
|
||||
@@ -262,14 +262,14 @@ public partial class LightlessHub
|
||||
await Clients.Caller.Client_ReceiveServerMessage(MessageSeverity.Information, $"Pair request sent. Waiting for the other player to confirm.").ConfigureAwait(false);
|
||||
|
||||
_logger.LogCallInfo(LightlessHubLogger.Args("stored pairing request", myCid, otherCid));
|
||||
await NotifyBroadcastOwnerOfPairRequest(otherCid).ConfigureAwait(false);
|
||||
await NotifyBroadcastOwnerOfPairRequest(myCid, otherCid).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task NotifyBroadcastOwnerOfPairRequest(string targetHashedCid)
|
||||
private async Task NotifyBroadcastOwnerOfPairRequest(string myHashedCid, string targetHashedCid)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(targetHashedCid))
|
||||
if (string.IsNullOrWhiteSpace(targetHashedCid) || string.IsNullOrWhiteSpace(myHashedCid))
|
||||
return;
|
||||
|
||||
if (!_broadcastConfiguration.EnableBroadcasting || !_broadcastConfiguration.NotifyOwnerOnPairRequest)
|
||||
@@ -313,10 +313,12 @@ public partial class LightlessHub
|
||||
return;
|
||||
|
||||
var senderAlias = Context.User?.Claims?.SingleOrDefault(c => string.Equals(c.Type, LightlessClaimTypes.Alias, StringComparison.Ordinal))?.Value;
|
||||
var displayName = string.IsNullOrWhiteSpace(senderAlias) ? UserUID : senderAlias;
|
||||
var message = _broadcastConfiguration.BuildPairRequestNotification(displayName);
|
||||
//var displayName = string.IsNullOrWhiteSpace(senderAlias) ? UserUID : senderAlias;
|
||||
var message = _broadcastConfiguration.BuildPairRequestNotification();
|
||||
|
||||
await Clients.User(entry.OwnerUID).Client_ReceiveServerMessage(MessageSeverity.Information, message).ConfigureAwait(false);
|
||||
var dto = new UserPairNotificationDto{myHashedCid = myHashedCid, message = message};
|
||||
|
||||
await Clients.User(entry.OwnerUID).Client_ReceiveBroadcastPairRequest(dto).ConfigureAwait(false);
|
||||
}
|
||||
private class PairingPayload
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user