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

๐Ÿ”€ :: [#68] ๋ฐ•๋žŒํšŒ ์ƒ์„ฑ ๊ธฐ๋Šฅ์ถ”๊ฐ€ #69

Merged
merged 13 commits into from
Dec 8, 2024

Conversation

Xixn2
Copy link
Member

@Xixn2 Xixn2 commented Dec 7, 2024

๐Ÿ’ก ๊ฐœ์š”

๐Ÿ“ƒ ์ž‘์—…๋‚ด์šฉ

  • UIImage Extension์„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. (์ด๋ฏธ์ง€ ์••์ถ•๊ณผ ํฌ๊ธฐ ์กฐ์ •์„ ์œ„ํ•œ 'compressedAndResized' ๋ฉ”์„œ๋“œ๋ฅผ ํฌํ•จ)
  • convertImageToBase64String ํ•จ์ˆ˜์˜ ์••์ถ• ํ’ˆ์งˆ์„ 0.7๋กœ ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • setupCoverImage ํ•จ์ˆ˜๋ฅผ ์ˆ˜์ •ํ•˜์—ฌ UIImage๋ฅผ ์ง์ ‘ ๋ฐ›์•„ Base64 ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • expoCreate ํ•จ์ˆ˜ ๋‚ด์—์„œ ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ์ปค๋ฒ„ ์ด๋ฏธ์ง€์˜ Base64 ๊ธธ์ด๋ฅผ ์ถœ๋ ฅํ•˜๋„๋ก ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๋ชจ๋“  print ๋ฌธ์„ ํ•œ๊ตญ์–ด๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ๋””๋ฒ„๊น… ๋ฉ”์‹œ์ง€๋ฅผ ๋” ์‰ฝ๊ฒŒ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์ผ๋ฐ˜ ํ”„๋กœ๊ทธ๋žจ ์ƒ์„ฑ ์‹œ ์—ฐ์ˆ˜ ํ”„๋กœ๊ทธ๋žจ๋„ ์ค‘๋ณต ์ƒ์„ฑ๋˜๋Š” ์˜ค๋ฅ˜๋ฅผ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • Expo CreateView์— ๋’ค๋กœ๊ฐ€๊ธฐ ๋ฒ„ํŠผ์„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

Summary by CodeRabbit

Release Notes

  • New Features

    • ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์กฐ์ • ๋ฐ ์••์ถ• ๊ธฐ๋Šฅ์„ ์•ฑ์— ๋„์ž…ํ–ˆ์Šต๋‹ˆ๋‹ค.
    • ์‚ฌ์šฉ์ž๊ฐ€ ๋™์ ์œผ๋กœ ํ”„๋กœ๊ทธ๋žจ ์ˆ˜๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ๊ฐœ์„ ๋œ ์–‘์‹ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ๋ฅผ ํ†ตํ•ด Expos๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ์ƒˆ๋กœ์šด ๋ทฐ๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
    • Expos ์ƒ์„ฑ์„ ์œ„ํ•œ ์ƒˆ๋กœ์šด API๋ฅผ ๊ตฌํ˜„ํ•˜์—ฌ ๊ตฌ์กฐํ™”๋œ ์š”์ฒญ ๋ฐ ์‘๋‹ต์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • Bug Fixes

    • ์—ฌ๋Ÿฌ ๋ทฐ์—์„œ ๋‚ ์งœ ํ˜•์‹์„ ์—…๋ฐ์ดํŠธํ•˜์—ฌ ์ผ๊ด€์„ฑ์„ ๋ณด์žฅํ–ˆ์Šต๋‹ˆ๋‹ค.
  • Chores

    • ํŠน์ • ํŒŒ์ผ ๋ฐ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ œ์™ธํ•˜๋„๋ก .gitignore๋ฅผ ๊ฐœ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.
    • ์ฝ”๋“œ ํ’ˆ์งˆ ํ–ฅ์ƒ์„ ์œ„ํ•œ SwiftLint ๊ตฌ์„ฑ ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • Refactor

    • ๋กœ๊ทธ์ธ ํ”„๋กœ์„ธ์Šค์˜ ๋‚ด๋น„๊ฒŒ์ด์…˜ ํ๋ฆ„์„ ์—…๋ฐ์ดํŠธํ•˜์—ฌ ์‚ฌ์šฉ์ž๋ฅผ ์ƒˆ๋กœ์šด Expo ์ƒ์„ฑ ๋ทฐ๋กœ ์•ˆ๋‚ดํ•˜๋„๋ก ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.

@Xixn2 Xixn2 added 2๏ธโƒฃ Priority: Medium ์šฐ์„ ์ˆœ์œ„ - ์ค‘ โšก๏ธperformance ์„ฑ๋Šฅ ๊ฐœ์„  โœจ Feature ์‹ ๊ทœ ๊ธฐ๋Šฅ labels Dec 7, 2024
@Xixn2 Xixn2 self-assigned this Dec 7, 2024
@Xixn2 Xixn2 linked an issue Dec 7, 2024 that may be closed by this pull request
Copy link

coderabbitai bot commented Dec 7, 2024

Walkthrough

์ด๋ฒˆ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์€ ์—ฌ๋Ÿฌ ํŒŒ์ผ์— ๋Œ€ํ•œ ์ˆ˜์ •์œผ๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์˜ ๋„์ž…๊ณผ ๊ธฐ์กด ๊ธฐ๋Šฅ์˜ ์—…๋ฐ์ดํŠธ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. ์ฃผ์š” ์—…๋ฐ์ดํŠธ๋กœ๋Š” ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์กฐ์ • ๋ฐ ์••์ถ•์„ ์œ„ํ•œ ์ƒˆ๋กœ์šด Swift ํŒŒ์ผ ์ถ”๊ฐ€, Expo ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ทฐ์˜ ๋ฆฌํŒฉํ† ๋ง, Expo ์ƒ์„ฑ์„ ์œ„ํ•œ ์—ฌ๋Ÿฌ ์ƒˆ๋กœ์šด ๋ชจ๋ธ ๋ฐ API ์ฒ˜๋ฆฌ์˜ ๋„์ž…์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, .gitignore ํŒŒ์ผ์— ์ƒˆ๋กœ์šด ํŒจํ„ด์ด ์ถ”๊ฐ€๋˜์—ˆ๊ณ , ์ฝ”๋“œ ํ‘œ์ค€์„ ์‹œํ–‰ํ•˜๊ธฐ ์œ„ํ•œ SwiftLint ๊ตฌ์„ฑ ํŒŒ์ผ์ด ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Changes

File Path Change Summary
.gitignore Added patterns: *.png (Tuist), .runtimeconfig.json, and .firebase/ (Firebase)
Projects/App/Sources/Extension/UIImageSize.swift Added UIImage extension with method compressedAndResized(maxWidth:maxHeight:compressionQuality:)
Projects/App/Sources/Feature/ExpoApplicationFeature/Sources/ExpoCreateView.swift Refactored ExpoApplicationView to ExpoCreateView, added state variables, updated date format, and form validation logic.
Projects/App/Sources/Feature/ExpoApplicationFeature/Sources/ExpoCreateViewModel.swift Introduced ExpoCreateViewModel class for managing Expo creation state and behavior.
Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift Updated date formatting logic in formatDateInput function.
Projects/App/Sources/Feature/PostDetailFeature/Sources/PostDetailView.swift Updated initial value of link state variable for QR code generation.
Projects/App/Sources/Feature/SigninFeature/Sources/SigninView.swift Changed navigation destination on successful sign-in to ExpoCreateView.
Projects/App/Sources/Feature/TabBarFeature/Sources/TabBarView.swift Added expoCreateViewModel state object and restructured tab items.
Projects/Domain/Sources/Extension/ExpoToken.swift Changed visibility of saveTokenWithExpiration method to public.
Projects/Domain/Sources/Model/Expo/Response/ExpoCreateResponse.swift Introduced ExpoCreateResponse struct with expoId property.
Projects/Domain/Sources/Request/ExpoCreate/ExpoCreateRequest.swift Introduced ExpoCreateRequest struct with properties for creating expo requests.
Projects/Domain/Sources/Services/Expo/ExpoAPI.swift Introduced ExpoAPI enum with case for creating an Expo resource and network handling.
Scripts/.swiftlint.yml Added SwiftLint configuration with specified rules and settings.

Poem

๐Ÿ‡ ๋ณ€ํ™”๊ฐ€ ํ”ผ์–ด๋‚˜๋Š” ์ดˆ์›์—์„œ,
์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์ด ์šฐ์šธ์„ ๋‚ ๋ ค๋ฒ„๋ ค์š”.
์ด๋ฏธ์ง€๊ฐ€ ์กฐ์ •๋˜๊ณ , ๋งํฌ๋„ ์ƒˆ๋กœ์›Œ,
Expo๊ฐ€ ์ž๋ผ๋‚˜๋ฉฐ ๊ฟˆ์ด ์ด๋ฃจ์–ด์ ธ์š”.
ํ•จ๊ป˜ ๋›ฐ์–ด๋‹ค๋‹ˆ๋ฉฐ ์ถ•ํ•˜ํ•ด์š”,
๋” ๋ฐ์€ ์ฝ”๋“œ๋ฅผ ์ด์ œ ๋งŒ๋“ค์–ด์š”! ๐ŸŒผ


๐Ÿ“œ Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 997df51 and ba53c7f.

๐Ÿ“’ Files selected for processing (1)
  • Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift (2 hunks)
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

โค๏ธ Share
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 8

๐Ÿงน Outside diff range and nitpick comments (9)
Projects/App/Sources/Extension/UIImageSize.swift (1)

12-26: Add documentation and input validation

While the implementation is solid, consider these improvements:

  1. Add documentation comments explaining the parameters and return value
  2. Add validation for edge cases

Here's a suggested improvement:

+ /// Resizes and compresses an image while maintaining aspect ratio
+ /// - Parameters:
+ ///   - maxWidth: Maximum width of the output image (default: 512)
+ ///   - maxHeight: Maximum height of the output image (default: 512)
+ ///   - compressionQuality: JPEG compression quality between 0 and 1 (default: 0.7)
+ /// - Returns: A compressed and resized UIImage, or nil if processing fails
 func compressedAndResized(maxWidth: CGFloat = 512, maxHeight: CGFloat = 512, compressionQuality: CGFloat = 0.7) -> UIImage? {
+    guard maxWidth > 0, maxHeight > 0, compressionQuality > 0, compressionQuality <= 1 else { return nil }
+    guard self.size.width > 0, self.size.height > 0 else { return nil }
     
     let scale = min(maxWidth / self.size.width, maxHeight / self.size.height, 1)
Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift (1)

Line range hint 150-154: Update the hint text to match the new date format

The hint text still shows the old format ("yyyy.mm.dd") while the actual implementation uses hyphens ("yyyy-mm-dd"). This inconsistency could confuse users.

Apply this diff to update the hint text:

-                    Text("์‹œ์ž‘์ผ๊ณผ ๋งˆ๊ฐ์ผ ์ž…๋ ฅ์‹œ ' yyyy.mm.dd  ' ํ˜•์‹์œผ๋กœ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”")
+                    Text("์‹œ์ž‘์ผ๊ณผ ๋งˆ๊ฐ์ผ ์ž…๋ ฅ์‹œ ' yyyy-mm-dd  ' ํ˜•์‹์œผ๋กœ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”")
Projects/App/Sources/Feature/TabBarFeature/Sources/TabBarView.swift (1)

MainView implementation is specific to expo listings and shouldn't be reused across tabs

The MainView implementation is specifically designed for displaying expo listings with features like:

  • Expo logo display
  • Sorting functionality for expo entries
  • List of expo events with dates, titles, and descriptions

Using this same view for "Home" and "Profile" tabs is incorrect as these tabs would require different content and functionality. Each tab should have its dedicated view:

  • HomeView for the home tab
  • ExpoListView (rename current MainView) for the expo listings tab
  • ProfileView for the profile tab
๐Ÿ”— Analysis chain

Line range hint 19-50: Verify MainView implementation for different tabs

The same MainView() is being used for three different tabs (Home, Expo List, and Profile) without any customization. This might not provide the intended unique functionality for each tab.

Consider creating separate view components for each tab to maintain better separation of concerns and provide tab-specific functionality.


The previous ast-grep pattern might have failed due to syntax issues with Swift. Let's try these alternative approaches to locate and understand the MainView implementation.


I see that MainView exists in a separate feature module, but we need to examine its implementation to understand if it's designed to handle different tab contexts or if it's a generic view being incorrectly reused.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check MainView implementation
ast-grep --pattern 'struct MainView: View {
  $$$
}'

Length of output: 54


Script:

#!/bin/bash
# Let's try different approaches to find MainView implementation
# 1. Search for MainView using ripgrep
rg "MainView" -A 5

# 2. Try finding Swift view files that might contain MainView
fd -e swift . | xargs rg "MainView"

# 3. Look for files with MainView in their name
fd "MainView"

Length of output: 3693


Script:

#!/bin/bash
# Let's examine the MainView implementation to understand its content
cat Projects/App/Sources/Feature/MainFeature/Sources/MainView.swift

Length of output: 5074

Projects/App/Sources/Feature/ExpoApplicationFeature/Sources/ExpoCreateView.swift (3)

127-127: Clarify the date format in the warning message

The warning message specifies the date format as ' yyyy-mm-dd ', including extra spaces and apostrophes. Consider updating it to yyyy-MM-dd without additional characters for better clarity.


155-194: Refactor duplicated code for program sections

The code for "์ผ๋ฐ˜ ํ”„๋กœ๊ทธ๋žจ" and "์—ฐ์ˆ˜์ž ํ”„๋กœ๊ทธ๋žจ" sections is nearly identical. Consider creating a reusable view component for these sections to reduce code duplication and enhance maintainability.


28-41: Adjust navigation bar layout for better alignment

The current navigation bar layout might cause misalignment of the back button and title, especially on devices with different screen sizes. Consider using ToolbarItem and navigationTitle modifiers to ensure consistent alignment across all devices.

Projects/Domain/Sources/Services/Expo/ExpoAPI.swift (1)

16-59: Externalize base URL and endpoints for flexibility

Currently, the base URL is hardcoded, which can make it difficult to manage different environments (development, staging, production). Consider externalizing the base URL and endpoints using configuration files or environment variables.

Projects/Domain/Sources/Extension/ExpoToken.swift (1)

Line range hint 38-63: Prevent logging of sensitive token data

Printing token information, such as in print("Token ์ €์žฅ ์™„๋ฃŒ: \(tokenString)"), can expose sensitive data. Remove these statements to enhance security.

Apply this diff to eliminate sensitive logging:

 if let encodedData = try? JSONEncoder().encode(tokenData),
    let tokenString = String(data: encodedData, encoding: .utf8) {
     create(key: key, token: tokenString)
-    print("Token ์ €์žฅ ์™„๋ฃŒ: \(tokenString)")
+    print("Token saved successfully")
 } else {
     print("TokenData ์ธ์ฝ”๋”ฉ ์‹คํŒจ")
 }
Projects/App/Sources/Feature/ExpoApplicationFeature/Sources/ExpoCreateViewModel.swift (1)

123-125: Provide user feedback on network errors

When a network error occurs, the app currently prints the error description. Consider informing the user with an alert or UI message to improve the user experience.

๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 1853b90 and 997df51.

๐Ÿ“’ Files selected for processing (13)
  • .gitignore (1 hunks)
  • Projects/App/Sources/Extension/UIImageSize.swift (1 hunks)
  • Projects/App/Sources/Feature/ExpoApplicationFeature/Sources/ExpoCreateView.swift (8 hunks)
  • Projects/App/Sources/Feature/ExpoApplicationFeature/Sources/ExpoCreateViewModel.swift (1 hunks)
  • Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift (1 hunks)
  • Projects/App/Sources/Feature/PostDetailFeature/Sources/PostDetailView.swift (1 hunks)
  • Projects/App/Sources/Feature/SigninFeature/Sources/SigninView.swift (1 hunks)
  • Projects/App/Sources/Feature/TabBarFeature/Sources/TabBarView.swift (2 hunks)
  • Projects/Domain/Sources/Extension/ExpoToken.swift (2 hunks)
  • Projects/Domain/Sources/Model/Expo/Response/ExpoCreateResponse.swift (1 hunks)
  • Projects/Domain/Sources/Request/ExpoCreate/ExpoCreateRequest.swift (1 hunks)
  • Projects/Domain/Sources/Services/Expo/ExpoAPI.swift (1 hunks)
  • Scripts/.swiftlint.yml (1 hunks)
โœ… Files skipped from review due to trivial changes (3)
  • Projects/Domain/Sources/Model/Expo/Response/ExpoCreateResponse.swift
  • .gitignore
  • Scripts/.swiftlint.yml
๐Ÿ”‡ Additional comments (5)
Projects/App/Sources/Extension/UIImageSize.swift (2)

1-10: LGTM! File structure follows best practices

The file header and import statement are properly structured following Swift conventions.


18-20: LGTM! Proper memory management with defer

The use of defer ensures proper cleanup of the graphics context, preventing memory leaks.

Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift (1)

Line range hint 265-277: LGTM on the date formatting implementation

The formatDateInput function:

  • Correctly handles partial input
  • Maintains the required 10-character length for form validation
  • Properly sanitizes input by filtering numbers
Projects/App/Sources/Feature/TabBarFeature/Sources/TabBarView.swift (1)

30-30: Verify tab bar image assets and enhance accessibility

The tab bar uses conditional image assets for selected/unselected states. Let's ensure these assets exist and consider accessibility improvements.

Consider adding accessibility labels to the tab items. Apply this enhancement:

 Image(selectedTab == 1 ? "onHome" : "offHome")
+    .accessibilityLabel("ํ™ˆ ํƒญ")
 Text("ํ™ˆ")

Also applies to: 38-38, 46-46

โœ… Verification successful

The previous command didn't show the assets, so let's try a different approach to locate the asset catalogs and image sets first. This will help us understand where to look for these specific images.


Tab bar image assets verified, accessibility improvements recommended

All required tab bar image assets are present in the Assets.xcassets:

  • onCheck/offCheck
  • onExpo/offExpo
  • onHome/offHome
  • onUser/offUser

The suggested accessibility improvements would enhance user experience and should be implemented as proposed in the original review.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if all required image assets exist
for img in "onHome" "offHome" "onCheck" "offCheck" "onExpo" "offExpo" "onUser" "offUser"; do
  fd -e xcassets -e pdf -e png "$img"
done

Length of output: 1037


Script:

#!/bin/bash
# Let's try a different approach to find image assets
# First, let's find all asset catalogs
fd -e xcassets

# Then let's try to find any image set files that might contain these images
fd -e imageset

Length of output: 1780

Projects/Domain/Sources/Extension/ExpoToken.swift (1)

38-38: Confirm the necessity of changing method access level to public

The saveTokenWithExpiration method has been changed to public. Ensure this change is necessary for external access and does not violate encapsulation principles.

@@ -16,7 +16,7 @@ struct PostDetailView: View {
@State private var drawMap: Bool = true
@State private var showMessageSheet = false
@State private var showQrcodeSheet = false
@State private var link: String = "https://github.com/School-of-Company/Expo-iOS"
@State private var link: String = "https://github.com/xixn2"
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

โš ๏ธ Potential issue

Review: GitHub link points to personal profile

The QR code generation link has been changed from the project repository to a personal GitHub profile. This might be unintentional and could affect the functionality of the QR code feature.

-    @State private var link: String = "https://github.com/xixn2"
+    @State private var link: String = "https://github.com/School-of-Company/Expo-iOS"

Consider moving the URL to a configuration file or environment variable instead of hardcoding it:

@State private var link: String = Configuration.shared.repositoryURL

Comment on lines +14 to +16
// ๋ทฐ ๋ชจ๋ธ์„ @StateObject๋กœ ์„ ์–ธ
@StateObject private var expoCreateViewModel = ExpoCreateViewModel()

Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

Remove duplicate ViewModel instantiation

The ExpoCreateViewModel is currently instantiated twice:

  1. As a @StateObject at line 15
  2. Again when creating ExpoCreateView at line 36

This could lead to state management issues as you're maintaining two separate instances of the same ViewModel.

Apply this fix to use the shared instance:

 @StateObject private var expoCreateViewModel = ExpoCreateViewModel()

 // Later in the TabView...
-ExpoCreateView(viewModel: ExpoCreateViewModel())
+ExpoCreateView(viewModel: expoCreateViewModel)

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +300 to +305
if let base64ImageString = viewModel.convertImageToBase64String(image: selectedImage) {
viewModel.setupCoverImage(image: selectedImage)
} else {
print("Failed to convert image to Base64")
}
}
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

Handle image conversion failure to prevent unintended behavior

In the expoCreate function, if the image fails to convert to a Base64 string, the coverImage is not set, but the code continues execution. This could lead to an API call with incomplete data. Consider adding error handling to stop the process if the image conversion fails.

Apply this diff to handle the error:

 if let selectedImage = selectedImage {
     if let base64ImageString = viewModel.convertImageToBase64String(image: selectedImage) {
         viewModel.setupCoverImage(image: selectedImage)
     } else {
         print("Failed to convert image to Base64")
+        return
     }
 }

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +11 to +40
public struct ExpoCreateRequest: Codable {
var title: String
var description: String
var startedDay: String
var finishedDay: String
var location: String
var coverImage: String
var x: Float
var y: Float

public init(
title: String,
description: String,
startedDay: String,
finishedDay: String,
location: String,
coverImage: String,
x: Float,
y: Float
) {
self.title = title
self.description = description
self.startedDay = startedDay
self.finishedDay = finishedDay
self.location = location
self.coverImage = coverImage
self.x = x
self.y = y
}
}
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

Make properties public for external access

The ExpoCreateRequest struct is declared as public, but its properties are not. This restricts access to these properties from other modules. To allow proper initialization and usage, consider making all properties public.

Apply this diff to update property access levels:

 public struct ExpoCreateRequest: Codable {
-    var title: String
-    var description: String
-    var startedDay: String
-    var finishedDay: String
-    var location: String
-    var coverImage: String
-    var x: Float
-    var y: Float
+    public var title: String
+    public var description: String
+    public var startedDay: String
+    public var finishedDay: String
+    public var location: String
+    public var coverImage: String
+    public var x: Float
+    public var y: Float

     public init(
         title: String,
         description: String,
         startedDay: String,
         finishedDay: String,
         location: String,
         coverImage: String,
         x: Float,
         y: Float
     ) {
         self.title = title
         self.description = description
         self.startedDay = startedDay
         self.finishedDay = finishedDay
         self.location = location
         self.coverImage = coverImage
         self.x = x
         self.y = y
     }
 }
๐Ÿ“ 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
public struct ExpoCreateRequest: Codable {
var title: String
var description: String
var startedDay: String
var finishedDay: String
var location: String
var coverImage: String
var x: Float
var y: Float
public init(
title: String,
description: String,
startedDay: String,
finishedDay: String,
location: String,
coverImage: String,
x: Float,
y: Float
) {
self.title = title
self.description = description
self.startedDay = startedDay
self.finishedDay = finishedDay
self.location = location
self.coverImage = coverImage
self.x = x
self.y = y
}
}
public struct ExpoCreateRequest: Codable {
public var title: String
public var description: String
public var startedDay: String
public var finishedDay: String
public var location: String
public var coverImage: String
public var x: Float
public var y: Float
public init(
title: String,
description: String,
startedDay: String,
finishedDay: String,
location: String,
coverImage: String,
x: Float,
y: Float
) {
self.title = title
self.description = description
self.startedDay = startedDay
self.finishedDay = finishedDay
self.location = location
self.coverImage = coverImage
self.x = x
self.y = y
}
}

Comment on lines +47 to +58
if let tokenData = KeyChain.shared.loadTokenWithExpiration(key: Const.KeyChainKey.accessToken),
!KeyChain.shared.isTokenExpired(key: Const.KeyChainKey.accessToken) {
print("Token found: \(tokenData.token)")
return [
"Content-Type": "application/json",
"Authorization": "Bearer \(tokenData.token)"
]
} else {
print("No valid token found, using default headers")
return ["Content-Type": "application/json"]
}
}
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

Avoid logging sensitive token information

Printing the access token in logs can lead to security vulnerabilities if logs are exposed. Remove any print statements that output token values.

Apply this diff to remove the sensitive log:

 if let tokenData = KeyChain.shared.loadTokenWithExpiration(key: Const.KeyChainKey.accessToken),
    !KeyChain.shared.isTokenExpired(key: Const.KeyChainKey.accessToken) {
-    print("Token found: \(tokenData.token)")
     return [
         "Content-Type": "application/json",
         "Authorization": "Bearer \(tokenData.token)"
     ]
 } else {
     print("No valid token found, using default headers")
     return ["Content-Type": "application/json"]
 }
๐Ÿ“ 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
if let tokenData = KeyChain.shared.loadTokenWithExpiration(key: Const.KeyChainKey.accessToken),
!KeyChain.shared.isTokenExpired(key: Const.KeyChainKey.accessToken) {
print("Token found: \(tokenData.token)")
return [
"Content-Type": "application/json",
"Authorization": "Bearer \(tokenData.token)"
]
} else {
print("No valid token found, using default headers")
return ["Content-Type": "application/json"]
}
}
if let tokenData = KeyChain.shared.loadTokenWithExpiration(key: Const.KeyChainKey.accessToken),
!KeyChain.shared.isTokenExpired(key: Const.KeyChainKey.accessToken) {
return [
"Content-Type": "application/json",
"Authorization": "Bearer \(tokenData.token)"
]
} else {
print("No valid token found, using default headers")
return ["Content-Type": "application/json"]
}
}

@Xixn2 Xixn2 requested a review from happytaeyoon December 8, 2024 05:13
@Xixn2 Xixn2 merged commit ac2f972 into develop Dec 8, 2024
3 checks passed
@Xixn2 Xixn2 deleted the 68-ExpoCreate-FunctionMake branch December 8, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2๏ธโƒฃ Priority: Medium ์šฐ์„ ์ˆœ์œ„ - ์ค‘ โœจ Feature ์‹ ๊ทœ ๊ธฐ๋Šฅ โšก๏ธperformance ์„ฑ๋Šฅ ๊ฐœ์„ 
Projects
None yet
Development

Successfully merging this pull request may close these issues.

๋ฐ•๋žŒํšŒ ์‹ ์ฒญ ๊ธฐ๋Šฅ๊ตฌํ˜„
2 participants