diff options
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/controllers')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/controllers/Notifications.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java index 789adf5f..fb89e472 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java @@ -152,4 +152,39 @@ public class Notifications { } return Status.OK; } + @Deprecated + @RequestMapping(value = "/android/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public Status doAndroidRegister( + Principal principal, + @RequestParam(name = "regid") String regId) { + String name = UserUtils.getUsername(principal, null); + User visitor = userService.getUserByName(name); + if (visitor.getUid() == 0) { + throw new HttpForbiddenException(); + } + pushQueriesService.addGCMToken(visitor.getUid(), regId); + return Status.OK; + } + @Deprecated + @RequestMapping(value = "/android/unregister", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public Status doAndroidUnRegister(@RequestParam(name = "regid") String regId) { + pushQueriesService.deleteGCMToken(regId); + return Status.OK; + } + @Deprecated + @RequestMapping(value = "/winphone/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public Status doWinphoneRegister( + Principal principal, + @RequestParam(name = "url") String regId) { + String name = UserUtils.getUsername(principal, null); + User visitor = userService.getUserByName(name); + pushQueriesService.addMPNSToken(visitor.getUid(), regId); + return Status.OK; + } + @Deprecated + @RequestMapping(value = "/winphone/unregister", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public Status doWinphoneUnRegister(@RequestParam(name = "url") String regId) { + pushQueriesService.deleteMPNSToken(regId); + return Status.OK; + } } |