Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dues paid #134

Merged
merged 5 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.messaging.BatchResponse;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.FirebaseMessagingException;
import com.google.firebase.messaging.MulticastMessage;
import com.google.firebase.messaging.*;
import com.hanaro.triptogether.common.response.BaseResponse;
import com.hanaro.triptogether.common.response.ResponseStatus;
import com.hanaro.triptogether.dues.dto.request.DuesAlarmRequestDto;
Expand Down Expand Up @@ -76,6 +73,7 @@ public void sendMessageTo(FcmSendDto fcmSendDto) throws IOException {
private String makeMessage(FcmSendDto fcmSendDto) throws JsonProcessingException {

ObjectMapper om = new ObjectMapper();

FcmMessageDto fcmMessageDto = FcmMessageDto
.builder()
.message(FcmMessageDto.Message.builder()
Expand Down Expand Up @@ -135,9 +133,10 @@ public BaseResponse notificationAlarm(String title, String body, DuesAlarmReques
}

MulticastMessage message = MulticastMessage.builder()
.putData("fcm_type","NOTIFICATION")
.putData("title",title)
.putData("body",body)
.setNotification(Notification.builder()
.setTitle(title)
.setBody("회비 "+body+" 원을 요청하였습니다.")
.build())
.addAllTokens(tokenList)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import com.hanaro.triptogether.exchangeRate.utils.ExchangeUtils;
import com.hanaro.triptogether.member.domain.Member;
import com.hanaro.triptogether.member.domain.MemberRepository;
import com.hanaro.triptogether.team.domain.Team;
import com.hanaro.triptogether.team.domain.TeamRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -34,12 +32,11 @@
public class ExchangeService {

private final ExchangeRateAlarmRepository exchangeRateAlarmRepository;
private final TeamRepository teamRepository;
private final MemberRepository memberRepository;
private final ExchangeRateRepository exchangeRateRepository;

private final ExchangeUtils exchangeUtils;
private FirebaseFCMService firebaseFCMService;
private final FirebaseFCMService firebaseFCMService;

public ExchangeRateInfoResponseDto getExchangeRate(){

Expand Down Expand Up @@ -94,7 +91,7 @@ public void checkNotifyAlarms() throws IOException {
}

if (notify) {
firebaseFCMService.sendMessageTo(FcmSendDto.builder().token(alarm.getFcmToken()).title("환율 알림").body("설정한 환율 조건에 도달했습니다.").build());
firebaseFCMService.sendMessageTo(FcmSendDto.builder().token(alarm.getFcmToken()).title("환율 알림").body("환율이 "+alarm.getCurRate()+" 에 도달했어요~!!.").build());
alarm.setNotified(true);
exchangeRateAlarmRepository.save(alarm);

Expand Down

This file was deleted.

Loading