Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Dec 2, 2024
1 parent b922796 commit 25fdf50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,15 @@ response.IsSuccessStatusCode is false &&
|| exp is TaskCanceledException tcExp && tcExp.InnerException is TimeoutException
|| exp is HttpRequestException { StatusCode: HttpStatusCode.BadGateway or HttpStatusCode.GatewayTimeout or HttpStatusCode.ServiceUnavailable })
{
//#if (signalR != true)
serverCommunicationSuccess = false; // Let's treat the server communication as failed if an exception is caught here.
//#endif
throw new ServerConnectionException(localizer[nameof(AppStrings.ServerConnectionException)], exp);
}
//#if (signalR != true)
finally
{
if (isInternalRequest)
{
pubSubService.Publish(ClientPubSubMessages.IS_ONLINE_CHANGED, serverCommunicationSuccess);
}
}
//#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ public async Task Subscribe([Required] PushNotificationSubscriptionDto dto, Canc

var userSessionId = httpContextAccessor.HttpContext!.User.IsAuthenticated() ? httpContextAccessor.HttpContext.User.GetSessionId() : (Guid?)null;

var subscription = await dbContext.PushNotificationSubscriptions
.Where(s => s.UserSessionId == userSessionId || s.DeviceId == dto.DeviceId)
.SingleOrDefaultAsync(cancellationToken);
await dbContext.PushNotificationSubscriptions
.Where(s => s.DeviceId == dto.DeviceId || s.UserSessionId == userSessionId /* pushManager's subscription has been renewed. */)
.ExecuteDeleteAsync(cancellationToken);

if (subscription is null)
var subscription = dbContext.PushNotificationSubscriptions.Add(new()
{
dbContext.PushNotificationSubscriptions.Add(subscription = new()
{
DeviceId = dto.DeviceId,
Platform = dto.Platform
});
}
DeviceId = dto.DeviceId,
Platform = dto.Platform
}).Entity;

dto.Patch(subscription);

Expand Down

0 comments on commit 25fdf50

Please sign in to comment.