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

feature: Task 4 completed #4

Merged
merged 39 commits into from
Jul 15, 2024
Merged

feature: Task 4 completed #4

merged 39 commits into from
Jul 15, 2024

Conversation

Gribbirg
Copy link
Owner

@Gribbirg Gribbirg commented Jul 13, 2024

Четвёртое задание выполнено.

Сделано по ТЗ

DI

  • Dagger 2
  • Subcomponents есть в модуле app (по большей части ради галочки)
  • Scope есть
  • Поля я как только не инжектил)
  • ViewModel "кастыльно" прикручены, главное работает)

  • добавлена многомодульность и DI между модулями через зависимости компонентов

Хранение данных

Сдано в рамках прошлой дз, так что не смотри)

Gradle

  • основа вынесена в conventional
  • сделаны таски:
  1. проверка размера (отключение - тупо не указание максимального размера)
  2. отправка в телегу
  3. отправка детализации apk (если не отключено через extension)
  • изменено имя apk
  • настроен GitHub Actions

Дополнительно

  • добавлена сборка signed приложения

Для тестов

Apk загружен через Github Actions в артефакты и телегу

Если захочется собрать самому, то необходимо в корне проекта создать файл secrets.properties и заполнить его ключами:

YANDEX_CLIENT_ID=

TELEGRAM_BOT_API=
TELEGRAM_CHAT_ID=

KEY_STORE_PATH=
KEY_STORE_PASSWORD=
KEY_ALIAS=
KEY_PASSWORD=

Copy link

@nai1ka nai1ka left a 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)
Copy link

Choose a reason for hiding this comment

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

Как будто здесь можно было обойтись просто @Inject в конструкторе

Copy link
Owner Author

@Gribbirg Gribbirg Jul 15, 2024

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()
Copy link

Choose a reason for hiding this comment

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

Лучше переделать как в гайде. Не уверен, что это надежный способ

Copy link

@AlexeyZakis AlexeyZakis left a 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"

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

Choose a reason for hiding this comment

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

1024 - магическое число

@Gribbirg Gribbirg merged commit 92abea9 into master Jul 15, 2024
1 check passed
Copy link

@Uncreated Uncreated left a 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 {

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()

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(

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
}
}
},

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) {

Choose a reason for hiding this comment

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

Класс лишний, можно все тоже самое сделать напрямую. ListFeatureDependencies можно получать напрямую из AppComponent как зависимость. Сам класс зависимостей должен храниться в модуле рядом с компонентом ListFeatureComponent, т.о. все равно кто будет реализовывать эти зависимости

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants