Skip to content

Commit

Permalink
Merge main and resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mountiny committed Jun 20, 2024
2 parents 57c5655 + e1aec82 commit d785c1d
Show file tree
Hide file tree
Showing 20 changed files with 171 additions and 91 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,11 @@ jobs:
needs: validateActor
if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) && github.event_name == 'push' }}
steps:
- name: Get version
run: echo "VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4

- name: 'Deploy HybridApp'
run: gh workflow run --repo Expensify/Mobile-Deploy deploy.yml -f force_build=true -f build_version=${{ env.VERSION }}
run: gh workflow run --repo Expensify/Mobile-Deploy deploy.yml -f force_build=true -f build_version="$(npm run print-version --silent)"
env:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009000002
versionName "9.0.0-2"
versionCode 1009000003
versionName "9.0.0-3"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
1 change: 1 addition & 0 deletions docs/redirects.csv
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,4 @@ https://help.expensify.com/articles/expensify-classic/workspaces/reports/Report-
https://help.expensify.com/articles/expensify-classic/workspaces/reports/Scheduled-Submit,https://help.expensify.com/articles/expensify-classic/reports/Automatically-submit-employee-reports
https://help.expensify.com/articles/new-expensify/chat/Expensify-Chat-For-Admins,https://help.expensify.com/new-expensify/hubs/chat/
https://help.expensify.com/articles/new-expensify/bank-accounts-and-payments/Connect-a-Bank-Account.html,https://help.expensify.com/articles/new-expensify/expenses/Connect-a-Business-Bank-Account
https://help.expensify.com/articles/new-expensify/expenses/Manually-submit-reports-for-approval,https://help.expensify.com/new-expensify/hubs/expenses/
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>9.0.0.2</string>
<string>9.0.0.3</string>
<key>FullStory</key>
<dict>
<key>OrgId</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>9.0.0.2</string>
<string>9.0.0.3</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 @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.0.0</string>
<key>CFBundleVersion</key>
<string>9.0.0.2</string>
<string>9.0.0.3</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": "9.0.0-2",
"version": "9.0.0-3",
"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: 2 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ const CONST = {
SPOTNANA_TRAVEL: 'spotnanaTravel',
ACCOUNTING_ON_NEW_EXPENSIFY: 'accountingOnNewExpensify',
XERO_ON_NEW_EXPENSIFY: 'xeroOnNewExpensify',
NETSUITE_ON_NEW_EXPENSIFY: 'netsuiteOnNewExpensify',
REPORT_FIELDS_FEATURE: 'reportFieldsFeature',
},
BUTTON_STATES: {
Expand Down Expand Up @@ -1799,6 +1800,7 @@ const CONST = {
// Here we will add other connections names when we add support for them
QBO: 'quickbooksOnline',
XERO: 'xero',
NETSUITE: 'netsuite',
},
SYNC_STAGE_NAME: {
STARTING_IMPORT_QBO: 'startingImportQBO',
Expand Down
117 changes: 76 additions & 41 deletions src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,41 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
});
}, [directionCoordinates, currentPosition, mapPadding, waypoints]);

const centerCoordinate = currentPosition ? [currentPosition.longitude, currentPosition.latitude] : initialState?.location;
return !isOffline && !!accessToken && !!currentPosition ? (
const centerCoordinate = useMemo(() => (currentPosition ? [currentPosition.longitude, currentPosition.latitude] : initialState?.location), [currentPosition, initialState?.location]);

const waypointsBounds = useMemo(() => {
if (!waypoints) {
return undefined;
}
const {northEast, southWest} = utils.getBounds(
waypoints.map((waypoint) => waypoint.coordinate),
directionCoordinates,
);
return {ne: northEast, sw: southWest};
}, [waypoints, directionCoordinates]);

const defaultSettings: Mapbox.CameraStop | undefined = useMemo(() => {
if (interactive) {
if (!centerCoordinate) {
return undefined;
}
return {
zoomLevel: initialState?.zoom,
centerCoordinate,
};
}
if (!waypointsBounds) {
return undefined;
}
return {
bounds: waypointsBounds,
};
}, [interactive, centerCoordinate, waypointsBounds, initialState?.zoom]);

const initCenterCoordinate = useMemo(() => (interactive ? centerCoordinate : undefined), [interactive, centerCoordinate]);
const initBounds = useMemo(() => (interactive ? undefined : waypointsBounds), [interactive, waypointsBounds]);

return !isOffline && !!accessToken && !!defaultSettings ? (
<View style={[style, !interactive ? styles.pointerEventsNone : {}]}>
<Mapbox.MapView
style={{flex: 1}}
Expand All @@ -183,43 +216,43 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
>
<Mapbox.Camera
ref={cameraRef}
defaultSettings={{
centerCoordinate,
zoomLevel: initialState?.zoom,
}}
defaultSettings={defaultSettings}
// Include centerCoordinate here as well to address the issue of incorrect coordinates
// displayed after the first render when the app's storage is cleared.
centerCoordinate={centerCoordinate}
centerCoordinate={initCenterCoordinate}
bounds={initBounds}
/>
<Mapbox.ShapeSource
id="user-location"
shape={{
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [currentPosition?.longitude ?? 0, currentPosition?.latitude ?? 0],
{interactive && (
<Mapbox.ShapeSource
id="user-location"
shape={{
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [currentPosition?.longitude ?? 0, currentPosition?.latitude ?? 0],
},
properties: {},
},
properties: {},
},
],
}}
>
<Mapbox.CircleLayer
id="user-location-layer"
sourceID="user-location"
style={{
circleColor: colors.blue400,
circleRadius: 8,
],
}}
/>
</Mapbox.ShapeSource>
>
<Mapbox.CircleLayer
id="user-location-layer"
sourceID="user-location"
style={{
circleColor: colors.blue400,
circleRadius: 8,
}}
/>
</Mapbox.ShapeSource>
)}

{waypoints?.map(({coordinate, markerComponent, id}) => {
const MarkerComponent = markerComponent;
if (utils.areSameCoordinate([coordinate[0], coordinate[1]], [currentPosition?.longitude ?? 0, currentPosition?.latitude ?? 0])) {
if (utils.areSameCoordinate([coordinate[0], coordinate[1]], [currentPosition?.longitude ?? 0, currentPosition?.latitude ?? 0]) && interactive) {
return null;
}
return (
Expand All @@ -235,16 +268,18 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(

{directionCoordinates && <Direction coordinates={directionCoordinates} />}
</Mapbox.MapView>
<View style={[styles.pAbsolute, styles.p5, styles.t0, styles.r0, {zIndex: 1}]}>
<Button
onPress={centerMap}
iconFill={theme.icon}
iconStyles={styles.ml1}
medium
icon={Expensicons.Crosshair}
accessibilityLabel={translate('common.center')}
/>
</View>
{interactive && (
<View style={[styles.pAbsolute, styles.p5, styles.t0, styles.r0, {zIndex: 1}]}>
<Button
onPress={centerMap}
iconFill={theme.icon}
iconStyles={styles.ml1}
medium
icon={Expensicons.Crosshair}
accessibilityLabel={translate('common.center')}
/>
</View>
)}
</View>
) : (
<PendingMapView
Expand Down
69 changes: 45 additions & 24 deletions src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {useFocusEffect} from '@react-navigation/native';
import mapboxgl from 'mapbox-gl';
import 'mapbox-gl/dist/mapbox-gl.css';
import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react';
import type {MapRef} from 'react-map-gl';
import type {MapRef, ViewState} from 'react-map-gl';
import Map, {Marker} from 'react-map-gl';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -206,7 +206,28 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
});
}, [directionCoordinates, currentPosition, mapRef, waypoints, mapPadding]);

return !isOffline && !!accessToken && !!currentPosition ? (
const initialViewState: Partial<ViewState> | undefined = useMemo(() => {
if (!interactive) {
if (!waypoints) {
return undefined;
}
const {northEast, southWest} = utils.getBounds(
waypoints.map((waypoint) => waypoint.coordinate),
directionCoordinates,
);
return {
zoom: initialState.zoom,
bounds: [northEast, southWest],
};
}
return {
longitude: currentPosition?.longitude,
latitude: currentPosition?.latitude,
zoom: initialState.zoom,
};
}, [waypoints, directionCoordinates, interactive, currentPosition, initialState.zoom]);

return !isOffline && !!accessToken && !!initialViewState ? (
<View
style={style}
// eslint-disable-next-line react/jsx-props-no-spreading
Expand All @@ -217,25 +238,23 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
ref={setRef}
mapLib={mapboxgl}
mapboxAccessToken={accessToken}
initialViewState={{
longitude: currentPosition?.longitude,
latitude: currentPosition?.latitude,
zoom: initialState.zoom,
}}
initialViewState={initialViewState}
style={StyleUtils.getTextColorStyle(theme.mapAttributionText)}
mapStyle={styleURL}
interactive={interactive}
>
<Marker
key="Current-position"
longitude={currentPosition?.longitude ?? 0}
latitude={currentPosition?.latitude ?? 0}
>
<View style={styles.currentPositionDot} />
</Marker>
{interactive && (
<Marker
key="Current-position"
longitude={currentPosition?.longitude ?? 0}
latitude={currentPosition?.latitude ?? 0}
>
<View style={styles.currentPositionDot} />
</Marker>
)}
{waypoints?.map(({coordinate, markerComponent, id}) => {
const MarkerComponent = markerComponent;
if (utils.areSameCoordinate([coordinate[0], coordinate[1]], [currentPosition?.longitude ?? 0, currentPosition?.latitude ?? 0])) {
if (utils.areSameCoordinate([coordinate[0], coordinate[1]], [currentPosition?.longitude ?? 0, currentPosition?.latitude ?? 0]) && interactive) {
return null;
}
return (
Expand All @@ -250,15 +269,17 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
})}
{directionCoordinates && <Direction coordinates={directionCoordinates} />}
</Map>
<View style={[styles.pAbsolute, styles.p5, styles.t0, styles.r0, {zIndex: 1}]}>
<Button
onPress={centerMap}
iconFill={theme.icon}
medium
icon={Expensicons.Crosshair}
accessibilityLabel={translate('common.center')}
/>
</View>
{interactive && (
<View style={[styles.pAbsolute, styles.p5, styles.t0, styles.r0, {zIndex: 1}]}>
<Button
onPress={centerMap}
iconFill={theme.icon}
medium
icon={Expensicons.Crosshair}
accessibilityLabel={translate('common.center')}
/>
</View>
)}
</View>
) : (
<PendingMapView
Expand Down
12 changes: 10 additions & 2 deletions src/libs/Navigation/linkTo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
const extractedPolicyID = extractPolicyIDFromPath(`/${path}`);
const policyIDFromState = getPolicyIDFromState(rootState);
const policyID = extractedPolicyID ?? policyIDFromState ?? policyIDs;
const lastRoute = rootState?.routes?.at(-1);

const isNarrowLayout = getIsNarrowLayout();

const isFullScreenOnTop = rootState.routes?.at(-1)?.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR;
const isFullScreenOnTop = lastRoute?.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR;

// policyIDs is present only on SCREENS.SEARCH.CENTRAL_PANE and it's displayed in the url as a query param, on the other pages this parameter is called policyID and it's shown in the url in the format: /w/:policyID
if (policyID && !isFullScreenOnTop && !policyIDs) {
Expand All @@ -66,9 +67,11 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam

const action: StackNavigationAction = getActionFromState(stateFromPath, linkingConfig.config);

const isReportInRhpOpened = lastRoute?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR && lastRoute?.state?.routes?.some((route) => route?.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT);

// If action type is different than NAVIGATE we can't change it to the PUSH safely
if (action?.type === CONST.NAVIGATION.ACTION_TYPE.NAVIGATE) {
const topRouteName = rootState?.routes?.at(-1)?.name;
const topRouteName = lastRoute?.name;
const isTargetNavigatorOnTop = topRouteName === action.payload.name;

const isTargetScreenDifferentThanCurrent = !!(!topmostCentralPaneRoute || topmostCentralPaneRoute.name !== action.payload.params?.screen);
Expand Down Expand Up @@ -201,6 +204,11 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
}
}

// When we navigate from the ReportScreen opened in RHP, this page shouldn't be removed from the navigation state to allow users to go back to it.
if (isReportInRhpOpened && action) {
action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;
}

if (action !== undefined) {
root.dispatch(action);
} else {
Expand Down
Loading

0 comments on commit d785c1d

Please sign in to comment.