Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
Browse files Browse the repository at this point in the history
…x/33916-loading-indicator-bootsplash
  • Loading branch information
wildan-m committed Jan 24, 2024
2 parents f6217a3 + 6cfdd6f commit 4c40929
Show file tree
Hide file tree
Showing 59 changed files with 867 additions and 504 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001043101
versionName "1.4.31-1"
versionCode 1001043102
versionName "1.4.31-2"
}

flavorDimensions "default"
Expand Down
Binary file removed assets/animations/Update.lottie
Binary file not shown.
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.4.31.1</string>
<string>1.4.31.2</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.4.31.1</string>
<string>1.4.31.2</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleShortVersionString</key>
<string>1.4.31</string>
<key>CFBundleVersion</key>
<string>1.4.31.1</string>
<string>1.4.31.2</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
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.4.31-1",
"version": "1.4.31-2",
"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
4 changes: 0 additions & 4 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ const CONST = {
EXP_ERROR: 666,
MANY_WRITES_ERROR: 665,
UNABLE_TO_RETRY: 'unableToRetry',
UPDATE_REQUIRED: 426,
},
HTTP_STATUS: {
// When Cloudflare throttles
Expand Down Expand Up @@ -819,9 +818,6 @@ const CONST = {
GATEWAY_TIMEOUT: 'Gateway Timeout',
EXPENSIFY_SERVICE_INTERRUPTED: 'Expensify service interrupted',
DUPLICATE_RECORD: 'A record already exists with this ID',

// The "Upgrade" is intentional as the 426 HTTP code means "Upgrade Required" and sent by the API. We use the "Update" language everywhere else in the front end when this gets returned.
UPDATE_REQUIRED: 'Upgrade Required',
},
ERROR_TYPE: {
SOCKET: 'Expensify\\Auth\\Error\\Socket',
Expand Down
16 changes: 1 addition & 15 deletions src/Expensify.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import AppleAuthWrapper from './components/SignInButtons/AppleAuthWrapper';
import SplashScreenHider from './components/SplashScreenHider';
import UpdateAppModal from './components/UpdateAppModal';
import withLocalize, {withLocalizePropTypes} from './components/withLocalize';
import CONST from './CONST';
import * as EmojiPickerAction from './libs/actions/EmojiPickerAction';
import * as Report from './libs/actions/Report';
import * as User from './libs/actions/User';
Expand Down Expand Up @@ -80,9 +79,6 @@ const propTypes = {
/** Whether the app is waiting for the server's response to determine if a room is public */
isCheckingPublicRoom: PropTypes.bool,

/** True when the user must update to the latest minimum version of the app */
updateRequired: PropTypes.bool,

/** Whether we should display the notification alerting the user that focus mode has been auto-enabled */
focusModeNotification: PropTypes.bool,

Expand All @@ -99,7 +95,6 @@ const defaultProps = {
isBootSplashAutoHide: true,
screenShareRequest: null,
isCheckingPublicRoom: true,
updateRequired: false,
focusModeNotification: false,
};

Expand Down Expand Up @@ -213,10 +208,6 @@ function Expensify(props) {
return null;
}

if (props.updateRequired) {
throw new Error(CONST.ERROR.UPDATE_REQUIRED);
}

return (
<DeeplinkWrapper
isAuthenticated={isAuthenticated}
Expand All @@ -228,8 +219,7 @@ function Expensify(props) {
<PopoverReportActionContextMenu ref={ReportActionContextMenu.contextMenuRef} />
<EmojiPicker ref={EmojiPickerAction.emojiPickerRef} />
{/* We include the modal for showing a new update at the top level so the option is always present. */}
{/* If the update is required we won't show this option since a full screen update view will be displayed instead. */}
{props.updateAvailable && !props.updateRequired ? <UpdateAppModal /> : null}
{props.updateAvailable ? <UpdateAppModal /> : null}
{props.screenShareRequest ? (
<ConfirmModal
title={props.translate('guides.screenShare')}
Expand Down Expand Up @@ -285,10 +275,6 @@ export default compose(
screenShareRequest: {
key: ONYXKEYS.SCREEN_SHARE_REQUEST,
},
updateRequired: {
key: ONYXKEYS.UPDATE_REQUIRED,
initWithStoredValues: false,
},
focusModeNotification: {
key: ONYXKEYS.FOCUS_MODE_NOTIFICATION,
initWithStoredValues: false,
Expand Down
4 changes: 0 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ const ONYXKEYS = {
// Max width supported for HTML <canvas> element
MAX_CANVAS_WIDTH: 'maxCanvasWidth',

/** Indicates whether an forced upgrade is required */
UPDATE_REQUIRED: 'updateRequired',

/** Collection Keys */
COLLECTION: {
DOWNLOAD: 'download_',
Expand Down Expand Up @@ -449,7 +446,6 @@ type OnyxValues = {
[ONYXKEYS.MAX_CANVAS_AREA]: number;
[ONYXKEYS.MAX_CANVAS_HEIGHT]: number;
[ONYXKEYS.MAX_CANVAS_WIDTH]: number;
[ONYXKEYS.UPDATE_REQUIRED]: boolean;

// Collections
[ONYXKEYS.COLLECTION.DOWNLOAD]: OnyxTypes.Download;
Expand Down
8 changes: 8 additions & 0 deletions src/components/Composer/index.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import type {TextInput} from 'react-native';
import {StyleSheet} from 'react-native';
import RNTextInput from '@components/RNTextInput';
import useResetComposerFocus from '@hooks/useResetComposerFocus';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ComposerUtils from '@libs/ComposerUtils';
Expand All @@ -28,6 +29,7 @@ function Composer(
ref: ForwardedRef<TextInput>,
) {
const textInput = useRef<TextInput | null>(null);
const {isFocused, shouldResetFocus} = useResetComposerFocus(textInput);

const styles = useThemeStyles();
const theme = useTheme();
Expand Down Expand Up @@ -89,6 +91,12 @@ function Composer(
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...props}
readOnly={isDisabled}
onBlur={(e) => {
if (!isFocused) {
shouldResetFocus.current = true; // detect the input is blurred when the page is hidden
}
props?.onBlur?.(e);
}}
/>
);
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/Composer/index.ios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import type {TextInput} from 'react-native';
import {StyleSheet} from 'react-native';
import RNTextInput from '@components/RNTextInput';
import useResetComposerFocus from '@hooks/useResetComposerFocus';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ComposerUtils from '@libs/ComposerUtils';
Expand All @@ -28,7 +29,7 @@ function Composer(
ref: ForwardedRef<TextInput>,
) {
const textInput = useRef<TextInput | null>(null);

const {isFocused, shouldResetFocus} = useResetComposerFocus(textInput);
const styles = useThemeStyles();
const theme = useTheme();

Expand Down Expand Up @@ -84,6 +85,12 @@ function Composer(
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...props}
readOnly={isDisabled}
onBlur={(e) => {
if (!isFocused) {
shouldResetFocus.current = true; // detect the input is blurred when the page is hidden
}
props?.onBlur?.(e);
}}
/>
);
}
Expand Down
14 changes: 4 additions & 10 deletions src/components/ErrorBoundary/BaseErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, {useState} from 'react';
import React from 'react';
import {ErrorBoundary} from 'react-error-boundary';
import BootSplash from '@libs/BootSplash';
import GenericErrorPage from '@pages/ErrorPage/GenericErrorPage';
import UpdateRequiredView from '@pages/ErrorPage/UpdateRequiredView';
import CONST from '@src/CONST';
import type {BaseErrorBoundaryProps, LogError} from './types';

/**
Expand All @@ -13,19 +11,15 @@ import type {BaseErrorBoundaryProps, LogError} from './types';
*/

function BaseErrorBoundary({logError = () => {}, errorMessage, children}: BaseErrorBoundaryProps) {
const [errorContent, setErrorContent] = useState('');
const catchError = (errorObject: Error, errorInfo: React.ErrorInfo) => {
logError(errorMessage, errorObject, JSON.stringify(errorInfo));
const catchError = (error: Error, errorInfo: React.ErrorInfo) => {
logError(errorMessage, error, JSON.stringify(errorInfo));
// We hide the splash screen since the error might happened during app init
BootSplash.hide();
setErrorContent(errorObject.message);
};

const updateRequired = errorContent === CONST.ERROR.UPDATE_REQUIRED;

return (
<ErrorBoundary
fallback={updateRequired ? <UpdateRequiredView /> : <GenericErrorPage />}
fallback={<GenericErrorPage />}
onError={catchError}
>
{children}
Expand Down
21 changes: 10 additions & 11 deletions src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,17 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
return null;
}

const isInFocusMode = viewMode === CONST.OPTION_MODE.COMPACT;
const textStyle = isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText;
const textUnreadStyle = optionItem?.isUnread ? [textStyle, styles.sidebarLinkTextBold] : [textStyle];
const textUnreadStyle = optionItem?.isUnread && optionItem.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE ? [textStyle, styles.sidebarLinkTextBold] : [textStyle];
const displayNameStyle = [styles.optionDisplayName, styles.optionDisplayNameCompact, styles.pre, textUnreadStyle, style];
const alternateTextStyle =
viewMode === CONST.OPTION_MODE.COMPACT
? [textStyle, styles.optionAlternateText, styles.pre, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2, style]
: [textStyle, styles.optionAlternateText, styles.pre, styles.textLabelSupporting, style];
const alternateTextStyle = isInFocusMode
? [textStyle, styles.optionAlternateText, styles.pre, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2, style]
: [textStyle, styles.optionAlternateText, styles.pre, styles.textLabelSupporting, style];

const contentContainerStyles =
viewMode === CONST.OPTION_MODE.COMPACT ? [styles.flex1, styles.flexRow, styles.overflowHidden, StyleUtils.getCompactContentContainerStyles()] : [styles.flex1];
const contentContainerStyles = isInFocusMode ? [styles.flex1, styles.flexRow, styles.overflowHidden, StyleUtils.getCompactContentContainerStyles()] : [styles.flex1];
const sidebarInnerRowStyle = StyleSheet.flatten<ViewStyle>(
viewMode === CONST.OPTION_MODE.COMPACT
isInFocusMode
? [styles.chatLinkRowPressable, styles.flexGrow1, styles.optionItemAvatarNameWrapper, styles.optionRowCompact, styles.justifyContentCenter]
: [styles.chatLinkRowPressable, styles.flexGrow1, styles.optionItemAvatarNameWrapper, styles.optionRow, styles.justifyContentCenter],
);
Expand Down Expand Up @@ -175,13 +174,13 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
backgroundColor={hovered && !isFocused ? hoveredBackgroundColor : subscriptAvatarBorderColor}
mainAvatar={optionItem.icons?.[0]}
secondaryAvatar={optionItem.icons?.[1]}
size={viewMode === CONST.OPTION_MODE.COMPACT ? CONST.AVATAR_SIZE.SMALL : CONST.AVATAR_SIZE.DEFAULT}
size={isInFocusMode ? CONST.AVATAR_SIZE.SMALL : CONST.AVATAR_SIZE.DEFAULT}
/>
) : (
<MultipleAvatars
icons={optionItem.icons ?? []}
isFocusMode={viewMode === CONST.OPTION_MODE.COMPACT}
size={viewMode === CONST.OPTION_MODE.COMPACT ? CONST.AVATAR_SIZE.SMALL : CONST.AVATAR_SIZE.DEFAULT}
isFocusMode={isInFocusMode}
size={isInFocusMode ? CONST.AVATAR_SIZE.SMALL : CONST.AVATAR_SIZE.DEFAULT}
secondAvatarStyle={[
StyleUtils.getBackgroundAndBorderStyle(theme.sidebar),
isFocused ? StyleUtils.getBackgroundAndBorderStyle(focusedBackgroundColor) : undefined,
Expand Down
6 changes: 0 additions & 6 deletions src/components/LottieAnimations/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import variables from '@styles/variables';
import type DotLottieAnimation from './types';

const DotLottieAnimations: Record<string, DotLottieAnimation> = {
Expand Down Expand Up @@ -52,11 +51,6 @@ const DotLottieAnimations: Record<string, DotLottieAnimation> = {
w: 853,
h: 480,
},
Update: {
file: require('@assets/animations/Update.lottie'),
w: variables.updateAnimationW,
h: variables.updateAnimationH,
},
Coin: {
file: require('@assets/animations/Coin.lottie'),
w: 375,
Expand Down
5 changes: 5 additions & 0 deletions src/components/MagicCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ const propTypes = {

/** Last pressed digit on BigDigitPad */
lastPressedDigit: PropTypes.string,

/** TestID for test */
testID: PropTypes.string,
};

const defaultProps = {
Expand All @@ -77,6 +80,7 @@ const defaultProps = {
maxLength: CONST.MAGIC_CODE_LENGTH,
isDisableKeyboard: false,
lastPressedDigit: '',
testID: '',
};

/**
Expand Down Expand Up @@ -394,6 +398,7 @@ function MagicCodeInput(props) {
role={CONST.ACCESSIBILITY_ROLE.TEXT}
style={[styles.inputTransparent]}
textInputContainerStyles={[styles.borderNone]}
testID={props.testID}
/>
</View>
</GestureDetector>
Expand Down
Loading

0 comments on commit 4c40929

Please sign in to comment.