Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…y-App into hur/feat/log-network-response
  • Loading branch information
hurali97 committed Jul 31, 2024
2 parents 3971945 + 05e044a commit 719f5c8
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 26 deletions.
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ GEM
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.110.0)
excon (0.111.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand All @@ -111,15 +111,15 @@ GEM
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http (1.0.2)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.221.1)
fastlane (2.222.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -167,7 +167,7 @@ GEM
ffi (1.17.0)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.0-x86_64-linux)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
Expand Down Expand Up @@ -220,7 +220,7 @@ GEM
mime-types (3.5.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.1003)
mini_magick (4.13.1)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.24.0)
molinillo (0.8.0)
Expand Down Expand Up @@ -294,7 +294,7 @@ PLATFORMS
DEPENDENCIES
activesupport (>= 6.1.7.3, < 7.1.0)
cocoapods (= 1.15.2)
fastlane (~> 2)
fastlane (~> 2, >= 2.222.0)
fastlane-plugin-aws_s3
xcpretty (~> 0)

Expand Down
1 change: 1 addition & 0 deletions assets/images/integrationicons/qbo-icon-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/integrationicons/xero-icon-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 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
Expand Up @@ -110,7 +110,7 @@
"date-fns-tz": "^2.0.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "2.0.60",
"expensify-common": "2.0.61",
"expo": "^50.0.3",
"expo-av": "~13.10.4",
"expo-image": "1.11.0",
Expand Down
17 changes: 10 additions & 7 deletions src/components/ButtonWithDropdownMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ function ButtonWithDropdownMenu<IValueType>({
const [isMenuVisible, setIsMenuVisible] = useState(false);
const [popoverAnchorPosition, setPopoverAnchorPosition] = useState<AnchorPosition | null>(null);
const {windowWidth, windowHeight} = useWindowDimensions();
const caretButton = useRef<View | null>(null);
const dropdownAnchor = useRef<View | null>(null);
const selectedItem = options[selectedItemIndex] || options[0];
const innerStyleDropButton = StyleUtils.getDropDownButtonHeight(buttonSize);
const isButtonSizeLarge = buttonSize === CONST.DROPDOWN_BUTTON_SIZE.LARGE;

useEffect(() => {
if (!caretButton.current) {
if (!dropdownAnchor.current) {
return;
}
if (!isMenuVisible) {
return;
}
if ('measureInWindow' in caretButton.current) {
caretButton.current.measureInWindow((x, y, w, h) => {
if ('measureInWindow' in dropdownAnchor.current) {
dropdownAnchor.current.measureInWindow((x, y, w, h) => {
setPopoverAnchorPosition({
horizontal: x + w,
vertical:
Expand All @@ -75,7 +75,10 @@ function ButtonWithDropdownMenu<IValueType>({
success={success}
pressOnEnter={pressOnEnter}
ref={(ref) => {
caretButton.current = ref;
if (isSplitButton) {
return;
}
dropdownAnchor.current = ref;
}}
onPress={(event) => (!isSplitButton ? setIsMenuVisible(!isMenuVisible) : onPress(event, selectedItem.value))}
text={customText ?? selectedItem.text}
Expand All @@ -94,7 +97,7 @@ function ButtonWithDropdownMenu<IValueType>({

{isSplitButton && (
<Button
ref={caretButton}
ref={dropdownAnchor}
success={success}
isDisabled={isDisabled}
style={[styles.pl0]}
Expand Down Expand Up @@ -145,7 +148,7 @@ function ButtonWithDropdownMenu<IValueType>({
onModalShow={onOptionsMenuShow}
onItemSelected={() => setIsMenuVisible(false)}
anchorPosition={popoverAnchorPosition}
anchorRef={caretButton}
anchorRef={dropdownAnchor}
withoutOverlay
anchorAlignment={anchorAlignment}
headerText={menuHeaderText}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ import ImageCropSquareMask from '@assets/images/image-crop-square-mask.svg';
import Inbox from '@assets/images/inbox.svg';
import Info from '@assets/images/info.svg';
import NetSuiteSquare from '@assets/images/integrationicons/netsuite-icon-square.svg';
import QBOCircle from '@assets/images/integrationicons/qbo-icon-circle.svg';
import QBOSquare from '@assets/images/integrationicons/qbo-icon-square.svg';
import SageIntacctSquare from '@assets/images/integrationicons/sage-intacct-icon-square.svg';
import XeroCircle from '@assets/images/integrationicons/xero-icon-circle.svg';
import XeroSquare from '@assets/images/integrationicons/xero-icon-square.svg';
import InvoiceGeneric from '@assets/images/invoice-generic.svg';
import Invoice from '@assets/images/invoice.svg';
Expand Down Expand Up @@ -375,6 +377,8 @@ export {
CheckCircle,
CheckmarkCircle,
NetSuiteSquare,
XeroCircle,
QBOCircle,
Filters,
CalendarSolid,
Filter,
Expand Down
18 changes: 13 additions & 5 deletions src/components/ReportActionItem/ExportWithDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,27 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Policy, Report} from '@src/types/onyx';
import type {ConnectionName} from '@src/types/onyx/Policy';
import type AnchorAlignment from '@src/types/utils/AnchorAlignment';

type ExportWithDropdownMenuProps = {
policy: OnyxEntry<Policy>;

report: OnyxEntry<Report>;

connectionName: ConnectionName;

dropdownAnchorAlignment?: AnchorAlignment;
};

function ExportWithDropdownMenu({policy, report, connectionName}: ExportWithDropdownMenuProps) {
function ExportWithDropdownMenu({
policy,
report,
connectionName,
dropdownAnchorAlignment = {
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
},
}: ExportWithDropdownMenuProps) {
const reportID = report?.reportID;
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down Expand Up @@ -91,10 +102,7 @@ function ExportWithDropdownMenu({policy, report, connectionName}: ExportWithDrop
success={!hasIntegrationAutoSync}
pressOnEnter
shouldAlwaysShowDropdownMenu
anchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
}}
anchorAlignment={dropdownAnchorAlignment}
onPress={(_, value) => {
if (isExported) {
setModalStatus(value);
Expand Down
4 changes: 4 additions & 0 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ function ReportPreview({
policy={policy}
report={iouReport}
connectionName={connectedIntegration}
dropdownAnchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
}}
/>
)}
{shouldShowSubmitButton && (
Expand Down
6 changes: 3 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {SvgProps} from 'react-native-svg';
import type {OriginalMessageModifiedExpense} from 'src/types/onyx/OriginalMessage';
import type {TupleToUnion, ValueOf} from 'type-fest';
import type {FileObject} from '@components/AttachmentModal';
import {FallbackAvatar, QBOSquare, XeroSquare} from '@components/Icon/Expensicons';
import {FallbackAvatar, QBOCircle, XeroCircle} from '@components/Icon/Expensicons';
import * as defaultGroupAvatars from '@components/Icon/GroupDefaultAvatars';
import * as defaultWorkspaceAvatars from '@components/Icon/WorkspaceDefaultAvatars';
import type {MoneyRequestAmountInputProps} from '@components/MoneyRequestAmountInput';
Expand Down Expand Up @@ -7356,10 +7356,10 @@ function getSourceIDFromReportAction(reportAction: OnyxEntry<ReportAction>): str

function getIntegrationIcon(connectionName?: ConnectionName) {
if (connectionName === CONST.POLICY.CONNECTIONS.NAME.XERO) {
return XeroSquare;
return XeroCircle;
}
if (connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO) {
return QBOSquare;
return QBOCircle;
}
return undefined;
}
Expand Down
14 changes: 14 additions & 0 deletions src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React, {useEffect} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import ScreenWrapper from '@components/ScreenWrapper';
import useActiveWorkspaceFromNavigationState from '@hooks/useActiveWorkspaceFromNavigationState';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {updateLastAccessedWorkspace} from '@libs/actions/Policy/Policy';
import * as Browser from '@libs/Browser';
import TopBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar';
import Navigation from '@libs/Navigation/Navigation';
import Performance from '@libs/Performance';
import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData';
import Timing from '@userActions/Timing';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

/**
* Function called when a pinned chat is selected.
Expand All @@ -23,12 +27,22 @@ function BaseSidebarScreen() {
const styles = useThemeStyles();
const activeWorkspaceID = useActiveWorkspaceFromNavigationState();
const {translate} = useLocalize();
const [activeWorkspace] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? -1}`);

useEffect(() => {
Performance.markStart(CONST.TIMING.SIDEBAR_LOADED);
Timing.start(CONST.TIMING.SIDEBAR_LOADED, true);
}, []);

useEffect(() => {
if (!!activeWorkspace || activeWorkspaceID === undefined) {
return;
}

Navigation.navigateWithSwitchPolicyID({policyID: undefined});
updateLastAccessedWorkspace(undefined);
}, [activeWorkspace, activeWorkspaceID]);

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand Down

0 comments on commit 719f5c8

Please sign in to comment.