Update lot features
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -108,7 +108,11 @@ public class CallController {
|
||||
Long callerId = SecurityHelper.getCurrentUserId();
|
||||
Long otherId = Long.parseLong(body.get("otherId"));
|
||||
String channelName = body.get("channelName");
|
||||
callNotificationService.notifyCallEnded(callerId, otherId, channelName);
|
||||
if (channelName == null || channelName.isBlank()) {
|
||||
callNotificationService.notifyCallEnded(callerId, otherId);
|
||||
} else {
|
||||
callNotificationService.notifyCallEnded(callerId, otherId, channelName);
|
||||
}
|
||||
return ResponseEntity.ok(ApiResponse.ok(null, "Call ended"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ public class CallNotifyRequest {
|
||||
/** Token Agora untuk receiver — dikirim lewat FCM payload */
|
||||
private String agoraToken;
|
||||
|
||||
private String agoraAppId;
|
||||
|
||||
/** UID Agora untuk receiver */
|
||||
private int receiverUid;
|
||||
}
|
||||
|
||||
+2
-1
@@ -40,6 +40,7 @@ public class CallNotificationService {
|
||||
payload.put("callerName", callerName);
|
||||
payload.put("channelName", req.getChannelName());
|
||||
payload.put("agoraToken", req.getAgoraToken() != null ? req.getAgoraToken() : "");
|
||||
payload.put("agoraAppId", req.getAgoraAppId() != null ? req.getAgoraAppId() : "");
|
||||
payload.put("receiverUid", String.valueOf(req.getReceiverUid()));
|
||||
|
||||
pendingCalls.put(receiver.getId(), payload);
|
||||
@@ -171,4 +172,4 @@ public class CallNotificationService {
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -4,6 +4,7 @@ import com.walkguide.dto.request.CallNotifyRequest;
|
||||
import com.walkguide.entity.User;
|
||||
import com.walkguide.exception.ResourceNotFoundException;
|
||||
import com.walkguide.repository.UserRepository;
|
||||
import com.walkguide.websocket.LocationBroadcaster;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -34,6 +35,9 @@ class CallNotificationServiceTest {
|
||||
@Mock
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Mock
|
||||
private LocationBroadcaster locationBroadcaster;
|
||||
|
||||
@InjectMocks
|
||||
private CallNotificationService service;
|
||||
|
||||
@@ -89,7 +93,7 @@ class CallNotificationServiceTest {
|
||||
|
||||
String message = service.notifyIncomingCall(1L, request);
|
||||
|
||||
assertEquals("Panggilan dikirim (receiver mungkin tidak menerima push notification)", message);
|
||||
assertEquals("Panggilan dikirim via realtime fallback.", message);
|
||||
verify(fcmService, never()).sendHighPriority(anyString(), anyString(), anyString(), anyMap());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user