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

๐Ÿš€ :: (#418) ์ „์ฒด ์˜ˆ์™ธ ์ฒ˜๋ฆฌ #423

Conversation

parkuiery
Copy link
Member

@parkuiery parkuiery commented Nov 7, 2024

๊ฐœ์š”

์ „์ฒด ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

์ž‘์—… ๋‚ด์šฉ

ํ•  ๋ง

์—†์Œ

Summary by CodeRabbit

  • ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ
    • UnknownException ๋ฐ ReissueException ์˜ˆ์™ธ ์ถ”๊ฐ€๋กœ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ๊ธฐ๋Šฅ ๊ฐ•ํ™”.
    • ์•ฑ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์˜ˆ์™ธ์— ๋Œ€ํ•œ ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ ์•Œ๋ฆผ ๋ฉ”์‹œ์ง€ ์ถ”๊ฐ€.
  • ๋ฒ„๊ทธ ์ˆ˜์ •
    • ํ† ํฐ ๊ฐฑ์‹  ์‹คํŒจ ์‹œ ์‚ฌ์šฉ์ž์—๊ฒŒ ์•Œ๋ฆผ์„ ์ œ๊ณตํ•˜๋Š” ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ๋กœ์ง ๊ฐœ์„ .
  • ๋ฌธ์„œํ™”
    • ์ƒˆ๋กœ์šด ์ƒ์ˆ˜ ์ถ”๊ฐ€๋กœ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€ ์ œ๊ณต ๋ฐฉ์‹ ๊ฐœ์„ .

@parkuiery parkuiery added ๋ฒ„๊ทธ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค. ๋ฆฌํŒฉํ† ๋ง ์ฝ”๋“œ๋ฅผ ๋ฆฌํŒฉํ† ๋ง ํ•ฉ๋‹ˆ๋‹ค. labels Nov 7, 2024
@parkuiery parkuiery self-assigned this Nov 7, 2024
@parkuiery parkuiery requested a review from a team as a code owner November 7, 2024 07:07
@parkuiery parkuiery linked an issue Nov 7, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Nov 7, 2024

Warning

Rate limit exceeded

@parkuiery has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 28 seconds before requesting another review.

โŒ› How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

๐Ÿšฆ How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between d06bf72 and ff313eb.

Walkthrough

์ด ๋ณ€๊ฒฝ ์‚ฌํ•ญ์€ team.retum.common.exception ํŒจํ‚ค์ง€์— ๋‘ ๊ฐœ์˜ ์ƒˆ๋กœ์šด ๋ฐ์ดํ„ฐ ๊ฐ์ฒด์ธ UnknownException๊ณผ ReissueException์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ๊ธฐ์กด์˜ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๊ตฌ์กฐ๊ฐ€ ํ™•์žฅ๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, RefreshTokenService.kt์™€ RequestHandler.kt ํŒŒ์ผ์—์„œ ์ƒˆ๋กœ์šด ์˜ˆ์™ธ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ๋กœ์ง์ด ์ˆ˜์ •๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰์œผ๋กœ, JobisApplication.kt ํŒŒ์ผ์—์„œ๋Š” uncaught ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๊ธฐ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ Firebase Crashlytics์™€์˜ ํ†ตํ•ฉ ๋ฐ ์‚ฌ์šฉ์ž์—๊ฒŒ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋ฅผ ํ‘œ์‹œํ•˜๋Š” ๊ธฐ๋Šฅ์ด ๊ฐ•ํ™”๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Changes

ํŒŒ์ผ ๊ฒฝ๋กœ ๋ณ€๊ฒฝ ์š”์•ฝ
core/common/src/main/java/team/retum/common/exception/RequestExceptions.kt UnknownException ๋ฐ ReissueException ๋ฐ์ดํ„ฐ ๊ฐ์ฒด ์ถ”๊ฐ€.
core/network/src/main/java/team/retum/network/util/RefreshTokenService.kt refreshToken ํ•จ์ˆ˜์—์„œ IllegalStateException ๋Œ€์‹  ReissueException์„ ๋˜์ง€๋„๋ก ์ˆ˜์ •.
core/network/src/main/java/team/retum/network/util/RequestHandler.kt UnknownException์„ ์‚ฌ์šฉํ•˜์—ฌ ์ผ๋ฐ˜ Throwable ์˜ˆ์™ธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋„๋ก ์ˆ˜์ •.
app/src/main/java/team/retum/jobisandroidv2/JobisApplication.kt uncaught ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๊ธฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ , Firebase Crashlytics์™€ ํ†ตํ•ฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์—๊ฒŒ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋ฅผ ํ‘œ์‹œํ•˜๋Š” ๊ธฐ๋Šฅ ์ถ”๊ฐ€.

Possibly related PRs

Suggested reviewers

  • Tmdhoon2

Poem

๐Ÿ‡ ๋ณ€ํ™”์˜ ๋ฐ”๋žŒ์ด ๋ถˆ์–ด์˜ค๋„ค,
๋‘ ์˜ˆ์™ธ๊ฐ€ ์ƒˆ๋กœ์ด ํƒœ์–ด๋‚˜๋„ค.
์˜ค๋ฅ˜๋Š” ์ด์ œ ๋” ๋ช…ํ™•ํ•˜๊ฒŒ,
์‚ฌ์šฉ์ž์—๊ฒŒ ๋ฉ”์‹œ์ง€ ์ „ํ•˜๋ฆฌ.
ํ† ์ŠคํŠธ์™€ ํ•จ๊ป˜, ๊ธฐ์จ์„ ๋‚˜๋ˆ„๋ฉฐ,
์šฐ๋ฆฌ๋Š” ๋” ๋‚˜์€ ์„ธ์ƒ์„ ๋งŒ๋“ค์–ด๊ฐ€๋„ค! ๐Ÿžโœจ


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
Contributor

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

๐Ÿงน Outside diff range and nitpick comments (2)
core/common/src/main/java/team/retum/common/exception/RequestExceptions.kt (1)

13-14: ์ƒˆ๋กœ์šด ์˜ˆ์™ธ ํด๋ž˜์Šค๋“ค์ด ๊ธฐ์กด ๊ตฌ์กฐ์™€ ์ž˜ ํ†ตํ•ฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

  • UnknownException์€ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ์˜ˆ์™ธ ์ƒํ™ฉ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐ ์œ ์šฉํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
  • ReissueException์€ ํ† ํฐ ๊ฐฑ์‹  ์‹คํŒจ๋ฅผ ๋” ๋ช…ํ™•ํ•˜๊ฒŒ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ, ๊ฐ ์˜ˆ์™ธ ํด๋ž˜์Šค์— ๋Œ€ํ•œ ๋ฌธ์„œํ™”(KDoc)๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด ๋” ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์˜ˆ์‹œ:

/**
 * ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ ์‚ฌ์šฉ๋˜๋Š” ์˜ˆ์™ธ ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค.
 */
data object UnknownException : RuntimeException()

/**
 * ํ† ํฐ ๊ฐฑ์‹  ๊ณผ์ •์—์„œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ ์‚ฌ์šฉ๋˜๋Š” ์˜ˆ์™ธ ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค.
 */
data object ReissueException : RuntimeException()
app/src/main/java/team/retum/jobisandroidv2/JobisExceptionHandler.kt (1)

11-14: ๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค ํŒŒ์ผ๋กœ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€ ์ด๋™ ํ•„์š”

ํ˜„์žฌ ํ•˜๋“œ์ฝ”๋”ฉ๋œ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋“ค์„ res/values/strings.xml๋กœ ์ด๋™ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด:

  • ๋‹ค๊ตญ์–ด ์ง€์›์ด ์šฉ์ดํ•ด์ง‘๋‹ˆ๋‹ค
  • ๋ฌธ์ž์—ด ๊ด€๋ฆฌ๊ฐ€ ๋” ์ฒด๊ณ„์ ์ด ๋ฉ๋‹ˆ๋‹ค
  • ๋‹ค๋ฅธ ํ™”๋ฉด์—์„œ๋„ ์žฌ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

-private const val InternetErrorMsg = "์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”."
-private const val TimeoutErrorMsg = "์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”."
-private const val LoginErrorMsg = "์œ ์ €์ •๋ณด๊ฐ€ ํ™•์ธ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•ด์ฃผ์„ธ์š”."
-private const val UnknownErrorMsg = "์ฒ˜๋ฆฌ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.\n์•ฑ์„ ์žฌ์‹œ์ž‘ ํ•ด์ฃผ์„ธ์š”."

strings.xml์— ์ถ”๊ฐ€:

<resources>
    <string name="error_internet">์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_timeout">์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_login">์œ ์ €์ •๋ณด๊ฐ€ ํ™•์ธ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_unknown">์ฒ˜๋ฆฌ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.\n์•ฑ์„ ์žฌ์‹œ์ž‘ ํ•ด์ฃผ์„ธ์š”.</string>
</resources>
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 0bb929e and b0e61a1.

๐Ÿ“’ Files selected for processing (5)
  • app/src/main/java/team/retum/jobisandroidv2/JobisExceptionHandler.kt (1 hunks)
  • app/src/main/java/team/retum/jobisandroidv2/MainActivity.kt (1 hunks)
  • core/common/src/main/java/team/retum/common/exception/RequestExceptions.kt (1 hunks)
  • core/network/src/main/java/team/retum/network/util/RefreshTokenService.kt (2 hunks)
  • core/network/src/main/java/team/retum/network/util/RequestHandler.kt (2 hunks)
๐Ÿ”‡ Additional comments (5)
core/common/src/main/java/team/retum/common/exception/RequestExceptions.kt (1)

Line range hint 1-12: ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๊ตฌ์กฐ๊ฐ€ ์ž˜ ์„ค๊ณ„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค! ๐Ÿ‘

๊ฐ๊ฐ์˜ ์˜ˆ์™ธ ์ƒํ™ฉ์— ๋Œ€ํ•ด ๋ช…ํ™•ํ•˜๊ฒŒ ๊ตฌ๋ถ„๋œ ์˜ˆ์™ธ ํด๋ž˜์Šค๋“ค์ด ์ž˜ ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉฐ, ์ผ๊ด€๋œ ํŒจํ„ด์„ ๋”ฐ๋ฅด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

core/network/src/main/java/team/retum/network/util/RefreshTokenService.kt (1)

10-10: LGTM!

์ƒˆ๋กœ์šด ์˜ˆ์™ธ ํƒ€์ž…์˜ import๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

core/network/src/main/java/team/retum/network/util/RequestHandler.kt (2)

14-14: ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ import ์ถ”๊ฐ€๊ฐ€ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

UnknownException import ์ถ”๊ฐ€๋Š” ์ „์ฒด์ ์ธ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๊ฐœ์„  ๋ฐฉํ–ฅ๊ณผ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค.


67-67: ๐Ÿ› ๏ธ Refactor suggestion

์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋™์ž‘ ๋ณ€๊ฒฝ์— ๋Œ€ํ•œ ๊ฒ€์ฆ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๊ธฐ์กด ์˜ˆ์™ธ๋ฅผ UnknownException์œผ๋กœ ๋ž˜ํ•‘ํ•˜๋Š” ๊ฒƒ์€ ์—๋Ÿฌ ์ถ”์ ๊ณผ ๋””๋ฒ„๊น…์— ์˜ํ–ฅ์„ ๋ฏธ์น  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ์‚ฌํ•ญ๋“ค์„ ํ™•์ธํ•ด ์ฃผ์„ธ์š”:

  1. ์›๋ณธ ์˜ˆ์™ธ ์ •๋ณด๊ฐ€ ์†์‹ค๋˜์ง€ ์•Š๋„๋ก UnknownException ์ƒ์„ฑ์ž์— ์›์ธ ์˜ˆ์™ธ๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
  2. ๋กœ๊น… ์‹œ์Šคํ…œ์—์„œ ์ด๋Ÿฌํ•œ ์˜ˆ์™ธ๋“ค์ด ์ ์ ˆํžˆ ๊ธฐ๋ก๋˜๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

- throw UnknownException
+ throw UnknownException(cause = e)

์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋ณ€๊ฒฝ์˜ ์˜ํ–ฅ์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•ด๋ณด์„ธ์š”:

app/src/main/java/team/retum/jobisandroidv2/MainActivity.kt (1)

52-55: JobisExceptionHandler์˜ ๊ตฌํ˜„์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”.

์˜ˆ์™ธ ์ฒ˜๋ฆฌ๊ธฐ๊ฐ€ Context๋ฅผ ์ ์ ˆํžˆ ์ฒ˜๋ฆฌํ•˜๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋กœ JobisExceptionHandler์˜ ๊ตฌํ˜„์„ ํ™•์ธํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค:

โœ… Verification successful

Let me try another search to find the JobisExceptionHandler implementation:


Let me check the complete implementation including the makeToast method:


JobisExceptionHandler์˜ Context ์ฒ˜๋ฆฌ๊ฐ€ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

JobisExceptionHandler์˜ ๊ตฌํ˜„์„ ๊ฒ€ํ† ํ•œ ๊ฒฐ๊ณผ:

  • Context๋ฅผ private ํ•„๋“œ๋กœ ์ ์ ˆํžˆ ์บก์Šํ™”ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค
  • Context๋Š” ์˜ค์ง Toast ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ์—๋งŒ ์‚ฌ์šฉ๋˜๋ฉฐ, ์ด๋Š” ์ผ๋ฐ˜์ ์ธ ์•ˆ๋“œ๋กœ์ด๋“œ ํŒจํ„ด์ž…๋‹ˆ๋‹ค
  • ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ๋Š” static ์ฐธ์กฐ๋‚˜ ์žฅ๊ธฐ ๋ณด๊ด€์ด ์—†์Šต๋‹ˆ๋‹ค
๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify JobisExceptionHandler implementation for proper context handling

# Check how context is stored and used in JobisExceptionHandler
ast-grep --pattern 'class JobisExceptionHandler($context: Context) : Thread.UncaughtExceptionHandler {
  $$$
}'

# Check for potential memory leaks by looking for strong references to context
rg -A 5 'context\.' 

Length of output: 36918


Script:

#!/bin/bash
# Search for JobisExceptionHandler class implementation
rg -A 10 "class JobisExceptionHandler"

# Search for files that might contain JobisExceptionHandler
fd "JobisExceptionHandler"

Length of output: 1350


Script:

#!/bin/bash
# Get the complete implementation of JobisExceptionHandler
cat app/src/main/java/team/retum/jobisandroidv2/JobisExceptionHandler.kt

# Search for any strong references to context in the same file
rg "context\." app/src/main/java/team/retum/jobisandroidv2/JobisExceptionHandler.kt

Length of output: 1457

Comment on lines 28 to 34
fun makeToast(message: String) {
JobisToast.create(
context = context,
message = message,
drawable = JobisIcon.Error,
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

Toast ๋ฉ”์„œ๋“œ ๊ฐ€์‹œ์„ฑ ๋ฐ ๊ธฐ๋Šฅ ๊ฐœ์„  ํ•„์š”

makeToast ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•œ ๊ฐœ์„ ์‚ฌํ•ญ:

  1. ๋ฉ”์„œ๋“œ๊ฐ€ public์œผ๋กœ ์„ ์–ธ๋˜์–ด ์žˆ์–ด ๋ถˆํ•„์š”ํ•œ ์™ธ๋ถ€ ๋…ธ์ถœ์ด ์žˆ์Šต๋‹ˆ๋‹ค
  2. Toast ์ง€์† ์‹œ๊ฐ„์„ ์„ค์ •ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

-    fun makeToast(message: String) {
+    private fun makeToast(
+        message: String,
+        duration: Int = Toast.LENGTH_SHORT
+    ) {
         JobisToast.create(
             context = context,
             message = message,
             drawable = JobisIcon.Error,
+            duration = duration,
         )
     }

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

Comment on lines 19 to 26
override fun uncaughtException(t: Thread, e: Throwable) {
when (e) {
is OfflineException -> makeToast(InternetErrorMsg)
is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
is ReissueException -> makeToast(LoginErrorMsg)
is UnknownException -> makeToast(UnknownErrorMsg)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๊ฐœ์„  ํ•„์š”

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ ๋ช‡ ๊ฐ€์ง€ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:

  1. when ์‹์— else ๋ถ„๊ธฐ๊ฐ€ ์—†์–ด ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š๋Š” ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค
  2. ๋””๋ฒ„๊น…์„ ์œ„ํ•œ ๋กœ๊น…์ด ์—†์Šต๋‹ˆ๋‹ค
  3. ๋” ๊ตฌ์ฒด์ ์ธ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

 override fun uncaughtException(t: Thread, e: Throwable) {
+    Timber.e(e, "Uncaught exception occurred")
     when (e) {
         is OfflineException -> makeToast(InternetErrorMsg)
         is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
         is ReissueException -> makeToast(LoginErrorMsg)
         is UnknownException -> makeToast(UnknownErrorMsg)
+        else -> {
+            Timber.e(e, "Unhandled exception")
+            makeToast(UnknownErrorMsg)
+        }
     }
 }
๐Ÿ“ 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
override fun uncaughtException(t: Thread, e: Throwable) {
when (e) {
is OfflineException -> makeToast(InternetErrorMsg)
is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
is ReissueException -> makeToast(LoginErrorMsg)
is UnknownException -> makeToast(UnknownErrorMsg)
}
}
override fun uncaughtException(t: Thread, e: Throwable) {
Timber.e(e, "Uncaught exception occurred")
when (e) {
is OfflineException -> makeToast(InternetErrorMsg)
is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
is ReissueException -> makeToast(LoginErrorMsg)
is UnknownException -> makeToast(UnknownErrorMsg)
else -> {
Timber.e(e, "Unhandled exception")
makeToast(UnknownErrorMsg)
}
}
}

@@ -40,7 +41,7 @@ object RefreshTokenService {
}.onSuccess { token ->
return token
}.onFailure {
throw IllegalStateException("Fail refresh: ${it.message}")
throw ReissueException
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ๊ฐœ์„ ํ•ด ์ฃผ์„ธ์š”.

ํ˜„์žฌ ๊ตฌํ˜„์€ ์›๋ž˜ ๋ฐœ์ƒํ•œ ์˜ˆ์™ธ์˜ ์ •๋ณด๋ฅผ ๋ชจ๋‘ ์žƒ์–ด๋ฒ„๋ฆฝ๋‹ˆ๋‹ค. ๋””๋ฒ„๊น…๊ณผ ๋ฌธ์ œ ํ•ด๊ฒฐ์„ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค:

  1. ์›์ธ์ด ๋˜๋Š” ์˜ˆ์™ธ๋ฅผ ๋ณด์กด
  2. ์˜๋ฏธ ์žˆ๋Š” ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€ ์ถ”๊ฐ€
  3. ๋กœ๊น… ์ถ”๊ฐ€

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-            throw ReissueException
+            throw ReissueException("ํ† ํฐ ๊ฐฑ์‹  ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค", it)

๋˜ํ•œ ๋กœ๊น… ๊ตฌํ˜„์„ ์œ„ํ•ด Timber๋‚˜ ๋‹ค๋ฅธ ๋กœ๊น… ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”.

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

Copy link
Contributor

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

๐Ÿงน Outside diff range and nitpick comments (2)
app/src/main/java/team/retum/jobisandroidv2/JobisExceptionHandler.kt (2)

11-14: ๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค ํŒŒ์ผ๋กœ ์ด๋™ ๊ถŒ์žฅ

์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋ฅผ strings.xml ๋ฆฌ์†Œ์Šค ํŒŒ์ผ๋กœ ์ด๋™ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค:

  • ๋‹ค๊ตญ์–ด ์ง€์›์ด ์šฉ์ดํ•ด์ง‘๋‹ˆ๋‹ค
  • ๋ฌธ์ž์—ด ์žฌ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค
  • ์ผ๊ด€๋œ ๋ฉ”์‹œ์ง€ ๊ด€๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค

์˜ˆ์‹œ:

<!-- strings.xml -->
<resources>
    <string name="error_internet">์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_timeout">์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_login">์œ ์ €์ •๋ณด๊ฐ€ ํ™•์ธ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_unknown">์ฒ˜๋ฆฌ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.\n์•ฑ์„ ์žฌ์‹œ์ž‘ ํ•ด์ฃผ์„ธ์š”.</string>
</resources>

16-18: Context ์ฐธ์กฐ ๊ด€๋ฆฌ ๊ฐœ์„  ํ•„์š”

๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ ์‚ฌํ•ญ์„ ๊ณ ๋ คํ•ด์ฃผ์„ธ์š”:

  • ApplicationContext๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ๋ช…์‹œ์ ์œผ๋กœ ์ œํ•œ
  • Context ์ฐธ์กฐ๊ฐ€ ์ ์ ˆํžˆ ํ•ด์ œ๋˜๋Š”์ง€ ํ™•์ธ
class JobisExceptionHandler(
-    private val context: Context,
+    context: Context,
) : Thread.UncaughtExceptionHandler {
+    private val applicationContext = context.applicationContext
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between b0e61a1 and 6209b0e.

๐Ÿ“’ Files selected for processing (2)
  • app/src/main/java/team/retum/jobisandroidv2/JobisExceptionHandler.kt (1 hunks)
  • app/src/main/java/team/retum/jobisandroidv2/MainActivity.kt (1 hunks)
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/team/retum/jobisandroidv2/MainActivity.kt

Comment on lines 29 to 35
private fun makeToast(message: String) {
JobisToast.create(
context = context,
message = message,
drawable = JobisIcon.Error,
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

Toast ํ‘œ์‹œ ์•ˆ์ •์„ฑ ๊ฐœ์„  ํ•„์š”

Toast ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ์˜ ์•ˆ์ •์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•œ ๊ฐœ์„ ์‚ฌํ•ญ:

  • ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰๋˜๋„๋ก ๋ณด์žฅ
  • Toast ์ง€์† ์‹œ๊ฐ„ ์„ค์ • ์˜ต์…˜ ์ถ”๊ฐ€
  • ์‹คํŒจ ์‹œ ๋Œ€์ฒด ์ฒ˜๋ฆฌ ๋ฐฉ์•ˆ ๊ณ ๋ ค
private fun makeToast(message: String) {
+    Handler(Looper.getMainLooper()).post {
+        try {
             JobisToast.create(
                 context = context,
                 message = message,
                 drawable = JobisIcon.Error,
+                duration = Toast.LENGTH_LONG
             )
+        } catch (e: Exception) {
+            Timber.e(e, "Failed to show toast")
+        }
+    }
}
๐Ÿ“ 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
private fun makeToast(message: String) {
JobisToast.create(
context = context,
message = message,
drawable = JobisIcon.Error,
)
}
private fun makeToast(message: String) {
Handler(Looper.getMainLooper()).post {
try {
JobisToast.create(
context = context,
message = message,
drawable = JobisIcon.Error,
duration = Toast.LENGTH_LONG
)
} catch (e: Exception) {
Timber.e(e, "Failed to show toast")
}
}
}

Comment on lines 19 to 27
override fun uncaughtException(t: Thread, e: Throwable) {
when (e) {
is OfflineException -> makeToast(InternetErrorMsg)
is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
is ReissueException -> makeToast(LoginErrorMsg)
is UnknownException -> makeToast(UnknownErrorMsg)
else -> makeToast(UnknownErrorMsg)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์˜ˆ์™ธ ๋กœ๊น… ์ถ”๊ฐ€ ํ•„์š”

๋””๋ฒ„๊น…๊ณผ ๋ชจ๋‹ˆํ„ฐ๋ง์„ ์œ„ํ•ด ๋กœ๊น…์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค:

  • ์˜ˆ์™ธ ๋ฐœ์ƒ ์‹œ์ ๊ณผ ์ƒ์„ธ ์ •๋ณด ๊ธฐ๋ก
  • ์Šค๋ ˆ๋“œ ์ •๋ณด ํ™œ์šฉ
  • Crashlytics ๋“ฑ์˜ ํฌ๋ž˜์‹œ ๋ฆฌํฌํŒ… ๋„๊ตฌ ํ†ตํ•ฉ
override fun uncaughtException(t: Thread, e: Throwable) {
+    Timber.e(e, "Uncaught exception in thread ${t.name}")
    when (e) {
        is OfflineException -> makeToast(InternetErrorMsg)
        is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
        is ReissueException -> makeToast(LoginErrorMsg)
        is UnknownException -> makeToast(UnknownErrorMsg)
-        else -> makeToast(UnknownErrorMsg)
+        else -> {
+            Timber.e(e, "Unhandled exception type: ${e.javaClass.simpleName}")
+            makeToast(UnknownErrorMsg)
+        }
    }
}
๐Ÿ“ 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
override fun uncaughtException(t: Thread, e: Throwable) {
when (e) {
is OfflineException -> makeToast(InternetErrorMsg)
is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
is ReissueException -> makeToast(LoginErrorMsg)
is UnknownException -> makeToast(UnknownErrorMsg)
else -> makeToast(UnknownErrorMsg)
}
}
override fun uncaughtException(t: Thread, e: Throwable) {
Timber.e(e, "Uncaught exception in thread ${t.name}")
when (e) {
is OfflineException -> makeToast(InternetErrorMsg)
is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg)
is ReissueException -> makeToast(LoginErrorMsg)
is UnknownException -> makeToast(UnknownErrorMsg)
else -> {
Timber.e(e, "Unhandled exception type: ${e.javaClass.simpleName}")
makeToast(UnknownErrorMsg)
}
}
}

@parkuiery parkuiery requested a review from Tmdhoon2 November 7, 2024 12:07
Copy link
Contributor

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

๐Ÿงน Outside diff range and nitpick comments (2)
app/src/main/java/team/retum/jobisandroidv2/JobisApplication.kt (2)

25-41: ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋กœ์ง ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ž ์žฌ์ ์ธ ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค:

  1. exitProcess(0)๋ฅผ ์ฆ‰์‹œ ํ˜ธ์ถœํ•˜๋ฉด ์‚ฌ์šฉ์ž ๋ฐ์ดํ„ฐ๊ฐ€ ์†์‹ค๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค
  2. ๋ชจ๋“  ์˜ˆ์™ธ๋ฅผ ๋™์ผํ•œ ๋ฐฉ์‹์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฒƒ์€ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ์ €ํ•˜์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

  1. ์น˜๋ช…์ ์ธ ์˜ค๋ฅ˜์™€ ๋ณต๊ตฌ ๊ฐ€๋Šฅํ•œ ์˜ค๋ฅ˜๋ฅผ ๊ตฌ๋ถ„ํ•˜์—ฌ ์ฒ˜๋ฆฌ
  2. ์•ฑ ์ข…๋ฃŒ ์ „์— ์‚ฌ์šฉ์ž ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๋Š” ๋กœ์ง ์ถ”๊ฐ€
  3. ๋ณต๊ตฌ ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ ๋‹ค์ด์–ผ๋กœ๊ทธ๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ์ž์—๊ฒŒ ์„ ํƒ๊ถŒ ์ œ๊ณต

์˜ˆ์‹œ ๊ตฌํ˜„:

private fun handleFatalError(thread: Thread, exception: Throwable) {
    Firebase.crashlytics.recordException(exception)
    
    // ์‚ฌ์šฉ์ž ๋ฐ์ดํ„ฐ ์ €์žฅ
    saveApplicationState()
    
    // ๋ณต๊ตฌ ๊ฐ€๋Šฅํ•œ ์˜ค๋ฅ˜์ธ ๊ฒฝ์šฐ
    if (isRecoverableError(exception)) {
        showRecoveryDialog(exception)
        return
    }
    
    // ์น˜๋ช…์ ์ธ ์˜ค๋ฅ˜์ธ ๊ฒฝ์šฐ
    showFatalErrorDialog {
        startActivity(
            Intent(this, MainActivity::class.java).apply {
                addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
            }
        )
        exitProcess(0)
    }
}

44-50: Toast ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ ๋ฐฉ์‹ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์€ ์•ฑ์ด ์žฌ์‹œ์ž‘๋˜๊ธฐ ์ „์— Toast ๋ฉ”์‹œ์ง€๊ฐ€ ์‚ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

private fun showErrorMessage(message: String) {
    // ๋” ๊ธด ์‹œ๊ฐ„ ๋™์•ˆ ํ‘œ์‹œ
    Toast.makeText(this, message, Toast.LENGTH_LONG).show()
    
    // ๋˜๋Š” Snackbar ์‚ฌ์šฉ
    val rootView = findViewById<View>(android.R.id.content)
    Snackbar.make(rootView, message, Snackbar.LENGTH_LONG).show()
}
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 489c421 and d06bf72.

๐Ÿ“’ Files selected for processing (1)
  • app/src/main/java/team/retum/jobisandroidv2/JobisApplication.kt (1 hunks)
๐Ÿ”‡ Additional comments (1)
app/src/main/java/team/retum/jobisandroidv2/JobisApplication.kt (1)

4-13: ํ•„์š”ํ•œ import ๋ฌธ์ด ๋ชจ๋‘ ์ž˜ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

์˜ˆ์™ธ ์ฒ˜๋ฆฌ์™€ Firebase Crashlytics ํ†ตํ•ฉ์„ ์œ„ํ•œ import ๋ฌธ์ด ์ ์ ˆํ•˜๊ฒŒ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

Comment on lines +15 to +18
private const val InternetErrorMsg = "์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”."
private const val TimeoutErrorMsg = "์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”."
private const val LoginErrorMsg = "์œ ์ €์ •๋ณด๊ฐ€ ํ™•์ธ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•ด์ฃผ์„ธ์š”."
private const val UnknownErrorMsg = "์ฒ˜๋ฆฌ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค."
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค ๊ด€๋ฆฌ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ•˜๋“œ์ฝ”๋”ฉ๋œ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ res/values/strings.xml๋กœ ์ด๋™ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด:

  • ๋‹ค๊ตญ์–ด ์ง€์›์ด ์šฉ์ดํ•ด์ง‘๋‹ˆ๋‹ค
  • ๋ฌธ์ž์—ด ์žฌ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค
  • ์ผ๊ด€๋œ ๋ฉ”์‹œ์ง€ ๊ด€๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-private const val InternetErrorMsg = "์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”."
-private const val TimeoutErrorMsg = "์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”."
-private const val LoginErrorMsg = "์œ ์ €์ •๋ณด๊ฐ€ ํ™•์ธ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•ด์ฃผ์„ธ์š”."
-private const val UnknownErrorMsg = "์ฒ˜๋ฆฌ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค."

strings.xml์— ์ถ”๊ฐ€:

<resources>
    <string name="error_internet">์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_timeout">์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_login">์œ ์ €์ •๋ณด๊ฐ€ ํ™•์ธ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.\n๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•ด์ฃผ์„ธ์š”.</string>
    <string name="error_unknown">์ฒ˜๋ฆฌ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.</string>
</resources>

@parkuiery parkuiery merged commit 68ca1ef into develop Nov 7, 2024
2 checks passed
@parkuiery parkuiery deleted the feature/418-์ „์ฒด-์˜ˆ์™ธ-์ฒ˜๋ฆฌ branch November 7, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๋ฆฌํŒฉํ† ๋ง ์ฝ”๋“œ๋ฅผ ๋ฆฌํŒฉํ† ๋ง ํ•ฉ๋‹ˆ๋‹ค. ๋ฒ„๊ทธ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.
Projects
Development

Successfully merging this pull request may close these issues.

์ „์ฒด ์˜ˆ์™ธ ์ฒ˜๋ฆฌ
2 participants