Skip to content

Commit

Permalink
Merge pull request Expensify#41946 from gijoe0295/gijoe/41512
Browse files Browse the repository at this point in the history
fix: unsupported browser warning in Xero on Android
  • Loading branch information
lakchote authored May 13, 2024
2 parents 2e6e8ca + 1c8593e commit f01fb70
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/ConnectToXeroButton/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {removePolicyConnection} from '@libs/actions/connections';
import {getXeroSetupLink} from '@libs/actions/connections/ConnectToXero';
import getUAForWebView from '@libs/getUAForWebView';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Session} from '@src/types/onyx';
Expand Down Expand Up @@ -82,6 +83,7 @@ function ConnectToXeroButton({policyID, session, shouldDisconnectIntegrationBefo
Cookie: `authToken=${authToken}`,
},
}}
userAgent={getUAForWebView()}
incognito
startInLoadingState
renderLoading={renderLoading}
Expand Down
8 changes: 8 additions & 0 deletions src/libs/getUAForWebView/index.android.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type GetUAForWebView from './types';

/**
* Android WebView is built on top of Chromium which is not supported by Xero causing the site to show warning.
*/
const getUAForWebView: GetUAForWebView = () => 'Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.159 Mobile Safari/537.36';

export default getUAForWebView;
5 changes: 5 additions & 0 deletions src/libs/getUAForWebView/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type GetUAForWebView from './types';

const getUAForWebView: GetUAForWebView = () => undefined;

export default getUAForWebView;
3 changes: 3 additions & 0 deletions src/libs/getUAForWebView/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type GetUAForWebView = () => string | undefined;

export default GetUAForWebView;

0 comments on commit f01fb70

Please sign in to comment.