-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
MessagesAction Update to also handle non-actionable messages without failing #168
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ data class Message( | |
val description: String? = null, | ||
val action: String?, | ||
val isDismissible: Boolean = true, | ||
val isLoading: Boolean = false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is some logic in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found this out now, yes - but I believe this should actually be in some wrapper type or something, since it has nothing to do with the model itself. Like this, I would assume that the server sends us this information, which is not the case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally agree, in general there should be distinct types for domain and ui layer, e.g. |
||
val isExpanded: Boolean = false, | ||
) { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ class MessagesHandler @Inject constructor( | |
val actionResult = messagesActionMapper.map(action = message.action) | ||
var failure = actionResult.exceptionOrNull() | ||
when (val messagesAction = actionResult.getOrNull()) { | ||
is MessagesAction.NoAction -> Unit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should not be needed as it is covered in the else case (applies also in case you change the response to nullable instead of result) Question: Should we complete the message below if we could not map any action for it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure actually, would need to check iOS There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked: iOS only calls dismissMessage, if an action has been performed and the message has |
||
is MessagesAction.HealthSummaryAction -> { | ||
failure = healthSummaryService.generateHealthSummaryPdf().exceptionOrNull() | ||
} | ||
|
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 is another error being thrown in the else case. I would propose changing the return type of this method to
MessageAction?
instead of result and update torunCatching { // exisiting logic }.getOrNull()
. No need for NoAction imo as we can represent it with the null case