Skip to content

20260330 #730 채팅 화면에서 위치전송 기능 추가#747

Open
SeoHyun1024 wants to merge 15 commits intomainfrom
20260330_#730_채팅_화면에서_위치전송_기능_추가

Hidden character warning

The head ref may contain hidden characters: "20260330_#730_\ucc44\ud305_\ud654\uba74\uc5d0\uc11c_\uc704\uce58\uc804\uc1a1_\uae30\ub2a5_\ucd94\uac00"
Open

20260330 #730 채팅 화면에서 위치전송 기능 추가#747
SeoHyun1024 wants to merge 15 commits intomainfrom
20260330_#730_채팅_화면에서_위치전송_기능_추가

Conversation

@SeoHyun1024
Copy link
Copy Markdown
Collaborator

@SeoHyun1024 SeoHyun1024 commented Apr 2, 2026

#730

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능
    • 채팅에서 현재 위치 공유 기능 추가
    • 지도 기반 위치 선택 화면 구현
    • 공유된 위치에 대한 지도 미리보기 및 주소 표시
    • 채팅 입력창에 위치 전송 메뉴 항목 추가
    • 지도에서 보기 버튼으로 네이버지도 연동

SeoHyun1024 and others added 14 commits April 2, 2026 02:30
…d 대응 개선 #730

- Fix 1: _onSend 메서드의 불필요한 try/catch 제거 (객체 생성은 예외를 발생시키지 않음)
- Fix 2: 보내기 버튼의 iPad 대응 개선 (bottom: isTablet ? 80 : 57.h)
- 미사용 import 정리 (CommonSnackBar, SnackBarType)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Walkthrough

채팅 앱에 위치 공유 기능을 추가합니다. 메시지 타입에 LOCATION을 등록하고, 채팅 메시지에 좌표와 주소 필드를 포함하며, 지도 기반 위치 선택 화면과 위치 메시지 표시 위젯을 구현합니다.

Changes

Cohort / File(s) Summary
메시지 타입 및 모델 확장
lib/enums/message_type.dart, lib/models/apis/objects/chat_message.dart, lib/models/apis/objects/chat_message.g.dart
MessageTypeLOCATION enum 값 추가; ChatMessagelatitude, longitude, address 필드와 copyWith 메서드 확장; JSON 직렬화/역직렬화 자동 갱신
WebSocket 및 API 설정
lib/services/chat_websocket_service.dart, lib/models/app_urls.dart
sendMessage()latitude/longitude 파라미터 추가 및 LOCATION 타입 검증; 네이버 Static Maps API 엔드포인트 상수 추가
위치 선택 화면
lib/screens/chat_location_picker_screen.dart
권한 요청, 현재 위치 초기화, 지도 조작 중 주소 역지오코딩, "보내기" 버튼으로 LocationAddress 반환 기능 구현
채팅 입력 및 발송
lib/widgets/chat_input_bar.dart, lib/screens/chat_room_screen.dart
ChatInputBaronSendLocation 콜백 및 "위치 보내기" 메뉴 항목 추가; ChatRoomScreen에서 위치 선택 화면 호출 및 WebSocket 메시지 발송 로직 통합
위치 메시지 표시
lib/widgets/chat_location_bubble.dart, lib/widgets/chat_message_item.dart
Static Maps 썸네일, 주소 텍스트, "지도에서 보기" 버튼을 렌더링하는 ChatLocationBubble 위젯 추가; ChatMessageItem에 위치 메시지 타입 처리 분기 추가
설계 및 계획 문서
docs/superpowers/specs/2026-04-02-chat-location-share-design.md, docs/superpowers/plans/2026-04-02-chat-location-share.md
위치 공유 기능의 전체 설계 사양 및 구현 계획 문서

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant ChatRoom as ChatRoomScreen
    participant InputBar as ChatInputBar
    participant Picker as ChatLocationPickerScreen
    participant LocService as LocationService
    participant MapService as NaverMapService
    participant WSService as ChatWebSocketService
    
    User->>ChatRoom: 위치 보내기 메뉴 선택
    ChatRoom->>InputBar: onSendLocation 콜백 호출
    InputBar->>ChatRoom: _onSendLocation() 실행
    ChatRoom->>Picker: navigate(ChatLocationPickerScreen)
    Picker->>LocService: 위치 권한 요청
    LocService-->>Picker: 권한 승인/거부
    Picker->>LocService: 현재 위치 조회
    LocService-->>Picker: 좌표 반환
    Picker->>MapService: 지도 표시 (현재 위치 중심)
    User->>Picker: 지도에서 위치 선택
    Picker->>LocService: 선택 위치의 주소 역지오코딩
    LocService-->>Picker: 주소 반환
    Picker->>Picker: 주소 표시 업데이트
    User->>Picker: 보내기 버튼 클릭
    Picker-->>ChatRoom: LocationAddress (위도/경도/주소) 반환
    ChatRoom->>WSService: sendMessage(type:LOCATION, latitude, longitude, address)
    WSService->>WSService: 페이로드 검증 및 구성
    WSService-->>ChatRoom: WebSocket 메시지 송신
Loading
sequenceDiagram
    participant Server as 채팅 서버
    participant WSService as ChatWebSocketService
    participant ChatRoom as ChatRoomScreen
    participant MsgItem as ChatMessageItem
    participant Bubble as ChatLocationBubble
    participant MapAPI as NaverStaticMapsAPI
    participant LocService as LocationService
    actor User
    
    Server->>WSService: LOCATION 메시지 수신 (위도/경도/주소)
    WSService->>ChatRoom: 메시지 목록 업데이트
    ChatRoom->>MsgItem: ChatMessage (type:LOCATION) 렌더링
    MsgItem->>Bubble: ChatLocationBubble 위젯 빌드
    Bubble->>MapAPI: Static Map 이미지 요청 (마커 포함)
    MapAPI-->>Bubble: 지도 썸네일 이미지
    Bubble->>LocService: 좌표로부터 상세 주소 조회
    LocService-->>Bubble: 주소 정보
    Bubble-->>MsgItem: 메시지 버블 표시 (이미지+주소+버튼)
    User->>Bubble: "지도에서 보기" 버튼 클릭
    Bubble->>Bubble: 네이버지도 앱 딥링크 시도
    Bubble-->>User: 네이버지도 앱 또는 웹 URL 실행
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • Cassiiopeia
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 '채팅 화면에서 위치전송 기능 추가'로 명확하게 주요 변경사항을 설명하고 있으며, 실제 변경 내용(위치 전송 기능의 전 범위 구현)과 일치합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 20260330_#730_채팅_화면에서_위치전송_기능_추가

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

✅ 프로젝트 빌드 성공

APK 빌드가 완료되었습니다.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (8)
docs/superpowers/plans/2026-04-02-chat-location-share.md (2)

465-466: iconSize.h 대신 .w 사용 권장

코딩 가이드라인에 따르면 이미지 및 정사각형 요소에는 안전한 iPad 반응형을 위해 height: N.w(너비 기반 스케일링)를 사용해야 합니다. iconSize: 24.hiconSize: 24.w로 변경하는 것이 좋습니다.

                   child: CurrentLocationButton(
                     onTap: () async {
                       ...
                     },
-                    iconSize: 24.h,
+                    iconSize: 24.w,
                   ),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/plans/2026-04-02-chat-location-share.md` around lines 465 -
466, Change the square/icon sizing to use width-based scaling: replace the
property value using the height scaler (iconSize: 24.h) with the width scaler
(iconSize: 24.w) wherever the iconSize is used for image or square elements to
comply with the iPad responsive guideline; update the occurrence that currently
reads "iconSize: 24.h" to "iconSize: 24.w".

406-406: logoMargin.h 스케일링 검토 필요

bottom: 137.h는 iPad에서 과도하게 스케일링될 수 있습니다. 고정 픽셀 값 또는 .w 기반 스케일링 사용을 고려해 주세요.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/plans/2026-04-02-chat-location-share.md` at line 406,
logoMargin에 지정된 EdgeInsets(NEdgeInsets.fromEdgeInsets(EdgeInsets.only(left:
24.w, bottom: 137.h)))에서 bottom에 .h 스케일링이 과도하게 적용될 수 있으니 iPad 등 큰 화면에서 안전한 값으로
변경하세요; 해결책으로는 bottom을 고정 픽셀값으로 변경하거나(예: 137 대신 디자인 기준 픽셀), .w 기반 스케일링으로 변환하거나,
화면 크기/플랫폼 조건을 체크해 iPad에는 다른 값(또는 비례 로직)을 적용하는 방식으로 수정하고 해당 변경을 logoMargin이 사용되는
위치와 NEdgeInsets.fromEdgeInsets 호출에서 반영하세요.
docs/superpowers/specs/2026-04-02-chat-location-share-design.md (2)

81-91: 펜스 코드 블록에 언어 지정 추가 권장

URL 및 헤더 블록에도 언어를 지정해 주세요. text 또는 http를 사용할 수 있습니다.

-```
+```text
 URL: https://naveropenapi.apigw.ntruss.com/map-static/v2/raster
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/specs/2026-04-02-chat-location-share-design.md` around lines
81 - 91, The fenced code blocks under the "Static Maps API" section currently
lack a language specifier; update the three blocks (the opening block that
contains the URL parameters, the one labeled "URL: ..." and the "Headers:"
block) to use a language tag such as text or http (e.g., change ``` to ```text
or ```http) so syntax highlighting and tooling treat them correctly; ensure the
markers remain unchanged (center, markers, Headers and header keys
X-NCP-APIGW-API-KEY-ID / X-NCP-APIGW-API-KEY) when adding the language
specifier.

69-79: 펜스 코드 블록에 언어 지정 추가 권장

정적 분석 도구(markdownlint)에서 펜스 코드 블록에 언어가 지정되지 않았다고 경고합니다. ASCII 다이어그램의 경우 text 또는 plaintext를 사용할 수 있습니다.

-```
+```text
 ┌────────────────────────┐
 │   Naver Static Map     │  Image.network (264w × 160h)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/specs/2026-04-02-chat-location-share-design.md` around lines
69 - 79, The fenced ASCII diagram code block lacks a language tag which triggers
markdownlint; update the fence where the map diagram (the block starting with
"┌────────────────────────┐" and lines including "Naver Static Map" and
"Image.network (264w × 160h)") is defined to include a language specifier such
as "text" or "plaintext" (e.g., change ``` to ```text) so the linter stops
warning and the block is treated as plain text.
lib/screens/chat_location_picker_screen.dart (2)

188-188: iconSize.h 대신 .w 사용 권장

아이콘 크기에 24.h를 사용하고 있는데, iPad에서 과도하게 커질 수 있습니다.

♻️ 제안하는 수정
-                    iconSize: 24.h,
+                    iconSize: 24.w,

As per coding guidelines: "Use height: N.w (width-based scaling) instead of height: N.h for images and square elements for safer iPad responsiveness"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/screens/chat_location_picker_screen.dart` at line 188, In
ChatLocationPickerScreen replace the height-based scaling on the icon with
width-based scaling: locate the iconSize property (currently set to 24.h) in the
widget inside ChatLocationPickerScreen and change it to use 24.w so square
elements/icons scale by width (safer for iPad responsiveness).

119-119: iPad 반응형 대응: height.h 대신 .w 사용 권장

지도 이미지 컨테이너의 높이에 176.h를 사용하고 있습니다. 코딩 가이드라인에 따르면 이미지 및 정사각형 요소의 높이는 iPad 반응형을 위해 .w 기반 스케일링을 사용해야 합니다.

♻️ 제안하는 수정
-            SizedBox(width: bubbleWidth, height: 176.h, child: _buildMapImage(bubbleWidth)),
+            SizedBox(width: bubbleWidth, height: 176.w, child: _buildMapImage(bubbleWidth)),

As per coding guidelines: "Use height: N.w (width-based scaling) instead of height: N.h for images and square elements for safer iPad responsiveness"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/screens/chat_location_picker_screen.dart` at line 119, Change the map
image container's height scaling from height: 176.h to width-based scaling
height: 176.w inside ChatLocationPickerScreen (the 지도 이미지 컨테이너 where you set
height: 176.h); replace the `.h` suffix with `.w` so the image/square element
uses width-based responsiveness for iPad.
lib/widgets/chat_location_bubble.dart (2)

138-138: 버튼 내부 vertical padding에 .h 사용 주의

EdgeInsets.symmetric(vertical: 12.h)는 iPad에서 과도하게 스케일링될 수 있습니다. 고정 픽셀 값이나 .w 기반 값을 고려해 보세요.

♻️ 제안하는 수정
-                  padding: EdgeInsets.symmetric(vertical: 12.h),
+                  padding: EdgeInsets.symmetric(vertical: 12.w),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/widgets/chat_location_bubble.dart` at line 138, The vertical padding uses
ScreenUtil's `.h` which over-scales on iPad; in the ChatLocationBubble widget
replace EdgeInsets.symmetric(vertical: 12.h) with a non-`.h` value (e.g.
EdgeInsets.symmetric(vertical: 12) for fixed logical pixels or
EdgeInsets.symmetric(vertical: 12.w) if you want width-based scaling) in the
padding property so the vertical spacing doesn't grow excessively on tablets.

119-119: iPad 반응형 대응: 이미지/지도 높이에 .w 사용 권장

Line 119와 172에서 지도 이미지 높이에 176.h를 사용하고 있습니다. iPad에서 과도하게 커질 수 있으므로 .w 기반 스케일링을 권장합니다.

♻️ 제안하는 수정
-            SizedBox(width: bubbleWidth, height: 176.h, child: _buildMapImage(bubbleWidth)),
+            SizedBox(width: bubbleWidth, height: 176.w, child: _buildMapImage(bubbleWidth)),
-    return Image.memory(_mapImageBytes!, width: width, height: 176.h, fit: BoxFit.cover);
+    return Image.memory(_mapImageBytes!, width: width, height: 176.w, fit: BoxFit.cover);

As per coding guidelines: "Use height: N.w (width-based scaling) instead of height: N.h for images and square elements for safer iPad responsiveness"

Also applies to: 172-172

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/widgets/chat_location_bubble.dart` at line 119, Change the height scaling
for the map image from height: 176.h to a width-based scale height: 176.w to
make iPad layout safer; update the SizedBox usage that wraps _buildMapImage (and
any other occurrences mentioned around the same file, e.g., the instance at line
~172) so image/map heights use .w instead of .h throughout; ensure any related
constrained containers for the map image or square elements follow the same .w
conversion to maintain consistent width-based scaling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/models/app_urls.dart`:
- Line 7: The constant naverStaticMapApiUrl currently uses the wrong host;
update the value of the static const String naverStaticMapApiUrl in the AppUrls
(or containing) class to use the official Naver Static Maps host by replacing
"maps.apigw.ntruss.com" with "naveropenapi.apigw.ntruss.com" so the endpoint
becomes the documented naveropenapi.apigw.ntruss.com domain for map-static v2
raster.

In `@lib/screens/chat_room_screen.dart`:
- Around line 529-535: The sendMessage call to _wsService.sendMessage (with
widget.chatRoomId and MessageType.location) is missing the address payload
required by ChatLocationBubble; update the call to include an address parameter
(e.g., address: address or address: formattedAddress) supplying the resolved
address string (or a safe fallback like empty string if resolution failed),
ensure the address variable is available at that call site (perform
reverse-geocoding earlier if needed), and verify ChatLocationBubble reads the
message.address field to display it.

In `@lib/widgets/chat_location_bubble.dart`:
- Around line 71-77: The calls to dotenv.get('NMF_CLIENT_ID') and
dotenv.get('NMF_CLIENT_SECRET') used when building the headers for the http.get
request can throw StateError if env vars are missing; extend the existing
try-catch that surrounds the HTTP call to also wrap the dotenv.get() calls (or
perform an upfront validation at app init) so missing env vars are handled
gracefully, and update the error handling path in the code that constructs
headers for the http.get call in chat_location_bubble.dart to log/handle
StateError and avoid an uncaught crash.

---

Nitpick comments:
In `@docs/superpowers/plans/2026-04-02-chat-location-share.md`:
- Around line 465-466: Change the square/icon sizing to use width-based scaling:
replace the property value using the height scaler (iconSize: 24.h) with the
width scaler (iconSize: 24.w) wherever the iconSize is used for image or square
elements to comply with the iPad responsive guideline; update the occurrence
that currently reads "iconSize: 24.h" to "iconSize: 24.w".
- Line 406: logoMargin에 지정된
EdgeInsets(NEdgeInsets.fromEdgeInsets(EdgeInsets.only(left: 24.w, bottom:
137.h)))에서 bottom에 .h 스케일링이 과도하게 적용될 수 있으니 iPad 등 큰 화면에서 안전한 값으로 변경하세요; 해결책으로는
bottom을 고정 픽셀값으로 변경하거나(예: 137 대신 디자인 기준 픽셀), .w 기반 스케일링으로 변환하거나, 화면 크기/플랫폼 조건을
체크해 iPad에는 다른 값(또는 비례 로직)을 적용하는 방식으로 수정하고 해당 변경을 logoMargin이 사용되는 위치와
NEdgeInsets.fromEdgeInsets 호출에서 반영하세요.

In `@docs/superpowers/specs/2026-04-02-chat-location-share-design.md`:
- Around line 81-91: The fenced code blocks under the "Static Maps API" section
currently lack a language specifier; update the three blocks (the opening block
that contains the URL parameters, the one labeled "URL: ..." and the "Headers:"
block) to use a language tag such as text or http (e.g., change ``` to ```text
or ```http) so syntax highlighting and tooling treat them correctly; ensure the
markers remain unchanged (center, markers, Headers and header keys
X-NCP-APIGW-API-KEY-ID / X-NCP-APIGW-API-KEY) when adding the language
specifier.
- Around line 69-79: The fenced ASCII diagram code block lacks a language tag
which triggers markdownlint; update the fence where the map diagram (the block
starting with "┌────────────────────────┐" and lines including "Naver Static
Map" and "Image.network (264w × 160h)") is defined to include a language
specifier such as "text" or "plaintext" (e.g., change ``` to ```text) so the
linter stops warning and the block is treated as plain text.

In `@lib/screens/chat_location_picker_screen.dart`:
- Line 188: In ChatLocationPickerScreen replace the height-based scaling on the
icon with width-based scaling: locate the iconSize property (currently set to
24.h) in the widget inside ChatLocationPickerScreen and change it to use 24.w so
square elements/icons scale by width (safer for iPad responsiveness).
- Line 119: Change the map image container's height scaling from height: 176.h
to width-based scaling height: 176.w inside ChatLocationPickerScreen (the 지도 이미지
컨테이너 where you set height: 176.h); replace the `.h` suffix with `.w` so the
image/square element uses width-based responsiveness for iPad.

In `@lib/widgets/chat_location_bubble.dart`:
- Line 138: The vertical padding uses ScreenUtil's `.h` which over-scales on
iPad; in the ChatLocationBubble widget replace EdgeInsets.symmetric(vertical:
12.h) with a non-`.h` value (e.g. EdgeInsets.symmetric(vertical: 12) for fixed
logical pixels or EdgeInsets.symmetric(vertical: 12.w) if you want width-based
scaling) in the padding property so the vertical spacing doesn't grow
excessively on tablets.
- Line 119: Change the height scaling for the map image from height: 176.h to a
width-based scale height: 176.w to make iPad layout safer; update the SizedBox
usage that wraps _buildMapImage (and any other occurrences mentioned around the
same file, e.g., the instance at line ~172) so image/map heights use .w instead
of .h throughout; ensure any related constrained containers for the map image or
square elements follow the same .w conversion to maintain consistent width-based
scaling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 98685519-e188-4b18-93ea-f12d29ea3463

📥 Commits

Reviewing files that changed from the base of the PR and between 84830aa and 297a936.

⛔ Files ignored due to path filters (1)
  • ios/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • docs/superpowers/plans/2026-04-02-chat-location-share.md
  • docs/superpowers/specs/2026-04-02-chat-location-share-design.md
  • lib/enums/message_type.dart
  • lib/models/apis/objects/chat_message.dart
  • lib/models/apis/objects/chat_message.g.dart
  • lib/models/app_urls.dart
  • lib/screens/chat_location_picker_screen.dart
  • lib/screens/chat_room_screen.dart
  • lib/services/chat_websocket_service.dart
  • lib/widgets/chat_input_bar.dart
  • lib/widgets/chat_location_bubble.dart
  • lib/widgets/chat_message_item.dart

Comment on lines +529 to +535
_wsService.sendMessage(
chatRoomId: widget.chatRoomId,
content: '위치를 보냈습니다.',
type: MessageType.location,
latitude: lat,
longitude: lng,
);
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

address 파라미터가 누락되었습니다

sendMessage 호출 시 address 파라미터가 전달되지 않고 있습니다. 설계 문서와 구현 계획에 따르면 위치 메시지 payload에 주소가 포함되어야 합니다. ChatLocationBubble에서 주소 텍스트를 표시하려면 이 값이 필요합니다.

🐛 수정 제안
+    final address = [result.siDo, result.siGunGu, result.eupMyoenDong]
+        .where((s) => s.isNotEmpty)
+        .join(' ');
+
     _wsService.sendMessage(
       chatRoomId: widget.chatRoomId,
       content: '위치를 보냈습니다.',
       type: MessageType.location,
       latitude: lat,
       longitude: lng,
+      address: address,
     );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_wsService.sendMessage(
chatRoomId: widget.chatRoomId,
content: '위치를 보냈습니다.',
type: MessageType.location,
latitude: lat,
longitude: lng,
);
final address = [result.siDo, result.siGunGu, result.eupMyoenDong]
.where((s) => s.isNotEmpty)
.join(' ');
_wsService.sendMessage(
chatRoomId: widget.chatRoomId,
content: '위치를 보냈습니다.',
type: MessageType.location,
latitude: lat,
longitude: lng,
address: address,
);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/screens/chat_room_screen.dart` around lines 529 - 535, The sendMessage
call to _wsService.sendMessage (with widget.chatRoomId and MessageType.location)
is missing the address payload required by ChatLocationBubble; update the call
to include an address parameter (e.g., address: address or address:
formattedAddress) supplying the resolved address string (or a safe fallback like
empty string if resolution failed), ensure the address variable is available at
that call site (perform reverse-geocoding earlier if needed), and verify
ChatLocationBubble reads the message.address field to display it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

백엔드에서 address값은 받지 않고 있고 latitude와 longitude로 주소 텍스트를 표시하고 있어서 괜찮아

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SeoHyun1024, 맞습니다! ChatLocationBubble에서 latitude/longitude를 이용해 클라이언트 측에서 역지오코딩으로 주소를 표시하는 구조군요. 제 리뷰 코멘트가 잘못되었습니다. 이 부분은 현재 구현 방식 그대로가 맞습니다. 감사합니다!


✏️ Learnings added
Learnt from: SeoHyun1024
Repo: TEAM-ROMROM/RomRom-FE PR: 747
File: lib/screens/chat_room_screen.dart:529-535
Timestamp: 2026-04-06T07:32:27.721Z
Learning: In the RomRom-FE project (`lib/widgets/chat_location_bubble.dart`), the `ChatLocationBubble` widget performs reverse-geocoding client-side using `latitude`/`longitude` from the `ChatMessage`. The backend does NOT store or receive an `address` field for location messages; address text is resolved entirely on the client. Therefore, the `sendMessage` call for `MessageType.location` in `lib/screens/chat_room_screen.dart` does not need to pass an `address` parameter.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: TEAM-ROMROM/RomRom-FE PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-29T13:04:47.140Z
Learning: Applies to **/*.dart : Implement fallback handling for permission failures (e.g., Seoul City Hall coordinates) and never keep loading screens when `_currentPosition == null`

Comment on lines +71 to +77
final response = await http.get(
uri,
headers: {
'x-ncp-apigw-api-key-id': dotenv.get('NMF_CLIENT_ID'),
'x-ncp-apigw-api-key': dotenv.get('NMF_CLIENT_SECRET'),
},
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: .env 파일에서 NMF_CLIENT_ID, NMF_CLIENT_SECRET 설정 여부 확인
# Expected: 환경 변수가 정의되어 있어야 함

# .env 파일 찾기
fd -t f '.env' --hidden | head -5

# 프로젝트에서 dotenv 초기화 방식 확인
rg -n 'dotenv\.load' --type dart -A2

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 420


🏁 Script executed:

# Check the full context of the chat_location_bubble.dart file around lines 71-77
cat -n lib/widgets/chat_location_bubble.dart | sed -n '60,85p'

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 965


🏁 Script executed:

# Search for how dotenv.get() is used elsewhere in the codebase with error handling
rg -n 'dotenv\.get' --type dart -B2 -A2 | head -50

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 3548


🏁 Script executed:

# Check the .env file to see if these keys are defined
cat .env 2>/dev/null || echo "No .env file in root"

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 85


🏁 Script executed:

# Search for documentation about required environment variables
find . -name "*.md" -o -name "*.txt" | xargs grep -l "NMF_CLIENT" 2>/dev/null | head -5

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 189


🏁 Script executed:

# Check the documentation files for environment variable requirements
cat ./docs/superpowers/specs/2026-04-02-chat-location-share-design.md

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 2855


🏁 Script executed:

# Check app_initializer.dart to understand the initialization flow and error handling
cat -n lib/services/app_initializer.dart | head -60

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 1852


🏁 Script executed:

# Check if there's any validation or assertion of required environment variables
rg -n 'assert|throw|NMF_CLIENT_ID|NMF_CLIENT_SECRET' --type dart | grep -E '(assert|throw|validate)' | head -20

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 1912


🏁 Script executed:

# Check pubspec.yaml to understand flutter_dotenv version and configuration
rg -n 'flutter_dotenv' pubspec.yaml -A2

Repository: TEAM-ROMROM/RomRom-FE

Length of output: 161


환경 변수 누락 시 예외 처리 강화 필요

dotenv.get('NMF_CLIENT_ID')dotenv.get('NMF_CLIENT_SECRET')는 환경 변수가 설정되지 않았을 경우 StateError를 발생시킵니다. 현재 try-catch 블록(60-85줄)은 HTTP 요청 에러만 처리하고 dotenv 예외는 처리하지 않아, 앱 초기화 후에도 .env 파일에 이 키들이 누락되면 런타임에 크래시가 발생할 수 있습니다.

설정된 값이 항상 존재한다고 가정하거나, try-catch를 dotenv.get() 호출까지 확대하거나, 앱 초기화 단계에서 필수 환경 변수 존재 여부를 검증해야 합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/widgets/chat_location_bubble.dart` around lines 71 - 77, The calls to
dotenv.get('NMF_CLIENT_ID') and dotenv.get('NMF_CLIENT_SECRET') used when
building the headers for the http.get request can throw StateError if env vars
are missing; extend the existing try-catch that surrounds the HTTP call to also
wrap the dotenv.get() calls (or perform an upfront validation at app init) so
missing env vars are handled gracefully, and update the error handling path in
the code that constructs headers for the http.get call in
chat_location_bubble.dart to log/handle StateError and avoid an uncaught crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant