-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$500] [ANDROID APP] Notifications are displayed in the wrong order #26834
Comments
Triggered auto assignment to @kadiealexander ( |
Bug0 Triage Checklist (Main S/O)
|
Wow, yes can definitely reproduce! |
Job added to Upwork: https://www.upwork.com/jobs/~01e28fb1f0dbce38ca |
Current assignee @jliexpensify is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws ( |
Proposal Contributor details Checked the Video Recording attached with the issue. First possible thing, when the notification is triggered on message sent, it is sending to the Server and then received on the target user's end. Here, the possible issue can be, all the requests sending to the server in very short time, this will be handled asynchronously and then it will send the notifications to the target user in random order. [NOT IN THE ORDER SENDER SENT THE MESSAGES ORIGINALLY] A fix can be, sending the notification to the server from Android app with a minor delay and try to handle the part of sending message in a synchronous way to avoid the re-ordering of tasks/notifications. |
📣 @spectusAkashIOS! 📣
|
Proposal Problem Statement Root Cause Analysis Proposed Solution Introduce Delay: Modify the Android app to incorporate a minor delay when sending notifications to the server. By introducing this delay, we aim to mitigate the asynchronous handling of requests, ensuring that notifications are processed and delivered in the order they were originally sent by the sender. |
Problem Statement:Notifications from the Expensify app are not always displayed in the intended order on the client device. This can lead to a confusing user experience, as more recent notifications might appear before earlier ones. Root Cause:
Proposed Solution:Leverage a promise-based mechanism to ensure notifications are processed and displayed in the correct order:
Code Implementation: let bufferedNotifications = [];
let promiseChain = Promise.resolve(); // Start with a resolved promise as the base of the chain
function pushNotificationEventCallback(notificationEvent) {
const { pushPayload } = notificationEvent;
const timestampOrSeqNum = pushPayload.timestamp || pushPayload.sequenceNumber;
// Check for duplicates
if (bufferedNotifications.some(notif => notif.notification.id === pushPayload.id)) {
return; // Skip processing this notification
}
// Add the notification processing as a new link in the promise chain
promiseChain = promiseChain.then(async () => {
try {
// Store the notification in the buffer
bufferedNotifications.push({
timestampOrSeqNum: timestampOrSeqNum,
notification: pushPayload
});
// Sort the buffered notifications
bufferedNotifications.sort((a, b) => a.timestampOrSeqNum - b.timestampOrSeqNum);
// If the buffer gets too large, process and display the notifications
if (bufferedNotifications.length > BUFFER_SIZE_LIMIT) {
displayNotifications();
}
} catch (error) {
console.error("Error processing the notification:", error);
}
});
}
function displayNotifications() {
// Display notifications from the buffer
console.log(bufferedNotifications);
// Clear the buffer after display
bufferedNotifications = [];
} Alternative Solution:
|
@Ollyws, @jliexpensify Huh... This is 4 days overdue. Who can take care of this? |
Will review asap. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Bump @Ollyws for reviews! |
Bumping @Ollyws for reviews. If you're unable to review, let me know and I can reassign another C+. |
@Ollyws @jliexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
@jliexpensify I think this one should probably be internal as it may require backend changes and also contributors or C+ can't test push notifications on iOS as far as I know (which would be required even though this is an android issue). |
Current assignee @Ollyws is eligible for the Internal assigner, not assigning anyone new. |
Triggered auto assignment to @cead22 ( |
I think we should close this issue. Push notifications aren't guaranteed to be delivered in the order they're sent to apple/google. Moreover, this is an edge case that is unlikely to be experienced while using the app normally because usually there is some time from the moment you send a chat to the next. Give that, this is more a feature request than a bug imo. As an aside, it would be good if the video showed the full reproduction steps (cc @lanitochka17), and if we're just sending 1, 2, 3, ... in full speed, then it reinforces that this is an edge case that isn't reflective of the normal use of the app. Please reopen if you disagree, including the video showing the full reproduction steps |
Issue not reproducible during KI retests. (First week) |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
Notifications are received and displayed in the correct order
Actual Result:
Notifications are displayed in the wrong order
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.64-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Bug6189649_Record_Notifications_wrong_order.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Interanal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: