Skip to content

Commit

Permalink
Merge branch 'main' into ts-migration/Accessibility-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
kubabutkiewicz committed Sep 21, 2023
2 parents 78f29aa + e52f21a commit b481689
Show file tree
Hide file tree
Showing 74 changed files with 1,605 additions and 508 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 1001037206
versionName "1.3.72-6"
versionCode 1001037209
versionName "1.3.72-9"
}

flavorDimensions "default"
Expand Down
19 changes: 13 additions & 6 deletions docs/_sass/_search-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,25 @@ $color-gray-label: $color-gray-label;
#sidebar-search {
background-color: $color-appBG;
width: 375px;
height: 100vh;
position: fixed;
display: block;
display: flex;
flex-direction: column;
bottom: 0;
top: 0;
right: 0;
z-index: 2;
}

#sidebar-search > div:last-child {
flex-grow: 1;
overflow-y: auto;
-ms-overflow-style: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}

@media only screen and (max-width: $breakpoint-tablet) {
#sidebar-search {
width: 100%;
Expand Down Expand Up @@ -156,10 +167,6 @@ label.search-label {
background-color: $color-appBG;
border: $color-appBG;
font-family: "ExpensifyNeue", "Helvetica Neue", "Helvetica", Arial, sans-serif !important;
max-height: 80vh;
overflow-y: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
}

/* Hide the scrollbar */
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.72.6</string>
<string>1.3.72.9</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.72.6</string>
<string>1.3.72.9</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.72-6",
"version": "1.3.72-9",
"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
133 changes: 133 additions & 0 deletions patches/react-native-image-picker+5.1.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
diff --git a/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerModuleImpl.java b/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerModuleImpl.java
index 89b69a8..d86ab1e 100644
--- a/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerModuleImpl.java
+++ b/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerModuleImpl.java
@@ -29,6 +29,120 @@ public class ImagePickerModuleImpl implements ActivityEventListener {
public static final int REQUEST_LAUNCH_VIDEO_CAPTURE = 13002;
public static final int REQUEST_LAUNCH_LIBRARY = 13003;

+ // Prevent svg images from being selected as they are not supported (Image component does not support them)
+ // and also because iOS does not allow them to be selected (for consistency).
+ // Since, we can't exclude a mime type, we instead allow all image mime types except 'image/svg+xml'.
+ // Image mime types are generated by merging the Android image mime type support and the IANA media-types lists.
+ // https://android.googlesource.com/platform/external/mime-support/+/main/mime.types#636
+ // https://www.iana.org/assignments/media-types/media-types.xhtml#image
+ private static final String[] ALLOWED_IMAGE_MIME_TYPES = {
+ "image/aces",
+ "image/apng",
+ "image/avci",
+ "image/avcs",
+ "image/avif",
+ "image/bmp",
+ "image/cgm",
+ "image/dicom-rle",
+ "image/dpx",
+ "image/emf",
+ "image/example",
+ "image/fits",
+ "image/g3fax",
+ "image/gif",
+ "image/heic-sequence",
+ "image/heic",
+ "image/heif-sequence",
+ "image/heif",
+ "image/hej2k",
+ "image/hsj2",
+ "image/ief",
+ "image/j2c",
+ "image/jls",
+ "image/jp2",
+ "image/jpeg",
+ "image/jph",
+ "image/jphc",
+ "image/jpm",
+ "image/jpx",
+ "image/jxr",
+ "image/jxrA",
+ "image/jxrS",
+ "image/jxs",
+ "image/jxsc",
+ "image/jxsi",
+ "image/jxss",
+ "image/ktx",
+ "image/ktx2",
+ "image/naplps",
+ "image/pcx",
+ "image/png",
+ "image/prs.btif",
+ "image/prs.pti",
+ "image/pwg-raster",
+ // "image/svg+xml",
+ "image/t38",
+ "image/tiff-fx",
+ "image/tiff",
+ "image/vnd.adobe.photoshop",
+ "image/vnd.airzip.accelerator.azv",
+ "image/vnd.cns.inf2",
+ "image/vnd.dece.graphic",
+ "image/vnd.djvu",
+ "image/vnd.dvb.subtitle",
+ "image/vnd.dwg",
+ "image/vnd.dxf",
+ "image/vnd.fastbidsheet",
+ "image/vnd.fpx",
+ "image/vnd.fst",
+ "image/vnd.fujixerox.edmics-mmr",
+ "image/vnd.fujixerox.edmics-rlc",
+ "image/vnd.globalgraphics.pgb",
+ "image/vnd.microsoft.icon",
+ "image/vnd.mix",
+ "image/vnd.mozilla.apng",
+ "image/vnd.ms-modi",
+ "image/vnd.net-fpx",
+ "image/vnd.pco.b16",
+ "image/vnd.radiance",
+ "image/vnd.sealed.png",
+ "image/vnd.sealedmedia.softseal.gif",
+ "image/vnd.sealedmedia.softseal.jpg",
+ "image/vnd.svf",
+ "image/vnd.tencent.tap",
+ "image/vnd.valve.source.texture",
+ "image/vnd.wap.wbmp",
+ "image/vnd.xiff",
+ "image/vnd.zbrush.pcx",
+ "image/webp",
+ "image/wmf",
+ "image/x-canon-cr2",
+ "image/x-canon-crw",
+ "image/x-cmu-raster",
+ "image/x-coreldraw",
+ "image/x-coreldrawpattern",
+ "image/x-coreldrawtemplate",
+ "image/x-corelphotopaint",
+ "image/x-emf",
+ "image/x-epson-erf",
+ "image/x-icon",
+ "image/x-jg",
+ "image/x-jng",
+ "image/x-ms-bmp",
+ "image/x-nikon-nef",
+ "image/x-olympus-orf",
+ "image/x-photoshop",
+ "image/x-portable-anymap",
+ "image/x-portable-bitmap",
+ "image/x-portable-graymap",
+ "image/x-portable-pixmap",
+ "image/x-rgb",
+ "image/x-wmf",
+ "image/x-xbitmap",
+ "image/x-xpixmap",
+ "image/x-xwindowdump",
+ };
+
private Uri fileUri;

private ReactApplicationContext reactContext;
@@ -148,6 +262,7 @@ public class ImagePickerModuleImpl implements ActivityEventListener {

if (isPhoto) {
libraryIntent.setType("image/*");
+ libraryIntent.putExtra(Intent.EXTRA_MIME_TYPES, this.ALLOWED_IMAGE_MIME_TYPES);
} else if (isVideo) {
libraryIntent.setType("video/*");
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
5 changes: 3 additions & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@ const CONST = {
},

AVATAR_SIZE: {
XLARGE: 'xlarge',
LARGE: 'large',
MEDIUM: 'medium',
DEFAULT: 'default',
Expand Down Expand Up @@ -1311,9 +1312,9 @@ const CONST = {
},

// Auth limit is 60k for the column but we store edits and other metadata along the html so let's use a lower limit to accommodate for it.
MAX_COMMENT_LENGTH: 15000,
MAX_COMMENT_LENGTH: 10000,

// Furthermore, applying markup is very resource-consuming, so let's set a slightly lower limit for that
// Use the same value as MAX_COMMENT_LENGTH to ensure the entire comment is parsed. Note that applying markup is very resource-consuming.
MAX_MARKUP_LENGTH: 10000,

MAX_THREAD_REPLIES_PREVIEW: 99,
Expand Down
6 changes: 6 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ export default {
VALIDATE_LOGIN: 'ValidateLogin',
CONCIERGE: 'Concierge',
SETTINGS: {
ROOT: 'Settings_Root',
PREFERENCES: 'Settings_Preferences',
WORKSPACES: 'Settings_Workspaces',
SECURITY: 'Settings_Security',
STATUS: 'Settings_Status',
},
SAVE_THE_WORLD: {
ROOT: 'SaveTheWorld_Root',
},
SIGN_IN_WITH_APPLE_DESKTOP: 'AppleSignInDesktop',
SIGN_IN_WITH_GOOGLE_DESKTOP: 'GoogleSignInDesktop',
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddressSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const propTypes = {
onBlur: PropTypes.func,

/** Error text to display */
errorText: PropTypes.string,
errorText: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))]),

/** Hint text to display */
hint: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import PropTypes from 'prop-types';
import {View, PixelRatio} from 'react-native';
import useWindowDimensions from '../../../hooks/useWindowDimensions';
import styles from '../../../styles/styles';

const propTypes = {
/** Cell Container styles */
style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
};

const defaultProps = {
style: [],
};

function AttachmentCarouselCellRenderer(props) {
const {windowWidth, isSmallScreenWidth} = useWindowDimensions();
const modalStyles = styles.centeredModalStyles(isSmallScreenWidth, true);
const style = [props.style, styles.h100, {width: PixelRatio.roundToNearestPixel(windowWidth - (modalStyles.marginHorizontal + modalStyles.borderWidth) * 2)}];

return (
<View
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
style={style}
/>
);
}

AttachmentCarouselCellRenderer.propTypes = propTypes;
AttachmentCarouselCellRenderer.defaultProps = defaultProps;
AttachmentCarouselCellRenderer.displayName = 'AttachmentCarouselCellRenderer';

export default React.memo(AttachmentCarouselCellRenderer);
28 changes: 2 additions & 26 deletions src/components/Attachments/AttachmentCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {View, FlatList, PixelRatio, Keyboard} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import styles from '../../../styles/styles';
import AttachmentCarouselCellRenderer from './AttachmentCarouselCellRenderer';
import CarouselActions from './CarouselActions';
import withWindowDimensions from '../../withWindowDimensions';
import CarouselButtons from './CarouselButtons';
Expand All @@ -12,7 +13,6 @@ import ONYXKEYS from '../../../ONYXKEYS';
import withLocalize from '../../withLocalize';
import compose from '../../../libs/compose';
import useCarouselArrows from './useCarouselArrows';
import useWindowDimensions from '../../../hooks/useWindowDimensions';
import CarouselItem from './CarouselItem';
import Navigation from '../../../libs/Navigation/Navigation';
import BlockingView from '../../BlockingViews/BlockingView';
Expand All @@ -30,7 +30,6 @@ const viewabilityConfig = {
function AttachmentCarousel({report, reportActions, source, onNavigate, setDownloadButtonVisibility, translate}) {
const scrollRef = useRef(null);

const {windowWidth, isSmallScreenWidth} = useWindowDimensions();
const canUseTouchScreen = DeviceCapabilities.canUseTouchScreen();

const [containerWidth, setContainerWidth] = useState(0);
Expand Down Expand Up @@ -132,29 +131,6 @@ function AttachmentCarousel({report, reportActions, source, onNavigate, setDownl
[containerWidth],
);

/**
* Defines how a container for a single attachment should be rendered
* @param {Object} cellRendererProps
* @returns {JSX.Element}
*/
const renderCell = useCallback(
(cellProps) => {
// Use window width instead of layout width to address the issue in https://github.com/Expensify/App/issues/17760
// considering horizontal margin and border width in centered modal
const modalStyles = styles.centeredModalStyles(isSmallScreenWidth, true);
const style = [cellProps.style, styles.h100, {width: PixelRatio.roundToNearestPixel(windowWidth - (modalStyles.marginHorizontal + modalStyles.borderWidth) * 2)}];

return (
<View
// eslint-disable-next-line react/jsx-props-no-spreading
{...cellProps}
style={style}
/>
);
},
[isSmallScreenWidth, windowWidth],
);

/**
* Defines how a single attachment should be rendered
* @param {Object} item
Expand Down Expand Up @@ -226,7 +202,7 @@ function AttachmentCarousel({report, reportActions, source, onNavigate, setDownl
windowSize={5}
maxToRenderPerBatch={3}
data={attachments}
CellRendererComponent={renderCell}
CellRendererComponent={AttachmentCarouselCellRenderer}
renderItem={renderItem}
getItemLayout={getItemLayout}
keyExtractor={(item) => item.source}
Expand Down
Loading

0 comments on commit b481689

Please sign in to comment.