Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/wildan-m/App into wildan/21…
Browse files Browse the repository at this point in the history
…518/fix
  • Loading branch information
wildan-m committed Jul 13, 2023
2 parents d77aed9 + a5f6467 commit 3469b98
Show file tree
Hide file tree
Showing 30 changed files with 419 additions and 312 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2ePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }}
run: |
git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1
git switch ${{ steps.getMostRecentRelease.outputs.VERSION }}
git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }}
- name: Build APK
if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }}
Expand Down
4 changes: 4 additions & 0 deletions .well-known/apple-app-site-association
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"/": "/r/*",
"comment": "Reports"
},
{
"/": "/a/*",
"comment": "Profile Page"
},
{
"/": "/settings/*",
"comment": "Profile and app settings"
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001034001
versionName "1.3.40-1"
versionCode 1001034004
versionName "1.3.40-4"
}

splits {
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

<!-- Production URLs -->
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/r"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/a"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/settings"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/details"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/v"/>
Expand All @@ -65,6 +66,7 @@

<!-- Staging URLs -->
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/r"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/a"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/settings"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/details"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/v"/>
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">New Expensify</string>
<string name="app_name">Expensify Chat</string>
</resources>
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.40.1</string>
<string>1.3.40.4</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.40.1</string>
<string>1.3.40.4</string>
</dict>
</plist>
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.3.40-1",
"version": "1.3.40-4",
"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 Expand Up @@ -115,7 +115,7 @@
"react-native-key-command": "^1.0.1",
"react-native-localize": "^2.2.6",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.51",
"react-native-onyx": "1.0.52",
"react-native-pdf": "^6.6.2",
"react-native-performance": "^4.0.0",
"react-native-permissions": "^3.0.1",
Expand Down
96 changes: 53 additions & 43 deletions src/components/Composer/index.android.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useEffect, useCallback, useRef, useMemo} from 'react';
import {StyleSheet} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
Expand Down Expand Up @@ -63,57 +63,67 @@ const defaultProps = {
style: null,
};

class Composer extends React.Component {
constructor(props) {
super(props);
function Composer({shouldClear, onClear, isDisabled, maxLines, forwardedRef, isComposerFullSize, setIsFullComposerAvailable, ...props}) {
const textInput = useRef(null);

this.state = {
propStyles: StyleSheet.flatten(this.props.style),
};
}
/**
* Set the TextInput Ref
* @param {Element} el
*/
const setTextInputRef = useCallback((el) => {
textInput.current = el;
if (!_.isFunction(forwardedRef) || textInput.current === null) {
return;
}

componentDidMount() {
// This callback prop is used by the parent component using the constructor to
// get a ref to the inner textInput element e.g. if we do
// <constructor ref={el => this.textInput = el} /> this will not
// return a ref to the component, but rather the HTML element by default
if (!this.props.forwardedRef || !_.isFunction(this.props.forwardedRef)) {
return;
}

this.props.forwardedRef(this.textInput);
}
forwardedRef(textInput.current);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

componentDidUpdate(prevProps) {
if (prevProps.shouldClear || !this.props.shouldClear) {
useEffect(() => {
if (!shouldClear) {
return;
}

this.textInput.clear();
this.props.onClear();
}

render() {
return (
<RNTextInput
autoComplete="off"
placeholderTextColor={themeColors.placeholderText}
ref={(el) => (this.textInput = el)}
onContentSizeChange={(e) => ComposerUtils.updateNumberOfLines(this.props, e)}
rejectResponderTermination={false}
textAlignVertical="center"
// Setting a really high number here fixes an issue with the `maxNumberOfLines` prop on TextInput, where on Android the text input would collapse to only one line,
// when it should actually expand to the container (https://github.com/Expensify/App/issues/11694#issuecomment-1560520670)
// @Szymon20000 is working on fixing this (android-only) issue in the in the upstream PR (https://github.com/facebook/react-native/pulls?q=is%3Apr+is%3Aopen+maxNumberOfLines)
// TODO: remove this commend once upstream PR is merged
maximumNumberOfLines={this.props.isComposerFullSize ? 1000000 : this.props.maxLines}
style={this.state.propStyles}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...this.props}
editable={!this.props.isDisabled}
/>
);
}
textInput.current.clear();
onClear();
}, [shouldClear, onClear]);

/**
* Set maximum number of lines
* @return {Number}
*/
const maximumNumberOfLines = useMemo(() => {
if (isComposerFullSize) return 1000000;
return maxLines;
}, [isComposerFullSize, maxLines]);

const styles = useMemo(() => {
StyleSheet.flatten(props.style);
}, [props.style]);

return (
<RNTextInput
autoComplete="off"
placeholderTextColor={themeColors.placeholderText}
ref={setTextInputRef}
onContentSizeChange={(e) => ComposerUtils.updateNumberOfLines({maxLines, isComposerFullSize, isDisabled, setIsFullComposerAvailable}, e)}
rejectResponderTermination={false}
textAlignVertical="center"
// Setting a really high number here fixes an issue with the `maxNumberOfLines` prop on TextInput, where on Android the text input would collapse to only one line,
// when it should actually expand to the container (https://github.com/Expensify/App/issues/11694#issuecomment-1560520670)
// @Szymon20000 is working on fixing this (android-only) issue in the in the upstream PR (https://github.com/facebook/react-native/pulls?q=is%3Apr+is%3Aopen+maxNumberOfLines)
// TODO: remove this commend once upstream PR is merged
maximumNumberOfLines={maximumNumberOfLines}
style={styles}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...props}
editable={!isDisabled}
/>
);
}

Composer.propTypes = propTypes;
Expand Down
99 changes: 54 additions & 45 deletions src/components/Composer/index.ios.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useEffect, useRef, useMemo, useCallback} from 'react';
import {StyleSheet} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
Expand Down Expand Up @@ -63,59 +63,68 @@ const defaultProps = {
style: null,
};

class Composer extends React.Component {
constructor(props) {
super(props);
function Composer({shouldClear, onClear, isDisabled, maxLines, forwardedRef, isComposerFullSize, setIsFullComposerAvailable, ...props}) {
const textInput = useRef(null);

this.state = {
propStyles: StyleSheet.flatten(this.props.style),
};
}
/**
* Set the TextInput Ref
* @param {Element} el
*/
const setTextInputRef = useCallback((el) => {
textInput.current = el;
if (!_.isFunction(forwardedRef) || textInput.current === null) {
return;
}

componentDidMount() {
// This callback prop is used by the parent component using the constructor to
// get a ref to the inner textInput element e.g. if we do
// <constructor ref={el => this.textInput = el} /> this will not
// return a ref to the component, but rather the HTML element by default
if (!this.props.forwardedRef || !_.isFunction(this.props.forwardedRef)) {
return;
}

this.props.forwardedRef(this.textInput);
}
forwardedRef(textInput.current);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

componentDidUpdate(prevProps) {
if (prevProps.shouldClear || !this.props.shouldClear) {
useEffect(() => {
if (!shouldClear) {
return;
}

this.textInput.clear();
this.props.onClear();
}

render() {
// On native layers we like to have the Text Input not focused so the
// user can read new chats without the keyboard in the way of the view.
// On Android, the selection prop is required on the TextInput but this prop has issues on IOS
// https://github.com/facebook/react-native/issues/29063
const propsToPass = _.omit(this.props, 'selection');
return (
<RNTextInput
autoComplete="off"
placeholderTextColor={themeColors.placeholderText}
ref={(el) => (this.textInput = el)}
onContentSizeChange={(e) => ComposerUtils.updateNumberOfLines(this.props, e)}
rejectResponderTermination={false}
textAlignVertical="center"
smartInsertDelete={false}
maximumNumberOfLines={this.props.isComposerFullSize ? undefined : this.props.maxLines}
style={this.state.propStyles}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...propsToPass}
editable={!this.props.isDisabled}
/>
);
}
textInput.current.clear();
onClear();
}, [shouldClear, onClear]);

/**
* Set maximum number of lines
* @return {Number}
*/
const maximumNumberOfLines = useMemo(() => {
if (isComposerFullSize) return undefined;
return maxLines;
}, [isComposerFullSize, maxLines]);

const styles = useMemo(() => {
StyleSheet.flatten(props.style);
}, [props.style]);

// On native layers we like to have the Text Input not focused so the
// user can read new chats without the keyboard in the way of the view.
// On Android the selection prop is required on the TextInput but this prop has issues on IOS
const propsToPass = _.omit(props, 'selection');
return (
<RNTextInput
autoComplete="off"
placeholderTextColor={themeColors.placeholderText}
ref={setTextInputRef}
onContentSizeChange={(e) => ComposerUtils.updateNumberOfLines({maxLines, isComposerFullSize, isDisabled, setIsFullComposerAvailable}, e)}
rejectResponderTermination={false}
textAlignVertical="center"
smartInsertDelete={false}
maximumNumberOfLines={maximumNumberOfLines}
style={styles}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...propsToPass}
editable={!isDisabled}
/>
);
}

Composer.propTypes = propTypes;
Expand Down
6 changes: 5 additions & 1 deletion src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,11 @@ class Composer extends React.Component {
* @param {ClipboardEvent} event
*/
handlePaste(event) {
if (!this.props.checkComposerVisibility() && !this.state.isFocused) {
if (!this.props.checkComposerVisibility()) {
return;
}

if (['INPUT', 'TEXTAREA'].includes(event.target.nodeName)) {
return;
}

Expand Down
Loading

0 comments on commit 3469b98

Please sign in to comment.