-
Notifications
You must be signed in to change notification settings - Fork 0
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] caching for post write page #212
Conversation
postWritePage의 나가기 dialog에 '임시 저장하기' 버튼 추가
PostWritePage의 ExitConfirmDialog의 onTap 메소드를 추가함(onTapSave/onTapConfirm). 이후 사용 파일 내부에서 임시 저장 코드를 구현하도록 함.
onTapSave(임시저장) 이후, onTapConfirm(나가기)를 자동으로 호출하도록 함.
누락된 post_write_page.dart의 내용을 커밋함.
lib/pages/post_write_page.dart
Outdated
: '/cache/${userID}/'; | ||
|
||
await cacheApiData(key, data); | ||
print(key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print() 대신 debugPrint()를 사용하는 것이 OS의 compatibility를 높이고 일관성 있다고 합니다
(참고 : https://stackoverflow.com/questions/66841141/flutter-when-to-use-print-and-debugprint)
lib/pages/post_write_page.dart
Outdated
: 'REGULAR') | ||
: 'REGULAR', | ||
}; | ||
data['parent_topic'] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 key들을 data를 정의할 때 사용하지 않은 이유가 있나요? (var data로 지정한 이유)
일반적으로 flutter에서는 Stateful한 상황이 아니면 const 혹은 final을 사용하는 것이 immutability 때문에 선호된다고 합니다
lib/pages/post_write_page.dart
Outdated
String key = (_isEditingPost) | ||
? '/cache/${widget.previousArticle!.id}/' | ||
: '/cache/${userID}/'; | ||
dynamic cachedData = await fetchCachedApiData(key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서도 마찬가지로 변수형을 dynamic 보다는 dictionary 형태이기 때문에 List<Map<String, dynamic>>로 지정하는 것이 더 일반적입니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Overview
캐싱 기능 추가
Changes
ExitConfirmDialog에서 save 선택시 입력한 내용이 캐싱됨
Implementaion Method
After Changes
Simulator.Screen.Recording.-.iPhone.15.-.2024-08-15.at.20.15.24.mp4
Related Issues
Rollback Scenario
TODO