-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: complete (mostly) the WebPushClient (#379)
and run the integration tests against autoconnect in ci (ignoring the 4 current failures) SYNC-3688
- Loading branch information
Showing
28 changed files
with
1,062 additions
and
343 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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,42 @@ | ||
/// Handle incoming notifications from autoendpoint | ||
use actix_web::{web, HttpResponse}; | ||
use uuid::Uuid; | ||
|
||
use autoconnect_settings::AppState; | ||
use autopush_common::notification::Notification; | ||
|
||
/// Deliver a Push notification directly to a connected client | ||
pub async fn push_route( | ||
uaid: web::Path<Uuid>, | ||
notif: web::Json<Notification>, | ||
state: web::Data<AppState>, | ||
) -> HttpResponse { | ||
trace!( | ||
"push_route, uaid: {} channel_id: {}", | ||
uaid, | ||
notif.channel_id | ||
); | ||
let result = state | ||
.clients | ||
.notify(uaid.into_inner(), notif.into_inner()) | ||
.await; | ||
if result.is_ok() { | ||
HttpResponse::Ok().finish() | ||
} else { | ||
HttpResponse::NotFound().body("Client not available") | ||
} | ||
} | ||
|
||
/// Notify a connected client to check storage for new notifications | ||
pub async fn check_storage_route( | ||
uaid: web::Path<Uuid>, | ||
state: web::Data<AppState>, | ||
) -> HttpResponse { | ||
trace!("check_storage_route, uaid: {}", uaid); | ||
let result = state.clients.check_storage(uaid.into_inner()).await; | ||
if result.is_ok() { | ||
HttpResponse::Ok().finish() | ||
} else { | ||
HttpResponse::NotFound().body("Client not available") | ||
} | ||
} |
Oops, something went wrong.