Skip to content

Implemented shoplist#1

Open
vladmircan wants to merge 1 commit intomasterfrom
feature/example_feature
Open

Implemented shoplist#1
vladmircan wants to merge 1 commit intomasterfrom
feature/example_feature

Conversation

@vladmircan
Copy link
Owner

No description provided.

buildTypes {
release {
minifyEnabled true
minifyEnabled false
Copy link
Owner Author

Choose a reason for hiding this comment

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

minifyEnabled should be left to true. This allows R8 to shrink the apk size and optimize the app. This also improves the security of the app through the obfuscation of code

import kotlinx.serialization.Serializable

data class ShopListResponse(
val list_id: String,
Copy link
Owner Author

Choose a reason for hiding this comment

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

Please change variable name list_id to listId. Camel case should always be preserved even for classes that map the response. In order to preserve compatibility with the JSON please use the @SerialName annotation (e.g. @SerialName("list_id"))

class MainFragment: Fragment() {

@Inject
private var viewModel: MainViewModel? = null
Copy link
Owner Author

Choose a reason for hiding this comment

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

Please inject viewmodel lazily by using viewModels(): private val viewModel: MainViewModel by viewModels()

@@ -1,21 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Owner Author

Choose a reason for hiding this comment

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

Please revert this change. Application and activities need to be declared inside the manifest file.


override suspend fun getShopListItems(listId: String): List<ShopListItemResponse> =
coroutineScope {
Thread.sleep(2)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Never use Thread.sleep. Use delay() instead. This suspends the current coroutine without blocking the thread.

@@ -0,0 +1,10 @@
package com.netguru.codereview.network.model
Copy link
Owner Author

Choose a reason for hiding this comment

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

Move this inside the shoplist module

@@ -0,0 +1,11 @@
package com.netguru.codereview.ui.model
Copy link
Owner Author

Choose a reason for hiding this comment

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

Move it in the appropriate module.

android:id="@+id/latest_list_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/title"
Copy link
Owner Author

Choose a reason for hiding this comment

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

Minor point: better to use @id/title than @+id/title as it improves id checking.

@@ -0,0 +1,10 @@
package com.netguru.codereview.network

class ShopListRepository(private val shopListApi: ShopListApi) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

It would be better to split the repository into an interface ShopListRepository and an implementation say ShopListRepositoryImpl in order to prevent the leaking of implementation details and to improve code testability

android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintTop_toBottomOf="@id/latest_list_icon"
app:layout_constraintBottom_toBottomOf="@id/message"
Copy link
Owner Author

Choose a reason for hiding this comment

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

Setting constraints to something like a ProgressBar that can often change its visibility is not recommended.

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.

1 participant