-
Notifications
You must be signed in to change notification settings - Fork 0
Bugfix #141
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
Bugfix #141
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,58 +330,6 @@ const MyPageScreen = ({ navigation }: any) => { | |
|
|
||
| <View style={styles.separator} /> | ||
|
|
||
| {/* 테스트 섹션 */} | ||
| <View style={styles.section}> | ||
| <Text style={styles.sectionTitle}>🧪 개발 테스트 (개발 전용)</Text> | ||
| <View style={styles.sectionLinks}> | ||
| {/* 멤버십 전환 버튼 */} | ||
| <TouchableOpacity | ||
| style={styles.linkItem} | ||
| onPress={handleToggleMembership} | ||
| > | ||
| <View style={styles.linkItemWithBadge}> | ||
| <Text | ||
| style={[ | ||
| styles.linkText, | ||
| { | ||
| color: | ||
| currentMembershipType === "PREMIUM" | ||
| ? "#FFD700" | ||
| : NEW_COLORS.accent, | ||
| }, | ||
| ]} | ||
| > | ||
| {currentMembershipType === "FREE" ? "🆓 → 💎" : "💎 → 🆓"}{" "} | ||
| 무료/유료 전환 | ||
| </Text> | ||
| <View | ||
| style={[ | ||
| styles.statusBadge, | ||
| currentMembershipType === "PREMIUM" && styles.premiumBadge, | ||
| ]} | ||
| > | ||
| <Text style={styles.statusBadgeText}> | ||
| {currentMembershipType === "FREE" ? "FREE" : "PREMIUM"} | ||
| </Text> | ||
| </View> | ||
| </View> | ||
| <Icon | ||
| name="swap-horizontal" | ||
| size={20} | ||
| color={ | ||
| currentMembershipType === "PREMIUM" | ||
| ? "#FFD700" | ||
| : NEW_COLORS.accent | ||
| } | ||
| /> | ||
| </TouchableOpacity> | ||
|
|
||
| <View style={styles.subSeparator} /> | ||
| </View> | ||
| </View> | ||
|
|
||
| <View style={styles.separator} /> | ||
|
|
||
| {/* 구독/결제 */} | ||
| <View style={styles.section}> | ||
| <Text style={styles.sectionTitle}>💳 구독/결제</Text> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 코드 패치에는 몇 가지 잠재적인 문제가 있습니다:
따라서, 이 코드를 병합하기 전에 위의 문제들을 해결하고 추가적인 논의가 필요합니다. |
||
|
|
||
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.
코드 검토
주석의 필요성: 제거된 주석들이 주요 기능이나 로직을 설명하고 있었기 때문에, 그 주석들을 완전히 제거하는 대신 중요한 주석들은 유지하는 것이 좋습니다. 특히 코드의 의도나 복잡한 로직을 설명하는 데 도움이 될 수 있습니다.
예외 처리:
loadExercisePlans및handleNewRecommendPress에서 API 호출 시 예외 처리 방법이 효과적이지만, 순수한 오류를 구분하지 않고 있기 때문에 더 구체적인 에러 처리가 필요할 수 있습니다. 예를 들어, 네트워크 오류와 JSON 파싱 오류를 다르게 처리하면 사용자 경험이 개선될 것입니다.타입 안전성:
any타입의 사용을 피하고, 적절한 타입을 정의하는 것이 중요합니다.reduce와 같은 함수에서 객체의 구조를 명확하게 정의하여 타입 안전성을 높일 수 있습니다.API 응답의 신뢰성:
weeklyResponse와dailyResponse의 형식에 대한 가정을 하여 처리하고 있으므로, 꼭 필요한 모든 필드가 응답에 포함되어 있는지 체크하는 로직을 추가하여 예기치 않은 동작을 방지할 필요가 있습니다.최신 상태 유지:
loadExercisePlans함수에서 데이터 로드 후 초기화 작업을 수행하거나, 상태를 업데이트 할 때 정확한 상태를 반영하고 있는지 확인하는 것이 중요합니다. 상태 업데이트가 비동기로 이루어지기 때문에 이 부분을 좀 더 신중하게 관리해야 합니다.함수의 역할 분리: 너무 많은 로직이
loadExercisePlans함수에 몰려있습니다. 단일 책임 원칙(SRP)을 준수하려면 각 기능을 별도의 작은 함수로 분리하는 것을 고려하세요. 이를 통해 코드 가독성과 유지보수성을 높일 수 있습니다.