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

[둘리] 1단계 자동 DI 미션 제출합니다 #5

Merged
merged 18 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Application 생성하여 Container에 인스턴스 추가
  • Loading branch information
hyemdooly committed Sep 5, 2023
commit 6fd51344b4159dedd2150733b86ea240671b0703
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".ui.ShoppingApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/java/woowacourse/shopping/ui/ShoppingApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package woowacourse.shopping.ui

import android.app.Application
import woowacourse.shopping.data.CartRepository
import woowacourse.shopping.data.CartRepositoryImpl
import woowacourse.shopping.data.ProductRepository
import woowacourse.shopping.data.ProductRepositoryImpl
import woowacourse.shopping.ui.common.Container

class ShoppingApplication : Application() {
override fun onCreate() {
super.onCreate()
inject()
}

private fun inject() {
Container.addInstance(CartRepository::class, CartRepositoryImpl())
Container.addInstance(ProductRepository::class, ProductRepositoryImpl())
Comment on lines +17 to +18
Copy link
Member

Choose a reason for hiding this comment

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

이제 생성되는 저장소가 추가되어도 유연하게 대응할 수 있겠네요!

}
}