-
Notifications
You must be signed in to change notification settings - Fork 1
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
feature: Task 4 completed #4
Conversation
# Conflicts: # .gitignore # app/.gitignore # app/build.gradle.kts # gradle/libs.versions.toml
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.
DI (5/5)
✅ Использовать чистый Dagger 2 в своем приложении.
✅ Использовать иерархию Subcomponents и custom Scopes.
✅ Для добавления объектов в Component использовать минимально необходимый способ
✅ Попробовать разбить проект на модули и сделать межмодульный DI с помощью Component Dependencies.
Gradle(4/4)
✅ Вынести конфигурацию сборки проекта в convention плагины.
✅ Повторить плагин, сделанный на практике.
✅ Написать еще одну Gradle Task с названием validateApkSizeFor*
✅ Сделать так, чтобы эта задача всегда запускалась перед задачей выгрузки apk файла
✅ Выходными данными задачи должна быть информация о размере apk файла
✅ Сделать extension для плагина, который позволит отключать задачу проверки размера файла и задавать границу этого размера. Тот самый N мб.
✅ Поменять название у отправляемого apk файла.
✅ Настроить Github Actions для сборки проекта и выгрузки apk файла в телеграм на каждый ПР и линковки apk файла к CI сборке.
Очень много всего сделал, классная работа)
@nai1ka
companion object { | ||
@Provides | ||
fun listFeatureFactory(depsImpl: AppComponent): ListFeatureFactory = | ||
ListFeatureFactory(depsImpl) |
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.
Как будто здесь можно было обойтись просто @Inject в конструкторе
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.
Суть подхода как у меня в том, чтобы сделать модули независимыми друг от друга в плане DI. Т.е. если из ListFeature
DI уйдёт или переедет с Dagger
а, то при этом не придётся менять остальные модули. Если делать через @Inject
, то при изменении DI у ListFeature
придётся менять и все модули, где он использовался, т.к. @Inject
а может уже не быть(
Да и кода не сильно меньше станет, ибо придётся добавить @Binds
для того, чтобы давать интерфейс ListFeatureDependencies
) Но я понимаю, что под капотом @Inject
и @Binds
лучше одного @Provides
, но в данном случае всё ради независимости модулей)
val animationDuration = AppTheme.dimensions.animationDurationNavigationTransition | ||
|
||
val listViewModel = remember { | ||
appComponent.listFeatureComponent().listViewModel() |
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.
Лучше переделать как в гайде. Не уверен, что это надежный способ
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.
DI: 5/5
Gradle: 4/4
Крутая работа!
val size = file.length() / 1024 | ||
if (size > maxSizeKb) { | ||
val text = | ||
"Apk is too large!\nName: ${file.name}\nSize: $size KB\nMax size: $maxSizeKb KB" |
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.
KB можно вынести в константы. Можно забыть где-то поменять, если решишь отображать размер, например, в МБ
|
||
val file = apkDir.get().findApk() | ||
|
||
val size = file.length() / 1024 |
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.
1024 - магическое число
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.
В целом все ок)
internetDataStore = internetDataStore, | ||
listsMerger = listMergerImpl, | ||
) | ||
internal val appComponent by lazy { |
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.
Можно lazy(NONE), т.к. не нужна синхронизация на мейн треде
} | ||
|
||
val editViewModelFactory = remember { | ||
appComponent.editFeatureComponent().editFeatureFactory().createViewModelFactory() |
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.
Пустая строка
@@ -44,13 +51,13 @@ fun NavGraph( | |||
) | |||
}, | |||
) { | |||
TodoListItemScreen( | |||
ru.gribbirg.list.TodoListItemScreen( |
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.
Лучше импортнуть и не писать весь путь
viewModel = listViewModel, | ||
toEditItemScreen = { id -> | ||
navController.navigate(Screen.Edit.getRoute(itemId = id)) { | ||
launchSingleTop = true | ||
} | ||
} | ||
}, |
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.
Запятые, конечно, хорошо, если есть понимание зачем они пишутся в конце)
|
||
import ru.gribbirg.list.TodoItemsListViewModel | ||
|
||
class ListFeatureFactory(deps: ListFeatureDependencies) { |
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.
Класс лишний, можно все тоже самое сделать напрямую. ListFeatureDependencies
можно получать напрямую из AppComponent как зависимость. Сам класс зависимостей должен храниться в модуле рядом с компонентом ListFeatureComponent
, т.о. все равно кто будет реализовывать эти зависимости
Четвёртое задание выполнено.
Сделано по ТЗ
DI
Subcomponents
есть в модуле app (по большей части ради галочки)Scope
естьViewModel
"кастыльно" прикручены, главное работает)Хранение данных
Сдано в рамках прошлой дз, так что не смотри)
Gradle
conventional
GitHub Actions
Дополнительно
signed
приложенияДля тестов
Apk загружен через
Github Actions
в артефакты и телегуЕсли захочется собрать самому, то необходимо в корне проекта создать файл
secrets.properties
и заполнить его ключами: