mCyp / mCyp/Hoo

建议移除 repository 层

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
1.1k
Forks
199
PR merge metrics
No merged PRs in 30d

Description

注意到项目中的 ShoeRepository 几乎都是直接调用 dao,没有提供其他有用的价值,不如直接在 view model 使用 dao 更加方便维护。

有些 Repository 方法 withContext 做了线程切换操作,这个在 repository 做是合理的,但是 Room 原生也已经支持 suspend 方法了。

有篇相关的文章:
https://proandroiddev.com/anemic-repositories-mvi-and-rxjava-induced-design-damage-and-how-aac-viewmodel-is-silently-1762caa70e13

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating ShoeRepository, its DAO calls, and the view models that depend on it. Review how Room suspend methods are currently used and determine the full set of callers before deciding whether the repository layer can be removed. Done would mean the affected view models use the DAO directly without losing the existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.