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

feat: Enable navigation from NotificationsInbox to Discussion #84

Open
wants to merge 5 commits into
base: 2U/develop
Choose a base branch
from

Conversation

omerhabib26
Copy link

Description:

  • Allows users to move from the NotificationsInbox screen to the Discussion component

fix: LEARNER-10373

PushNotificationsFlow.webm

@omerhabib26 omerhabib26 reopened this Jan 16, 2025
Base automatically changed from 2U/omer/LEARNER-10341 to 2U/develop January 17, 2025 13:59
@omerhabib26 omerhabib26 force-pushed the 2U/omer/LEARNER-10373 branch 4 times, most recently from fa14fa1 to 06d81a9 Compare January 17, 2025 14:13
@omerhabib26 omerhabib26 marked this pull request as ready for review January 17, 2025 14:14
@omerhabib26 omerhabib26 force-pushed the 2U/omer/LEARNER-10373 branch from 06d81a9 to 3279131 Compare January 17, 2025 16:34
Copy link
Collaborator

@k1rill k1rill left a comment

Choose a reason for hiding this comment

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

Just some coments

comments.remove(comment)
comments.add(0, comment!!)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

First: need to adjust formatting here
Second: comments.find {} is running 2 times here is some cases

@@ -379,6 +397,10 @@ private fun DiscussionCommentsScreen(
onUserPhotoClick = {
onUserPhotoClick(comment.author)
})
if (fromNotificationNavigation && commentId.isNotEmpty() && responseId == comment.id) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe it's better to move this to Effect? It's strange for me to execute onCommentClick lambda inside the compose graph

val index =
uiState.data.indexOfFirst { it.id == threadId }
if (index != -1) {
onItemClick(uiState.data[index])
Copy link
Collaborator

Choose a reason for hiding this comment

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

the same here, the onItemClick is executed in the middle of the compose function

Copy link
Member

@farhan-arshad-dev farhan-arshad-dev left a comment

Choose a reason for hiding this comment

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

  • Error handling needs to be considered part of this PR.
    Error Handling:
    Manage cases where a notification links to a deleted or unavailable discussion, with clear messaging to the user. This should be a toast message.
    Error copy: “Unable to retrieve comment/response.”

  • IMO, its better to add the following properties in Notification:Notification Tapped event.

    • course_id
    • notification_id
    • topic_id
    • post_id
    • response_id
    • comment_id.
  • Need to eliminate the flickering effect during navigation if feasible with minimal effort (can be considered in Notification V2).

  • IMO, its better to navigate in the following order if feasible with minimal effort (can be considered in Notification V2)

    • Notification Inbox -> Course Dashboard -> Course Discussion tab -> All posts -> Discussion Detail Screen -> Response Details screen.

@omerhabib26
Copy link
Author

Error Handing on Notification Inbox screen is already handled, for discussion module we can handle it in a separate ticket.

  • Error handling needs to be considered part of this PR.
    Error Handling:
    Manage cases where a notification links to a deleted or unavailable discussion, with clear messaging to the user. This should be a toast message.
    Error copy: “Unable to retrieve comment/response.”

There is a ticket in a backlog for analytic improvement, we can cover these suggestions in that ticket.

  • IMO, its better to add the following properties in Notification:Notification Tapped event.

    • course_id
    • notification_id
    • topic_id
    • post_id
    • response_id
    • comment_id.

Yes, we can improve this in V2.

  • Need to eliminate the flickering effect during navigation if feasible with minimal effort (can be considered in Notification V2).

  • IMO, its better to navigate in the following order if feasible with minimal effort (can be considered in Notification V2)

    • Notification Inbox -> Course Dashboard -> Course Discussion tab -> All posts -> Discussion Detail Screen -> Response Details screen.

Copy link
Member

@farhan-arshad-dev farhan-arshad-dev left a comment

Choose a reason for hiding this comment

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

A few minor suggestions, otherwise, it looks good to me!

Comment on lines +85 to +92
try {
headers.forEach {
val startIndex = text.indexOf(it)
val endIndex = startIndex + it.length + 1
result = text.replaceRange(startIndex, endIndex, it + "\n")
}
} catch (e: Exception) {
e.printStackTrace()
Copy link
Member

Choose a reason for hiding this comment

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

use case for this code change?

Copy link
Author

Choose a reason for hiding this comment

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

The server was passing an incorrect HTML string, which caused the exception and prevented the app from parsing the data.

mutableStateOf(threadId.isNotEmpty())
}

LaunchedEffect(uiState is DiscussionThreadsUIState.Threads) {
Copy link
Member

Choose a reason for hiding this comment

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

IMO better to use LaunchedEffect(uiState).

var fromNotificationNavigation by rememberSaveable {
mutableStateOf(viewModel.responseId.isNotEmpty() && viewModel.commentId.isNotEmpty())
}
LaunchedEffect(uiState is DiscussionCommentsUIState.Success) {
Copy link
Member

Choose a reason for hiding this comment

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

IMO better to use LaunchedEffect(uiState).

@omerhabib26 omerhabib26 force-pushed the 2U/omer/LEARNER-10373 branch from 8f4a00e to e84a72d Compare February 4, 2025 12:02
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.

3 participants