From c9766a6b7ddec7116a03023a343d840401f284c4 Mon Sep 17 00:00:00 2001
From: OSBotify <infra+osbotify@expensify.com>
Date: Mon, 29 Apr 2024 22:19:43 +0000
Subject: [PATCH 1/2] Update version to 1.4.67-5

---
 android/app/build.gradle                      |  4 +-
 .../account-settings/Set-notifications.md     | 82 ++++++++++++++++---
 ios/NewExpensify/Info.plist                   |  2 +-
 ios/NewExpensifyTests/Info.plist              |  2 +-
 ios/NotificationServiceExtension/Info.plist   |  2 +-
 package-lock.json                             |  4 +-
 package.json                                  |  2 +-
 7 files changed, 79 insertions(+), 19 deletions(-)

diff --git a/android/app/build.gradle b/android/app/build.gradle
index 7e475a80f68c..d9e402067f83 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -98,8 +98,8 @@ android {
         minSdkVersion rootProject.ext.minSdkVersion
         targetSdkVersion rootProject.ext.targetSdkVersion
         multiDexEnabled rootProject.ext.multiDexEnabled
-        versionCode 1001046704
-        versionName "1.4.67-4"
+        versionCode 1001046705
+        versionName "1.4.67-5"
         // Supported language variants must be declared here to avoid from being removed during the compilation.
         // This also helps us to not include unnecessary language variants in the APK.
         resConfigs "en", "es"
diff --git a/docs/articles/expensify-classic/settings/account-settings/Set-notifications.md b/docs/articles/expensify-classic/settings/account-settings/Set-notifications.md
index 2d561ea598d9..0e18d6f22cf5 100644
--- a/docs/articles/expensify-classic/settings/account-settings/Set-notifications.md
+++ b/docs/articles/expensify-classic/settings/account-settings/Set-notifications.md
@@ -1,15 +1,75 @@
 ---
 title: Set notifications
-description: Select your Expensify notification preferences 
----
-<div id="expensify-classic" markdown="1">
+description: This article is about how to troubleshoot notifications from Expensify. 
+--- 
+
+# Overview 
+Sometimes, members may have trouble receiving important email notifications from Expensify, such as Expensify Magic Code emails, account validation emails, secondary login validations, integration emails, or report action notifications (rejections, approvals, etc.). 
+
+# Here's how to troubleshoot missing Expensify notifications:
+
+1. **No error message, but the email is never received**
+The email might be delayed; give it 30-60 minutes to arrive in your inbox.
+Check **Email Preferences** on the web via **Settings > Your Account > Preferences**In the **Contact Preferences** section. Ensure that the relevant boxes are checked for the email type you're missing. Check your email spam and trash folders, as Expensify messages might end up there inadvertently.
+Check to make sure you haven't unintentionally blocked Expensify emails and whitelist [expensify.com](https://community.expensify.com/home/leaving?allowTrusted=1&target=http%3A%2F%2Fexpensify.com%2F), mg.expensify.com, and [amazonSES.com](https://community.expensify.com/home/leaving?allowTrusted=1&target=http%3A%2F%2Famazonses.com%2F) with your email provider.
+
+2. **A "We're having trouble emailing you" banner at the top of your screen**
+Verify that your email address in your account settings is correct and is a real deliverable email address. 
+Re-send Verification Email: Look for an option to re-send a verification email, usually provided when this banner appears.
+
+![ExpensifyHelp_EmailError]({{site.url}}/assets/images/ExpensifyHelp_EmailError.png){:width="100%"}
+
+# Deep Dive 
+
+**For Private Domains**:
+
+If your organization uses a private domain, consult your IT department or IT person to ensure that the following domains are whitelisted to receive our emails: expensify.com, mg.expensify.com, and amazonSES.com. These domains are the sources of various notification emails, so make sure they aren't being blocked.
+
+**For Public Domains (e.g., Gmail, Yahoo, Hotmail)**:
+
+To whitelist our emails on public email services:
+
+1. Check your Spam Folder: Search for messages from expensify.com in your Spam folder, open them, and click "Not Spam" at the top of the message.
+2. Create a Filter: Set up a filter that identifies the entire expensify.com domain and directs all incoming messages to your inbox, preventing them from going to Spam.
+3. Add Specific Contacts: While optional, adding specific email addresses from Expensify as contacts can further prevent emails from going to Spam.
+
+Please note that even if you receive emails from our Concierge support communication, ensure that both expensify.com and mg.expensify.com are whitelisted as they use different servers.
+
+**Email Server Blocking**:
+Your email server may be blocking our emails due to spam filters or other services. Check with your IT department to investigate and resolve any server-level email blocking issues.
+
+**Mimecast**:
+If your company uses Mimecast, a service that can affect email deliverability, check with your IT department. If Mimecast is in use, reach out to us at concierge@expensify.com through a new email, as this should ensure delivery to your inbox. Mimecast should eventually recognize the Expensify domain, preventing future filtering.
+
+**For Outlook Users**:
+For Outlook users specifically:
+
+1. Click the gear icon in Outlook and select "View all Outlook settings."
+2. Choose "Mail" from the settings menu.
+3. Under the "Junk email" submenu, click "Add" under "Safe senders and domains."
+4. Enter the email address you want to whitelist.
+5. Click "Save."
+
+When you click the "Settings" link in the banner in Expensify, you'll be directed to your account settings page, where you may encounter a few different scenarios:
+
+- "Temporarily Suspended Emails": If the message mentions "temporarily suspended emails to," follow the steps provided in the yellow box. This situation typically occurs when we can't find a valid inbox to send our emails to. Possible reasons include:
+     - A misspelled email address during account creation.
+     - Use of a distribution list email (acting as an "alias" email) without a linked inbox.
+     - An auto-responder that has been responding to our emails for an extended period.
+- To resolve this issue, confirm that the email address is indeed associated with an active inbox. Then, click the link that says "here," and your email should be unblocked shortly.
+- SMTP Error (Gray Box): In some cases, you might encounter a gray box with an SMTP error message. This error can vary, but it typically looks something like this:
+
+![ExpensifyHelp_SMTPError]({{site.url}}/assets/images/ExpensifyHelp_SMTPError.png){:width="100%"}
+
+**These look a bit cryptic, yes, but hang in there!** 
+
+The error messages you see are the raw message text received from your email provider's server to Amazon. These messages can vary in text, but the best course of action is to follow the link provided (by copying and pasting) in the text for the next steps.
+
+**Scenario 1**: If the message in the gray box includes "mimecast.com": It means that our emails are being blocked by the server. In this case, you should contact your IT person or team to address the issue.
 
-{% include info.html %}
-This process is currently not available from the mobile app and must be completed from the Expensify website.
-{% include end-info.html %} 
+**Scenario 2**: If the message in the gray box mentions "blacklist at org/.com/.net," or resembles the screenshot provided, it indicates that your IT team has configured your email to use a third-party email reputation or blacklisting service. Here's what you need to know:
+- All our emails are SPF and DKIM-signed, meaning they are cryptographically signed as coming from us and are not spam.
+- The problem arises because we send mail from a cloud-based service. This means that the sender's IP serves multiple vendors, including Expensify. If one of those vendors is marked as spam, it can block all messages from that IP, even if they're from different vendors (including us).
+- The better approach is for the server to flag spam via DKIM and SPF (rather than solely relying on the sender's IP address), as our messages are correctly signed and encrypted to prevent spoofing.
 
-1. Hover over Settings and click **Account**.
-2. Click the **Preferences** tab on the left. 
-3. Scroll down to the Contact Preferences section. 
-4. Select the checkbox for the types of notifications you wish to receive. 
-</div>
+To resolve these issues, consider discussing them with your IT team, as they can help implement the necessary changes to ensure you receive our emails without interruption.
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index f5edd2dd2e2c..0a76e4f49603 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -40,7 +40,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>1.4.67.4</string>
+	<string>1.4.67.5</string>
 	<key>FullStory</key>
 	<dict>
 		<key>OrgId</key>
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index d502fd28a08a..0005b0698301 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>1.4.67.4</string>
+	<string>1.4.67.5</string>
 </dict>
 </plist>
diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist
index 23ab73168c89..4df87d9d4bd4 100644
--- a/ios/NotificationServiceExtension/Info.plist
+++ b/ios/NotificationServiceExtension/Info.plist
@@ -13,7 +13,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>1.4.67</string>
 	<key>CFBundleVersion</key>
-	<string>1.4.67.4</string>
+	<string>1.4.67.5</string>
 	<key>NSExtension</key>
 	<dict>
 		<key>NSExtensionPointIdentifier</key>
diff --git a/package-lock.json b/package-lock.json
index c3d039b55518..ea5c97a6c81f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "new.expensify",
-  "version": "1.4.67-4",
+  "version": "1.4.67-5",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "new.expensify",
-      "version": "1.4.67-4",
+      "version": "1.4.67-5",
       "hasInstallScript": true,
       "license": "MIT",
       "dependencies": {
diff --git a/package.json b/package.json
index db5296ad4b02..681fbcb54bd6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "new.expensify",
-  "version": "1.4.67-4",
+  "version": "1.4.67-5",
   "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.",

From e213cf80a549b9555abdb427587b0b6253e469c9 Mon Sep 17 00:00:00 2001
From: Kevin Brian Bader <kevin.bader96@gmail.com>
Date: Mon, 13 May 2024 12:02:37 -0700
Subject: [PATCH 2/2] Revert: [NewFeature] Automatic scrolling to the top of
 report's new unread message marker

---
 .../useReportScrollManager/index.native.ts    |  8 ++----
 src/hooks/useReportScrollManager/index.ts     |  9 +++----
 src/hooks/useReportScrollManager/types.ts     |  2 +-
 src/pages/home/report/ReportActionsList.tsx   | 25 -------------------
 4 files changed, 6 insertions(+), 38 deletions(-)

diff --git a/src/hooks/useReportScrollManager/index.native.ts b/src/hooks/useReportScrollManager/index.native.ts
index 20416dd96bf7..6666a4ebd0f2 100644
--- a/src/hooks/useReportScrollManager/index.native.ts
+++ b/src/hooks/useReportScrollManager/index.native.ts
@@ -7,17 +7,13 @@ function useReportScrollManager(): ReportScrollManagerData {
 
     /**
      * Scroll to the provided index.
-     * @param viewPosition (optional) - `0`: top, `0.5`: center, `1`: bottom
      */
-    // We're defaulting isEditing to false in order to match the
-    // number of arguments that index.ts version has.
-    // eslint-disable-next-line @typescript-eslint/no-unused-vars
-    const scrollToIndex = (index: number, isEditing = false, viewPosition?: number) => {
+    const scrollToIndex = (index: number) => {
         if (!flatListRef?.current) {
             return;
         }
 
-        flatListRef.current.scrollToIndex({index, viewPosition});
+        flatListRef.current.scrollToIndex({index});
     };
 
     /**
diff --git a/src/hooks/useReportScrollManager/index.ts b/src/hooks/useReportScrollManager/index.ts
index 11e92991c28e..c60ba771917e 100644
--- a/src/hooks/useReportScrollManager/index.ts
+++ b/src/hooks/useReportScrollManager/index.ts
@@ -6,17 +6,14 @@ function useReportScrollManager(): ReportScrollManagerData {
     const {flatListRef} = useContext(ActionListContext);
 
     /**
-     * Scroll to the provided index.
-     * On non-native implementations we do not want to scroll when we are scrolling because
-     * we are editing a comment.
-     * @param viewPosition (optional) - `0`: top, `0.5`: center, `1`: bottom
+     * Scroll to the provided index. On non-native implementations we do not want to scroll when we are scrolling because
      */
-    const scrollToIndex = (index: number, isEditing?: boolean, viewPosition?: number) => {
+    const scrollToIndex = (index: number, isEditing?: boolean) => {
         if (!flatListRef?.current || isEditing) {
             return;
         }
 
-        flatListRef.current.scrollToIndex({index, animated: true, viewPosition});
+        flatListRef.current.scrollToIndex({index, animated: true});
     };
 
     /**
diff --git a/src/hooks/useReportScrollManager/types.ts b/src/hooks/useReportScrollManager/types.ts
index 881114498221..5182f7269a9c 100644
--- a/src/hooks/useReportScrollManager/types.ts
+++ b/src/hooks/useReportScrollManager/types.ts
@@ -2,7 +2,7 @@ import type {FlatListRefType} from '@pages/home/ReportScreenContext';
 
 type ReportScrollManagerData = {
     ref: FlatListRefType;
-    scrollToIndex: (index: number, isEditing?: boolean, viewPosition?: number) => void;
+    scrollToIndex: (index: number, isEditing?: boolean) => void;
     scrollToBottom: () => void;
 };
 
diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx
index 6eb4da41468e..24881c7a5825 100644
--- a/src/pages/home/report/ReportActionsList.tsx
+++ b/src/pages/home/report/ReportActionsList.tsx
@@ -507,31 +507,6 @@ function ReportActionsList({
         calculateUnreadMarker();
     }, [calculateUnreadMarker, report.lastReadTime, messageManuallyMarkedUnread]);
 
-    useEffect(() => {
-        const scrollToFirstUnreadMessage = () => {
-            if (!currentUnreadMarker) {
-                return;
-            }
-
-            const unreadMessageIndex = sortedVisibleReportActions.findIndex((action) => action.reportActionID === currentUnreadMarker);
-
-            // Checking that we have a valid unread message index and the user scroll
-            // offset is less than the threshold since we don't want to auto-scroll when
-            // the report is already open and New Messages marker is shown as user might be reading.
-            if (unreadMessageIndex !== -1 && scrollingVerticalOffset.current < VERTICAL_OFFSET_THRESHOLD) {
-                // We're passing viewPosition: 1 to scroll to the top of the
-                // unread message (marker) since we're using an inverted FlatList.
-                reportScrollManager?.scrollToIndex(unreadMessageIndex, false, 1);
-            }
-        };
-
-        // Call the scroll function after a small delay to ensure all items
-        // have been measured and the list is ready to be scrolled.
-        InteractionManager.runAfterInteractions(scrollToFirstUnreadMessage);
-        // We only want to run this effect once, when we're navigating to a report with unread messages.
-        // eslint-disable-next-line react-hooks/exhaustive-deps
-    }, [sortedVisibleReportActions]);
-
     useEffect(() => {
         if (!userActiveSince.current || report.reportID !== prevReportID) {
             return;