Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

remove default data from RelationView #154

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

Zoha131
Copy link
Contributor

@Zoha131 Zoha131 commented Oct 28, 2020

Description

If the viewmodel is in Activity mode then only ActivityIndicator will be shown. If there is any relation then the Relation data would be shown. Otherwise, a default text will be shown to indicate an empty relation.

Fixes #144

Type of Change:

  • Code
  • User Interface

How Has This Been Tested?

I have manually tested the screens.

Has Relation No Relation
Simulator Screen Shot Simulator Screen Shot

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials

If the viewmodel is in Activity mode then only ActivityIndicator will be shown. If there is any relation then the Relation data would be shown. Otherwise, a default text will be shown to indicate an empty relation.
Copy link
Contributor

@ApheleiaS ApheleiaS left a comment

Choose a reason for hiding this comment

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

Hi @Zoha131! Thanks a lot for submitting a PR for this. The change looks great to me and thanks for fixing this bug for us.

I have added a couple of generic comments and request some minor changes. Let me know what you think?

@@ -45,6 +45,7 @@ struct LocalizableStringConstants {
static let profile = LocalizedStringKey("Profile")
static let editProfile = LocalizedStringKey("Edit Profile")
static let addTask = LocalizedStringKey("Add Task")
static let noRelationText = LocalizedStringKey("No active relation")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could change to "No active relations"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will rename the variable.

Comment on lines +20 to +21
return relationViewModel.currentRelation.id != nil &&
relationViewModel.currentRelation.id != 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Why are you checking for both nil and 0?
Wouldn't nil signify that the backend response was not found in which case showing the user the "No active relation" state is wrong and we should show an error state instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currentRelation inside RelationModel has default id which is 0. And if there is no relation then the response I get is nil. This is why I am checking both.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright..thanks for clarifying!

TasksSection(tasks: relationViewModel.doneTasks, navToTaskComments: true)
}
} else {
Text(LocalizableStringConstants.noRelationText)
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly overkill but something to consider:
This kind of view where the window is Empty because there is no content is a pretty common state for an app and we should have a generic UtilityView for it. Can you add a generic UtilityView like the ActivityIndicator and pass a message as a variable? It would make it reusable and incase we want to later add some icons we could do that too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is a good idea. I have seen some other screens where an empty view can be re-used.

TasksSection(tasks: relationViewModel.doneTasks, navToTaskComments: true)
}
} else {
Text(LocalizableStringConstants.noRelationText)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a background color here in this view.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want a background color for the empty view? If yes then should I add a background color forActivityIndicator as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes sure, lets add background color to both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the confirmation. I will update my PR in a few days.

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

Successfully merging this pull request may close these issues.

bug: remove default data from Relation view.
2 participants