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 offline workspace save #54634

Merged
merged 9 commits into from
Jan 1, 2025
6 changes: 1 addition & 5 deletions src/libs/DistanceRequestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,10 @@ function convertToDistanceInMeters(distance: number, unit: Unit): number {
* Returns custom unit rate ID for the distance transaction
*/
function getCustomUnitRateID(reportID?: string) {
let customUnitRateID: string = CONST.CUSTOM_UNITS.FAKE_P2P_ID;

if (!reportID) {
return customUnitRateID;
}
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`];
const policy = PolicyUtils.getPolicy(report?.policyID ?? parentReport?.policyID);
let customUnitRateID: string = CONST.CUSTOM_UNITS.FAKE_P2P_ID;

if (isEmptyObject(policy)) {
return customUnitRateID;
Expand Down
17 changes: 8 additions & 9 deletions src/utils/keyboard/index.website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ let isVisible = false;
const initialViewportHeight = window?.visualViewport?.height;

const handleResize = () => {
const currentHeight = window?.visualViewport?.height;
const viewportHeight = window?.visualViewport?.height;

if (!currentHeight || !initialViewportHeight) {
if (!viewportHeight || !initialViewportHeight) {
return;
}

if (currentHeight < initialViewportHeight) {
isVisible = true;
return;
}
// Determine if the keyboard is visible by checking if the height difference exceeds 152px.
// The 152px threshold accounts for UI elements such as smart banners on iOS Retina (max ~152px)
// and smaller overlays like offline indicators on Android. Height differences > 152px reliably indicate keyboard visibility.
const keyboardIsVisible = initialViewportHeight - viewportHeight > 152;
huult marked this conversation as resolved.
Show resolved Hide resolved
huult marked this conversation as resolved.
Show resolved Hide resolved

if (currentHeight === initialViewportHeight) {
isVisible = false;
}
// Update the visibility state
isVisible = !!keyboardIsVisible;
huult marked this conversation as resolved.
Show resolved Hide resolved
};

window.visualViewport?.addEventListener('resize', handleResize);
Expand Down
Loading