Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unsupported browser warning in Xero on Android #41946

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading