Subversion Repositories SmartDukaan

Rev

Rev 34041 | Rev 34043 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34041 Rev 34042
Line 2579... Line 2579...
2579
        helper.setFrom(senderAddress);
2579
        helper.setFrom(senderAddress);
2580
        mailSender.send(message);
2580
        mailSender.send(message);
2581
    }
2581
    }
2582
 
2582
 
2583
    public void sendNotification() throws Exception {
2583
    public void sendNotification() throws Exception {
2584
        LOGGER.info("FCM sendNotification {}");
2584
        LOGGER.info("FCM sendNotification");
2585
        List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllPendingNotifications();
2585
        List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllPendingNotifications();
2586
        if (!pushNotifications.isEmpty()) {
2586
        if (!pushNotifications.isEmpty()) {
2587
            FileInputStream serviceAccount = new FileInputStream(getClass().getClassLoader().getResource("service-account.json").getPath());
2587
            InputStream serviceAccount = getClass().getClassLoader().getResourceAsStream("service-account.json");
2588
            GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount).createScoped(FCM_SCOPED);
2588
            GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount).createScoped(FCM_SCOPED);
2589
            googleCredentials.refreshIfExpired();
2589
            googleCredentials.refreshIfExpired();
2590
            String accessToken = googleCredentials.getAccessToken().getTokenValue();
2590
            String accessToken = googleCredentials.getAccessToken().getTokenValue();
2591
 
2591
 
2592
            for (PushNotifications pushNotification : pushNotifications) {
2592
            for (PushNotifications pushNotification : pushNotifications) {