Skip to content

Commit

Permalink
Merge pull request #35311 from Expensify/mountiny-cherry-pick-staging…
Browse files Browse the repository at this point in the history
…-35308-1
  • Loading branch information
mountiny authored Jan 29, 2024
2 parents 6e2c58d + 3f96b76 commit b7c56e2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 58 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001043202
versionName "1.4.32-2"
versionCode 1001043203
versionName "1.4.32-3"
}

flavorDimensions "default"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.32.2</string>
<string>1.4.32.3</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.32.2</string>
<string>1.4.32.3</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleShortVersionString</key>
<string>1.4.32</string>
<key>CFBundleVersion</key>
<string>1.4.32.2</string>
<string>1.4.32.3</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.32-2",
"version": "1.4.32-3",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
7 changes: 1 addition & 6 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ function expandURLPreview(reportID: string, reportActionID: string) {
}

/** Marks the new report actions as read */
function readNewestAction(reportID: string, shouldEmitEvent = true) {
function readNewestAction(reportID: string) {
const lastReadTime = DateUtils.getDBTime();

const optimisticData: OnyxUpdate[] = [
Expand All @@ -958,11 +958,6 @@ function readNewestAction(reportID: string, shouldEmitEvent = true) {
};

API.write('ReadNewestAction', parameters, {optimisticData});

if (!shouldEmitEvent) {
return;
}

DeviceEventEmitter.emit(`readNewestAction_${reportID}`, lastReadTime);
}

Expand Down
46 changes: 2 additions & 44 deletions src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ function ReportActionsList({
const route = useRoute();
const opacity = useSharedValue(0);
const userActiveSince = useRef(null);
const userInactiveSince = useRef(null);

const markerInit = () => {
if (!cacheUnreadMarkers.has(report.reportID)) {
Expand Down Expand Up @@ -388,7 +387,7 @@ function ReportActionsList({
[currentUnreadMarker, sortedVisibleReportActions, report.reportID, messageManuallyMarkedUnread],
);

const calculateUnreadMarker = useCallback(() => {
useEffect(() => {
// Iterate through the report actions and set appropriate unread marker.
// This is to avoid a warning of:
// Cannot update a component (ReportActionsList) while rendering a different component (CellRenderer).
Expand All @@ -406,48 +405,7 @@ function ReportActionsList({
if (!markerFound) {
setCurrentUnreadMarker(null);
}
}, [sortedVisibleReportActions, shouldDisplayNewMarker, currentUnreadMarker, report.reportID]);

useEffect(() => {
calculateUnreadMarker();
}, [calculateUnreadMarker, report.lastReadTime, messageManuallyMarkedUnread]);

const onVisibilityChange = useCallback(() => {
if (!Visibility.isVisible()) {
userInactiveSince.current = DateUtils.getDBTime();
return;
}
// In case the user read new messages (after being inactive) with other device we should
// show marker based on report.lastReadTime
const newMessageTimeReference = userInactiveSince.current > report.lastReadTime ? userActiveSince.current : report.lastReadTime;
if (
scrollingVerticalOffset.current >= MSG_VISIBLE_THRESHOLD ||
!(
sortedVisibleReportActions &&
_.some(
sortedVisibleReportActions,
(reportAction) =>
newMessageTimeReference < reportAction.created &&
(ReportActionsUtils.isReportPreviewAction(reportAction) ? reportAction.childLastActorAccountID : reportAction.actorAccountID) !== Report.getCurrentUserAccountID(),
)
)
) {
return;
}

Report.readNewestAction(report.reportID, false);
userActiveSince.current = DateUtils.getDBTime();
lastReadTimeRef.current = newMessageTimeReference;
setCurrentUnreadMarker(null);
cacheUnreadMarkers.delete(report.reportID);
calculateUnreadMarker();
}, [calculateUnreadMarker, report, sortedVisibleReportActions]);

useEffect(() => {
const unsubscribeVisibilityListener = Visibility.onVisibilityChange(onVisibilityChange);

return unsubscribeVisibilityListener;
}, [onVisibilityChange]);
}, [sortedVisibleReportActions, report.lastReadTime, report.reportID, messageManuallyMarkedUnread, shouldDisplayNewMarker, currentUnreadMarker]);

const renderItem = useCallback(
({item: reportAction, index}) => (
Expand Down

0 comments on commit b7c56e2

Please sign in to comment.