forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/kookmin-sw/capstone-2024-17
into #380-edit-design
- Loading branch information
Showing
34 changed files
with
383 additions
and
95 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
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
43 changes: 43 additions & 0 deletions
43
backend/src/main/java/com/coffee/backend/global/SubscriptionRegistry.java
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,43 @@ | ||
package com.coffee.backend.global; | ||
|
||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class SubscriptionRegistry { | ||
private final Map<String, Set<String>> subscriptions = new HashMap<>(); | ||
|
||
// subscribe | ||
public synchronized void addSubscription(String sessionId, String destination) { | ||
subscriptions.computeIfAbsent(sessionId, k -> new HashSet<>()).add(destination); | ||
} | ||
|
||
// 특정 세션이 특정 destination 을 구독 중인지 확인 | ||
public synchronized boolean hasSubscription(String sessionId, String destination) { | ||
return subscriptions.containsKey(sessionId) && subscriptions.get(sessionId).contains(destination); | ||
} | ||
|
||
// 구독 취소 | ||
public synchronized void removeSubscription(String sessionId, String destination) { | ||
if (subscriptions.containsKey(sessionId)) { | ||
Set<String> destinations = subscriptions.get(sessionId); | ||
destinations.remove(destination); | ||
if (destinations.isEmpty()) { | ||
subscriptions.remove(sessionId); | ||
} | ||
} | ||
} | ||
|
||
// 특정 세션의 모든 구독 취소 | ||
public synchronized void removeSubscriptionsBySessionId(String sessionId) { | ||
subscriptions.remove(sessionId); | ||
} | ||
|
||
// 전체 구독 정보를 출력 | ||
public synchronized void printSubscriptions() { | ||
System.out.println("웹소켓 구독 정보: " + subscriptions); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
backend/src/main/java/com/coffee/backend/global/WebSocketEventListener.java
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,62 @@ | ||
package com.coffee.backend.global; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.messaging.simp.stomp.StompHeaderAccessor; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.socket.messaging.SessionDisconnectEvent; | ||
import org.springframework.web.socket.messaging.SessionSubscribeEvent; | ||
import org.springframework.web.socket.messaging.SessionUnsubscribeEvent; | ||
|
||
@Component | ||
public class WebSocketEventListener { | ||
private final SubscriptionRegistry subscriptionRegistry; | ||
|
||
@Autowired | ||
public WebSocketEventListener(SubscriptionRegistry subscriptionRegistry) { | ||
this.subscriptionRegistry = subscriptionRegistry; | ||
} | ||
|
||
// 구독 이벤트 발생 시, 구독 처리 | ||
@EventListener | ||
public void handleSubscribeEvent(SessionSubscribeEvent event) { | ||
StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(event.getMessage()); | ||
String sessionId = headerAccessor.getSessionId(); | ||
String destination = headerAccessor.getDestination(); | ||
|
||
// 이미 구독된 경우 pass | ||
if (destination != null && subscriptionRegistry.hasSubscription(sessionId, destination)) { | ||
return; | ||
} | ||
// 중복이 아닌 경우만 구독 추가 | ||
subscriptionRegistry.addSubscription(sessionId, destination); | ||
subscriptionRegistry.printSubscriptions(); // 구독 정보 출력 | ||
} | ||
|
||
// 구독 취소 이벤트 발생 시, 구독 취소 처리 | ||
@EventListener | ||
public void handleUnsubscribeEvent(SessionUnsubscribeEvent event) { | ||
StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(event.getMessage()); | ||
String sessionId = headerAccessor.getSessionId(); | ||
String subscriptionId = headerAccessor.getSubscriptionId(); | ||
|
||
System.out.println( | ||
"구독 취소 이벤트 sessionId: " + sessionId + ", subscriptionId: " + subscriptionId); | ||
// 구독 취소 시 구독 정보 삭제 | ||
subscriptionRegistry.removeSubscription(sessionId, subscriptionId); | ||
subscriptionRegistry.printSubscriptions(); // 구독 정보 출력 | ||
} | ||
|
||
// 웹소켓 disconnect 이벤트 발생 시, 해당 세션의 모든 구독 취소 처리 | ||
@EventListener | ||
public void handleDisconnectEvent(SessionDisconnectEvent event) { | ||
StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(event.getMessage()); | ||
String sessionId = headerAccessor.getSessionId(); | ||
|
||
System.out.println("웹소켓 disconnect 이벤트 sessionId: " + sessionId); | ||
|
||
// 연결 종료 시 모든 구독 정보 삭제 | ||
subscriptionRegistry.removeSubscriptionsBySessionId(sessionId); | ||
subscriptionRegistry.printSubscriptions(); // 구독 정보 출력 | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## Flutter wrapper | ||
-keep class io.flutter.app.** { *; } | ||
-keep class io.flutter.plugin.** { *; } | ||
-keep class io.flutter.util.** { *; } | ||
-keep class io.flutter.view.** { *; } | ||
-keep class io.flutter.** { *; } | ||
-keep class io.flutter.plugins.** { *; } | ||
-dontwarn io.flutter.embedding.** |
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
5 changes: 5 additions & 0 deletions
5
frontend/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@mipmap/ic_launcher_adaptive_back"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/> | ||
</adaptive-icon> |
Binary file modified
BIN
+5.06 KB
(1100%)
frontend/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+852 Bytes
frontend/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.1 KB
frontend/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.19 KB
(840%)
frontend/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+459 Bytes
frontend/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.78 KB
frontend/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.72 KB
(1200%)
frontend/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.29 KB
frontend/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.3 KB
frontend/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+13.5 KB
(1400%)
frontend/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.88 KB
frontend/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.3 KB
frontend/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+20.1 KB
(1500%)
frontend/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.13 KB
frontend/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.8 KB
frontend/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>aps-environment</key> | ||
<string>development</string> | ||
</dict> | ||
<dict/> | ||
</plist> |
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
Oops, something went wrong.