File tree Expand file tree Collapse file tree 4 files changed +44
-8
lines changed
Expand file tree Collapse file tree 4 files changed +44
-8
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,13 @@ void main() async {
5151 ),
5252 ],
5353 );
54- final initSettings = InitializationSettings (iOS: iosInit);
54+ const androidInit = AndroidInitializationSettings ('@mipmap/ic_launcher' );
55+
56+ final initSettings = InitializationSettings (
57+ android: androidInit,
58+ iOS: iosInit,
59+ );
60+
5561 await flutterLocalNotificationsPlugin.initialize (
5662 initSettings,
5763 onDidReceiveNotificationResponse: (resp) {
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import 'package:flutter_svg/svg.dart';
44import 'package:ongi/core/app_orange_background.dart' ;
55import 'package:ongi/core/app_colors.dart' ;
66import 'package:ongi/screens/bottom_nav.dart' ;
7+ import 'package:ongi/services/maumlog_service.dart' ;
8+ import 'package:ongi/utils/prefs_manager.dart' ;
79
810class PhotoRemindPopup extends StatelessWidget {
911 const PhotoRemindPopup ({super .key});
@@ -117,10 +119,14 @@ class PhotoRemindPopup extends StatelessWidget {
117119 );
118120 });
119121
120- // TODO: 실제 API 호출로 대체
121- await Future .delayed (
122- const Duration (milliseconds: 500 ),
123- );
122+ // 실제 재촉하기 API 호출
123+ final accessToken = await PrefsManager .getAccessToken ();
124+ if (accessToken == null ) {
125+ throw Exception ('로그인이 필요합니다. 다시 로그인해주세요.' );
126+ }
127+
128+ final service = MaumlogService ();
129+ await service.sendReminder (accessToken: accessToken);
124130
125131 if (context.mounted) {
126132 ScaffoldMessenger .of (context).showSnackBar (
@@ -169,10 +175,10 @@ class PhotoRemindPopup extends StatelessWidget {
169175 } catch (e) {
170176 if (context.mounted) {
171177 ScaffoldMessenger .of (context).showSnackBar (
172- const SnackBar (
178+ SnackBar (
173179 content: Text (
174180 '알림 전송에 실패했습니다. 다시 시도해주세요.' ,
175- style: TextStyle (
181+ style: const TextStyle (
176182 fontSize: 16 ,
177183 fontWeight: FontWeight .w500,
178184 ),
Original file line number Diff line number Diff line change @@ -189,4 +189,28 @@ class MaumlogService {
189189 throw Exception ('마음기록 리스트를 불러오지 못했습니다' );
190190 }
191191 }
192+
193+ // 재촉하기 API 호출
194+ Future <void > sendReminder ({
195+ required String accessToken,
196+ }) async {
197+ final url = Uri .parse ('$baseUrl /maum-log/reminder' );
198+ print ('🔔 재촉하기 API 호출 URL: $url ' );
199+
200+ final response = await http.post (
201+ url,
202+ headers: {
203+ "Authorization" : "Bearer $accessToken " ,
204+ },
205+ );
206+
207+ print ('📡 재촉하기 응답 상태: ${response .statusCode }' );
208+ print ('📄 재촉하기 응답 본문: ${response .body }' );
209+
210+ if (response.statusCode != 200 && response.statusCode != 201 ) {
211+ throw Exception ('재촉하기 알림 전송 실패: Status ${response .statusCode }, Body: ${response .body }' );
212+ }
213+
214+ print ('✅ 재촉하기 알림 전송 성공' );
215+ }
192216}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ description: "A new Flutter project."
33
44publish_to : ' none'
55
6- version : 1.0.1+2
6+ version : 1.0.1+4
77
88environment :
99 sdk : ^3.8.1
You can’t perform that action at this time.
0 commit comments