From aeaf7c068e334ba6e6345027a65f607484846ba7 Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Fri, 15 Jul 2022 14:31:40 -0700
Subject: [PATCH 1/8] replace deprecated ResetPassword with new 
 RequestPasswordReset write command

---
 src/libs/actions/Session/index.js | 41 +++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/src/libs/actions/Session/index.js b/src/libs/actions/Session/index.js
index 3223a159b223..72f46b88c003 100644
--- a/src/libs/actions/Session/index.js
+++ b/src/libs/actions/Session/index.js
@@ -302,11 +302,42 @@ function signInWithShortLivedToken(email, shortLivedToken) {
  * User forgot the password so let's send them the link to reset their password
  */
 function resetPassword() {
-    Onyx.merge(ONYXKEYS.ACCOUNT, {loading: true, forgotPassword: true});
-    DeprecatedAPI.ResetPassword({email: credentials.login})
-        .finally(() => {
-            Onyx.merge(ONYXKEYS.ACCOUNT, {loading: false, validateCodeExpired: false});
-        });
+    API.write('RequestPasswordReset', {
+        email: credentials.login
+    },
+    {
+        optimisticData: [
+            {
+                onyxMethod:'merge',
+                key: ONYXKEYS.ACCOUNT,
+                value: {
+                    isLoading: true,
+                    forgotPassword: true
+                }
+            },
+         ],
+         successData: [
+            {
+                onyxMethod:'merge',
+                key: ONYXKEYS.ACCOUNT,
+                value: {
+                    isLoading: false,
+                    validateCodeExpired: false,
+                    forgotPassword: false
+                }
+            },
+         ],
+         failureData: [
+            {
+                onyxMethod:'merge',
+                key: ONYXKEYS.ACCOUNT,
+                value: {
+                    isLoading: false,
+                    validateCodeExpired: false
+                }
+            },
+         ],
+    });
 }
 
 /**

From 83910823f76bf6ad58a278893738f6051f1c44a4 Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Fri, 15 Jul 2022 17:31:13 -0700
Subject: [PATCH 2/8] remove references to ResetPassword API command

---
 src/libs/Network/enhanceParameters.js |  1 -
 src/libs/deprecatedAPI.js             | 12 ------------
 2 files changed, 13 deletions(-)

diff --git a/src/libs/Network/enhanceParameters.js b/src/libs/Network/enhanceParameters.js
index 9c7356685ce1..093c0d96c087 100644
--- a/src/libs/Network/enhanceParameters.js
+++ b/src/libs/Network/enhanceParameters.js
@@ -19,7 +19,6 @@ function isAuthTokenRequired(command) {
         'SetPassword',
         'User_SignUp',
         'ResendValidateCode',
-        'ResetPassword',
         'User_ReopenAccount',
         'ValidateEmail',
     ], command);
diff --git a/src/libs/deprecatedAPI.js b/src/libs/deprecatedAPI.js
index cffdac6fdbd8..fdecc6958616 100644
--- a/src/libs/deprecatedAPI.js
+++ b/src/libs/deprecatedAPI.js
@@ -338,17 +338,6 @@ function SetNameValuePair(parameters) {
     return Network.post(commandName, parameters);
 }
 
-/**
- * @param {Object} parameters
- * @param {string} parameters.email
- * @returns {Promise}
- */
-function ResetPassword(parameters) {
-    const commandName = 'ResetPassword';
-    requireParameters(['email'], parameters, commandName);
-    return Network.post(commandName, parameters);
-}
-
 /**
  * @param {Object} parameters
  * @param {String} parameters.password
@@ -861,7 +850,6 @@ export {
     Report_GetHistory,
     Report_EditComment,
     ResendValidateCode,
-    ResetPassword,
     SetNameValuePair,
     SetPassword,
     SetWalletLinkedAccount,

From 8af0fb620ea5b8b2221c2bcc608a3c73f8b1da0d Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Fri, 15 Jul 2022 17:31:32 -0700
Subject: [PATCH 3/8] style fixes

---
 src/libs/actions/Session/index.js | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/libs/actions/Session/index.js b/src/libs/actions/Session/index.js
index 72f46b88c003..eb44f2b26fa2 100644
--- a/src/libs/actions/Session/index.js
+++ b/src/libs/actions/Session/index.js
@@ -303,40 +303,40 @@ function signInWithShortLivedToken(email, shortLivedToken) {
  */
 function resetPassword() {
     API.write('RequestPasswordReset', {
-        email: credentials.login
+        email: credentials.login,
     },
     {
         optimisticData: [
             {
-                onyxMethod:'merge',
+                onyxMethod: 'merge',
                 key: ONYXKEYS.ACCOUNT,
                 value: {
                     isLoading: true,
-                    forgotPassword: true
-                }
+                    forgotPassword: true,
+                },
             },
-         ],
-         successData: [
+        ],
+        successData: [
             {
-                onyxMethod:'merge',
+                onyxMethod: 'merge',
                 key: ONYXKEYS.ACCOUNT,
                 value: {
                     isLoading: false,
                     validateCodeExpired: false,
-                    forgotPassword: false
-                }
+                    forgotPassword: false,
+                },
             },
-         ],
-         failureData: [
+        ],
+        failureData: [
             {
-                onyxMethod:'merge',
+                onyxMethod: 'merge',
                 key: ONYXKEYS.ACCOUNT,
                 value: {
                     isLoading: false,
-                    validateCodeExpired: false
-                }
+                    validateCodeExpired: false,
+                },
             },
-         ],
+        ],
     });
 }
 

From cdb3c6700ff976fb01ae7d360ffd691923d59dde Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Fri, 15 Jul 2022 19:03:59 -0700
Subject: [PATCH 4/8] add offline indicator and disable button if network is
 offline

---
 src/pages/signin/ResendValidationForm.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/pages/signin/ResendValidationForm.js b/src/pages/signin/ResendValidationForm.js
index 701cc41d8561..6d55b4683898 100755
--- a/src/pages/signin/ResendValidationForm.js
+++ b/src/pages/signin/ResendValidationForm.js
@@ -14,6 +14,9 @@ import compose from '../../libs/compose';
 import redirectToSignIn from '../../libs/actions/SignInRedirect';
 import Avatar from '../../components/Avatar';
 import * as ReportUtils from '../../libs/ReportUtils';
+import OfflineIndicator from '../../components/OfflineIndicator';
+import networkPropTypes from '../../components/networkPropTypes';
+import {withNetwork} from '../../components/OnyxProvider';
 
 const propTypes = {
     /* Onyx Props */
@@ -39,6 +42,9 @@ const propTypes = {
         accountExists: PropTypes.bool,
     }),
 
+    /** Information about the network */
+    network: networkPropTypes.isRequired,
+
     ...withLocalizePropTypes,
 };
 
@@ -143,8 +149,10 @@ class ResendValidationForm extends React.Component {
                         text={this.props.translate('resendValidationForm.resendLink')}
                         isLoading={this.props.account.loading}
                         onPress={this.validateAndSubmitForm}
+                        isDisabled={this.props.network.isOffline}
                     />
                 </View>
+                <OfflineIndicator />
             </>
         );
     }
@@ -155,6 +163,7 @@ ResendValidationForm.defaultProps = defaultProps;
 
 export default compose(
     withLocalize,
+    withNetwork(),
     withOnyx({
         credentials: {key: ONYXKEYS.CREDENTIALS},
         account: {key: ONYXKEYS.ACCOUNT},

From 4cc65f78e1758eb1842a17cc8078f1e60087e653 Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Sun, 17 Jul 2022 21:53:09 -0600
Subject: [PATCH 5/8] update offline indicator to take left indentation as
 optional styles

---
 src/components/FormAlertWrapper.js           |  2 +-
 src/components/OfflineIndicator.js           | 18 ++++++++++++++++--
 src/libs/actions/Session/index.js            |  1 -
 src/pages/home/report/ReportActionCompose.js |  2 +-
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/components/FormAlertWrapper.js b/src/components/FormAlertWrapper.js
index 889eaa3cea54..652d20fec9d1 100644
--- a/src/components/FormAlertWrapper.js
+++ b/src/components/FormAlertWrapper.js
@@ -82,7 +82,7 @@ const FormAlertWrapper = props => (
             </View>
         )}
         {props.children(props.network.isOffline)}
-        {props.network.isOffline && <OfflineIndicator />}
+        <OfflineIndicator style={[styles.chatItemComposeSecondaryRowOffset]} />
     </View>
 );
 
diff --git a/src/components/OfflineIndicator.js b/src/components/OfflineIndicator.js
index f06a16640c84..34abea32528c 100644
--- a/src/components/OfflineIndicator.js
+++ b/src/components/OfflineIndicator.js
@@ -1,5 +1,6 @@
 import React from 'react';
 import {View} from 'react-native';
+import PropTypes from 'prop-types';
 import {withNetwork} from './OnyxProvider';
 import networkPropTypes from './networkPropTypes';
 import Icon from './Icon';
@@ -9,14 +10,25 @@ import Text from './Text';
 import styles from '../styles/styles';
 import compose from '../libs/compose';
 import withLocalize, {withLocalizePropTypes} from './withLocalize';
+import * as StyleUtils from '../styles/StyleUtils';
 
 const propTypes = {
     /** Information about the network */
     network: networkPropTypes.isRequired,
 
+    /** Additional styles to add after local styles. Applied to Pressable portion of button */
+    style: PropTypes.oneOfType([
+        PropTypes.arrayOf(PropTypes.object),
+        PropTypes.object,
+    ]),
+
     ...withLocalizePropTypes,
 };
 
+const defaultProps = {
+    style: [],
+};
+
 const OfflineIndicator = (props) => {
     if (!props.network.isOffline) {
         return null;
@@ -24,9 +36,10 @@ const OfflineIndicator = (props) => {
 
     return (
         <View style={[
-            styles.chatItemComposeSecondaryRowOffset,
             styles.flexRow,
-            styles.alignItemsCenter]}
+            styles.alignItemsCenter,
+            ...StyleUtils.parseStyleAsArray(props.style),
+        ]}
         >
             <Icon
                 src={Expensicons.Offline}
@@ -41,6 +54,7 @@ const OfflineIndicator = (props) => {
 };
 
 OfflineIndicator.propTypes = propTypes;
+OfflineIndicator.defaultProps = defaultProps;
 OfflineIndicator.displayName = 'OfflineIndicator';
 
 export default compose(
diff --git a/src/libs/actions/Session/index.js b/src/libs/actions/Session/index.js
index eb44f2b26fa2..87d9d95e947b 100644
--- a/src/libs/actions/Session/index.js
+++ b/src/libs/actions/Session/index.js
@@ -323,7 +323,6 @@ function resetPassword() {
                 value: {
                     isLoading: false,
                     validateCodeExpired: false,
-                    forgotPassword: false,
                 },
             },
         ],
diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js
index 0f6ed0e9ea1f..89885070d385 100755
--- a/src/pages/home/report/ReportActionCompose.js
+++ b/src/pages/home/report/ReportActionCompose.js
@@ -672,7 +672,7 @@ class ReportActionCompose extends React.Component {
                     </View>
                 </View>
                 <View style={[styles.chatItemComposeSecondaryRow, styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter]}>
-                    <OfflineIndicator />
+                    <OfflineIndicator style={[styles.chatItemComposeSecondaryRowOffset]} />
                     <ReportTypingIndicator reportID={this.props.reportID} />
                     <ExceededCommentLength commentLength={this.comment.length} />
                 </View>

From 820ebdd825a375ccc5d5809c3a106ff307a68ade Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Sun, 17 Jul 2022 21:55:44 -0600
Subject: [PATCH 6/8] update comment

---
 src/components/OfflineIndicator.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/OfflineIndicator.js b/src/components/OfflineIndicator.js
index 34abea32528c..ec87c29072b7 100644
--- a/src/components/OfflineIndicator.js
+++ b/src/components/OfflineIndicator.js
@@ -16,7 +16,7 @@ const propTypes = {
     /** Information about the network */
     network: networkPropTypes.isRequired,
 
-    /** Additional styles to add after local styles. Applied to Pressable portion of button */
+    /** Additional styles to add after local styles.
     style: PropTypes.oneOfType([
         PropTypes.arrayOf(PropTypes.object),
         PropTypes.object,

From 3e6af7898d4f70c8b83179fb7d0a8c8f59333f84 Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Sun, 17 Jul 2022 22:04:58 -0600
Subject: [PATCH 7/8] terminate comment correctly

---
 src/components/OfflineIndicator.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/OfflineIndicator.js b/src/components/OfflineIndicator.js
index ec87c29072b7..c4f0068e6c1c 100644
--- a/src/components/OfflineIndicator.js
+++ b/src/components/OfflineIndicator.js
@@ -16,7 +16,7 @@ const propTypes = {
     /** Information about the network */
     network: networkPropTypes.isRequired,
 
-    /** Additional styles to add after local styles.
+    /** Additional styles to add after local styles. */
     style: PropTypes.oneOfType([
         PropTypes.arrayOf(PropTypes.object),
         PropTypes.object,

From cbb77c98f489161d8d947da29be635581b0a8127 Mon Sep 17 00:00:00 2001
From: Nikki Wines <nikkiwines@expensify.com>
Date: Wed, 20 Jul 2022 19:45:07 -0600
Subject: [PATCH 8/8] add space before comment

---
 src/components/OfflineIndicator.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/components/OfflineIndicator.js b/src/components/OfflineIndicator.js
index 3c94c0f53091..0a450e649db6 100644
--- a/src/components/OfflineIndicator.js
+++ b/src/components/OfflineIndicator.js
@@ -22,6 +22,7 @@ const propTypes = {
         PropTypes.arrayOf(PropTypes.object),
         PropTypes.object,
     ]),
+
     /** Is the window width narrow, like on a mobile device */
     isSmallScreenWidth: PropTypes.bool.isRequired,
 
