Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Expensify/App into 28011-ad…
Browse files Browse the repository at this point in the history
…d-proper-go-back
  • Loading branch information
BhuvaneshPatil committed Oct 2, 2023
2 parents 0a36072 + 69ecebc commit 7077466
Show file tree
Hide file tree
Showing 51 changed files with 146 additions and 111 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001037502
versionName "1.3.75-2"
versionCode 1001037508
versionName "1.3.75-8"
}

flavorDimensions "default"
Expand Down
3 changes: 3 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
gem "webrick", "~> 1.7"

gem 'jekyll-seo-tag'

gem 'jekyll-redirect-from'

3 changes: 2 additions & 1 deletion docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,12 @@ DEPENDENCIES
github-pages
http_parser.rb (~> 0.6.0)
jekyll-feed (~> 0.12)
jekyll-redirect-from
jekyll-seo-tag
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
webrick (~> 1.7)

BUNDLED WITH
2.4.3
2.4.19
4 changes: 4 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ exclude: [README.md, TEMPLATE.md, vendor]

plugins:
- jekyll-seo-tag
- jekyll-redirect-from

whitelist:
- jekyll-redirect-from
1 change: 1 addition & 0 deletions docs/articles/expensify-classic/exports/Insights.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Custom Reporting and Insights
description: How to get the most out of the Custom Reporing and Insights
redirect_from: articles/other/Insights/
---
<!-- The lines above are required by Jekyll to process the .md file -->
{% raw %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Referral Program
description: Send your joining link, submit a receipt or invoice, and we'll pay you if your referral adopts Expensify.
redirect_from: articles/other/Referral-Program/
---
<!-- The lines above are required by Jekyll to process the .md file -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Card revenue share for ExpensifyApproved! partners
description: Earn money when your clients adopt the Expensify Card
redirect_from: articles/other/Card-Revenue-Share-for-ExpensifyApproved!-Partners/
---
<!-- The lines above are required by Jekyll to process the .md file -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Your Expensify Partner Manager
description: Everything you need to know about your Expensify Partner Manager
redirect_from: articles/other/Your-Expensify-Partner-Manager/
---
<!-- The lines above are required by Jekyll to process the .md file -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Playbook for Small to Medium-Sized Businesses
description: Best practices for how to deploy Expensify for your business
redirect_from: articles/playbooks/Expensify-Playbook-for-Small-to-Medium-Sized-Businesses/
---
## Overview
This guide provides practical tips and recommendations for small businesses with 100 to 250 employees to effectively use Expensify to improve spend visibility, facilitate employee reimbursements, and reduce the risk of fraudulent expenses.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Playbook for US-Based Bootstrapped Startups
description: Best practices for how to deploy Expensify for your business
redirect_from: articles/playbooks/Expensify-Playbook-for-US-Based-Bootstrapped-Startups/
---

This playbook details best practices on how Bootstrapped Startups with less than 5 employees can use Expensify to prioritize product development while capturing business-related receipts for future reimbursement.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Playbook for US-Based VC-Backed Startups
description: Best practices for how to deploy Expensify for your business
redirect_from: articles/playbooks/Expensify-Playbook-for-US-based-VC-Backed-Startups/
---
This playbook details best practices on how Seed to Series A startups with under 100 employees can use Expensify to prioritize top-line revenue growth while managing spend responsibly.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Your Expensify Account Manager
description: Everything you need to know about Having an Expensify account manager
redirect_from: articles/other/Your-Expensify-Account-Manager/
---

<!-- The lines above are required by Jekyll to process the .md file -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Enable Location Access on Web
description: How to enable location access for Expensify websites on your browser
redirect_from: articles/other/Enable-Location-Access-on-Web/
---
<!-- The lines above are required by Jekyll to process the .md file -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: The Free Plan
description: Everything you need to know about Expensify's Free Plan!
redirect_from: articles/split-bills/workspaces/The-Free-Plan/
---

<!-- The lines above are required by Jekyll to process the .md file -->
Expand Down
1 change: 1 addition & 0 deletions docs/articles/new-expensify/get-paid-back/Request-Money.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Request Money
description: Request Money
redirect_from: articles/request-money/Request-and-Split-Bills/
---
## Resource Coming Soon!
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Welcome to the Expensify Lounge!
description: How to get the most out of the Expensify Lounge.
redirect_from: articles/other/Expensify-Lounge/
---
<!-- The lines above are required by Jekyll to process the .md file -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Everything About Chat
description: Everything you need to know about Expensify's Chat Features!
redirect_from: articles/other/Everything-About-Chat/
---

<!-- The lines above are required by Jekyll to process the .md file -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Chat for Admins
description: Best Practices for Admins settings up Expensify Chat
redirect_from: articles/other/Expensify-Chat-For-Admins/
---

## Overview
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Chat for Conference Attendees
description: Best Practices for Conference Attendees
redirect_from: articles/other/Expensify-Chat-For-Conference-Attendees/
---

## Overview
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Chat for Conference Speakers
description: Best Practices for Conference Speakers
redirect_from: articles/other/Expensify-Chat-For-Conference-Speakers/
---

## Overview
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Expensify Chat Playbook for Conferences
description: Best practices for how to deploy Expensify Chat for your conference
redirect_from: articles/playbooks/Expensify-Chat-Playbook-for-Conferences/
---
## Overview
To help make setting up Expensify Chat for your event and your attendees super simple, we’ve created a guide for all of the technical setup details.
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.3.75.2</string>
<string>1.3.75.8</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.3.75.2</string>
<string>1.3.75.8</string>
</dict>
</plist>
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.3.75-2",
"version": "1.3.75-8",
"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
2 changes: 1 addition & 1 deletion src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function Composer({
const paddingTopAndBottom = parseInt(computedStyle.paddingBottom, 10) + parseInt(computedStyle.paddingTop, 10);
setTextInputWidth(computedStyle.width);

const computedNumberOfLines = ComposerUtils.getNumberOfLines(maxLines, lineHeight, paddingTopAndBottom, textInput.current.scrollHeight);
const computedNumberOfLines = ComposerUtils.getNumberOfLines(lineHeight, paddingTopAndBottom, textInput.current.scrollHeight, maxLines);
const generalNumberOfLines = computedNumberOfLines === 0 ? numberOfLinesProp : computedNumberOfLines;

onNumberOfLinesChange(generalNumberOfLines);
Expand Down
49 changes: 24 additions & 25 deletions src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import useNativeDriver from '../../libs/useNativeDriver';
import * as Browser from '../../libs/Browser';

function BaseTextInput(props) {
const inputValue = props.value || props.defaultValue || '';
const initialActiveLabel = props.forceActiveLabel || inputValue.length > 0 || Boolean(props.prefixCharacter);
const initialValue = props.value || props.defaultValue || '';
const initialActiveLabel = props.forceActiveLabel || initialValue.length > 0 || Boolean(props.prefixCharacter);

const [isFocused, setIsFocused] = useState(false);
const [passwordHidden, setPasswordHidden] = useState(props.secureTextEntry);
Expand Down Expand Up @@ -145,30 +145,16 @@ function BaseTextInput(props) {
[props.autoGrowHeight, props.multiline],
);

useEffect(() => {
// Handle side effects when the value gets changed programatically from the outside

// In some cases, When the value prop is empty, it is not properly updated on the TextInput due to its uncontrolled nature, thus manually clearing the TextInput.
if (inputValue === '') {
input.current.clear();
}

if (inputValue) {
activateLabel();
}
}, [activateLabel, inputValue]);

// We capture whether the input has a value or not in a ref.
// It gets updated when the text gets changed.
const hasValueRef = useRef(inputValue.length > 0);
// The ref is needed when the component is uncontrolled and we don't have a value prop
const hasValueRef = useRef(initialValue.length > 0);
const inputValue = props.value || '';
const hasValue = inputValue.length > 0 || hasValueRef.current;

// Activate or deactivate the label when the focus changes:
// Activate or deactivate the label when either focus changes, or for controlled
// components when the value prop changes:
useEffect(() => {
// We can't use inputValue here directly, as it might contain
// the defaultValue, which doesn't get updated when the text changes.
// We can't use props.value either, as it might be undefined.
if (
hasValueRef.current ||
hasValue ||
isFocused ||
// If the text has been supplied by Chrome autofill, the value state is not synced with the value
// as Chrome doesn't trigger a change event. When there is autofill text, keep the label activated.
Expand All @@ -178,7 +164,16 @@ function BaseTextInput(props) {
} else {
deactivateLabel();
}
}, [activateLabel, deactivateLabel, inputValue, isFocused]);
}, [activateLabel, deactivateLabel, hasValue, isFocused]);

// When the value prop gets cleared externally, we need to keep the ref in sync:
useEffect(() => {
// Return early when component uncontrolled, or we still have a value
if (props.value === undefined || !_.isEmpty(props.value)) {
return;
}
hasValueRef.current = false;
}, [props.value]);

/**
* Set Value & activateLabel
Expand All @@ -192,9 +187,13 @@ function BaseTextInput(props) {
}

Str.result(props.onChangeText, value);

if (value && value.length > 0) {
hasValueRef.current = true;
activateLabel();
// When the componment is uncontrolled, we need to manually activate the label:
if (props.value === undefined) {
activateLabel();
}
} else {
hasValueRef.current = false;
}
Expand Down
13 changes: 0 additions & 13 deletions src/libs/ComposerUtils/debouncedSaveReportComment.js

This file was deleted.

11 changes: 11 additions & 0 deletions src/libs/ComposerUtils/debouncedSaveReportComment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import debounce from 'lodash/debounce';
import * as Report from '../actions/Report';

/**
* Save draft report comment. Debounced to happen at most once per second.
*/
const debouncedSaveReportComment = debounce((reportID: string, comment = '') => {
Report.saveReportComment(reportID, comment);
}, 1000);

export default debouncedSaveReportComment;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Onyx from 'react-native-onyx';
import Onyx, {OnyxEntry} from 'react-native-onyx';
import ONYXKEYS from '../../ONYXKEYS';

const draftCommentMap = {};
const draftCommentMap: Record<string, OnyxEntry<string>> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT,
callback: (value, key) => {
Expand All @@ -18,9 +18,7 @@ Onyx.connect({
* Returns a draft comment from the onyx collection.
* Note: You should use the HOCs/hooks to get onyx data, instead of using this directly.
* A valid use case to use this is if the value is only needed once for an initial value.
* @param {String} reportID
* @returns {String|undefined}
*/
export default function getDraftComment(reportID) {
export default function getDraftComment(reportID: string): OnyxEntry<string> {
return draftCommentMap[reportID];
}
14 changes: 0 additions & 14 deletions src/libs/ComposerUtils/getNumberOfLines/index.native.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/libs/ComposerUtils/getNumberOfLines/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import GetNumberOfLines from './types';

/**
* Get the current number of lines in the composer
*/
const getNumberOfLines: GetNumberOfLines = (lineHeight, paddingTopAndBottom, scrollHeight) => Math.ceil((scrollHeight - paddingTopAndBottom) / lineHeight);

export default getNumberOfLines;
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import GetNumberOfLines from './types';

/**
* Get the current number of lines in the composer
*
* @param {Number} maxLines
* @param {Number} lineHeight
* @param {Number} paddingTopAndBottom
* @param {Number} scrollHeight
*
* @returns {Number}
*/
function getNumberOfLines(maxLines, lineHeight, paddingTopAndBottom, scrollHeight) {
const getNumberOfLines: GetNumberOfLines = (lineHeight, paddingTopAndBottom, scrollHeight, maxLines = 0) => {
let newNumberOfLines = Math.ceil((scrollHeight - paddingTopAndBottom) / lineHeight);
newNumberOfLines = maxLines <= 0 ? newNumberOfLines : Math.min(newNumberOfLines, maxLines);
return newNumberOfLines;
}
};

export default getNumberOfLines;
Loading

0 comments on commit 7077466

Please sign in to comment.