Skip to content
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

Merged
merged 8 commits into from
Aug 29, 2024

Conversation

sparcscasio
Copy link
Contributor

@sparcscasio sparcscasio commented Aug 14, 2024

Overview

캐싱 기능 추가

Changes

ExitConfirmDialog에서 save 선택시 입력한 내용이 캐싱됨

  • 글 수정 시 : /cache/${previousArticle.id}에 저장
  • 글 새로 작성시 : /cache/${userID} 에 저장됨
  • 작성 화면에서 onTapConfirm시 저장되어 있던 cache 삭제

Implementaion Method

After Changes

Simulator.Screen.Recording.-.iPhone.15.-.2024-08-15.at.20.15.24.mp4

Related Issues

Rollback Scenario

TODO

  • 이미지 업로드 시 에러 나는 거 해결 필요

thomaskim1130 and others added 5 commits August 12, 2024 06:44
postWritePage의 나가기 dialog에 '임시 저장하기' 버튼 추가
PostWritePage의 ExitConfirmDialog의 onTap 메소드를 추가함(onTapSave/onTapConfirm).
이후 사용 파일 내부에서 임시 저장 코드를 구현하도록 함.
onTapSave(임시저장) 이후, onTapConfirm(나가기)를 자동으로 호출하도록 함.
누락된 post_write_page.dart의 내용을 커밋함.
@sparcscasio sparcscasio self-assigned this Aug 14, 2024
@sparcscasio sparcscasio added the enhancement New feature or request label Aug 14, 2024
@sparcscasio sparcscasio added this to the v1.2.0 milestone Aug 14, 2024
@sparcscasio sparcscasio requested a review from sangohkim August 14, 2024 21:05
: '/cache/${userID}/';

await cacheApiData(key, data);
print(key);
Copy link
Contributor

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)

: 'REGULAR')
: 'REGULAR',
};
data['parent_topic'] =
Copy link
Contributor

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 때문에 선호된다고 합니다

String key = (_isEditingPost)
? '/cache/${widget.previousArticle!.id}/'
: '/cache/${userID}/';
dynamic cachedData = await fetchCachedApiData(key);
Copy link
Contributor

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>>로 지정하는 것이 더 일반적입니다

Copy link
Contributor

@thomaskim1130 thomaskim1130 left a comment

Choose a reason for hiding this comment

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

LGTM

@thomaskim1130 thomaskim1130 merged commit 5110cae into dev Aug 29, 2024
2 checks passed
@thomaskim1130 thomaskim1130 deleted the feat/caching-for-post-write-page branch August 29, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants