Skip to content

v0.0.19#48

Open
roncodes wants to merge 26 commits intomainfrom
dev-v0.0.19
Open

v0.0.19#48
roncodes wants to merge 26 commits intomainfrom
dev-v0.0.19

Conversation

@roncodes
Copy link
Member

@roncodes roncodes commented Dec 7, 2025

No description provided.

roncodes and others added 26 commits December 7, 2025 15:24
- Added POST_NOTIFICATIONS permission to AndroidManifest.xml
- Implemented runtime permission request in NotificationContext.tsx
- Fixes issue where notifications are blocked by default on Android 13+
- Added comprehensive documentation for the fix

This resolves the issue where the app shows 'All notifications from the app are blocked' after installation from Google Play Store on Android 13+ devices.
- Updated CartItemScreen.tsx with spacing fixes for Android
- Updated CartScreen.tsx with latest fixes
- Updated CreateAccountVerifyScreen.tsx
- Updated PhoneLoginVerifyScreen.tsx
- Updated ProductScreen.tsx with Android spacing improvements

Changes pulled from app/oli-max commits:
- 7c83c47: latest w/ fixes
- 87d7000: fix: corrected spacing on android platforms

Excluded: OrderHistoryScreen.tsx (as requested)
- Added Accept-Language header to use-storefront hook
- Added Accept-Language header to use-fleetbase hook
- Headers now include user's locale preference from LanguageContext
- Headers update dynamically when user changes language
- Uses standard HTTP Accept-Language header (RFC 7231/9110)

This enables the backend API to return localized content based on user's language preference.
- Added minimum checkout validation to use-qpay-checkout hook
- Added minimum checkout validation to use-stripe-checkout (native & web) hooks
- Created MinimumCheckoutNotice component for user feedback
- Integrated notice display in QPayCheckoutScreen and StripeCheckoutScreen
- Checkout button automatically disabled when cart below minimum
- Added English and Mongolian translations for minimum order messages
- Feature controlled by storefront options: required_checkout_min and required_checkout_min_amount

When enabled, users must reach the configured minimum cart subtotal before checkout is allowed.
A clear warning notice displays the current cart amount and required minimum.
The enabled() method automatically appends '_enabled' to keys, but the
required_checkout_min option doesn't follow this naming convention.

Changed from:
  enabled('required_checkout_min') // looks for required_checkout_min_enabled

To:
  get(info, 'options.required_checkout_min') === true // looks for required_checkout_min

This matches the existing pattern used for other options like pickup_enabled
and ensures the minimum checkout validation works correctly.
Fixes the 'addViewAt: failed to insert view into parent' error that occurs
after phone login on Android devices.

Issue: react-native-maps/react-native-maps#5781
Fixed in: react-native-maps v1.26.19

The error was caused by an index out of bounds exception when adding feature
views in react-native-maps. This has been resolved in version 1.26.19.
Merged from app/oli-max (commit f88549c).

Added optional chaining (?.) to prevent potential null/undefined errors
when accessing currentLocation.getAttribute('name').

This prevents crashes when currentLocation is not yet loaded or is null.
…ackend

- Refactor use-qpay-checkout hook to retrieve orders from backend instead of creating them
- Replace handlePayment with handleOrderCompletion (order already created by backend)
- Replace checkPaymentStatus with checkOrderStatus using new /checkouts/status endpoint
- Update WebSocket listener to handle order from event payload
- Add order recovery on component mount for better reliability
- Update LoadingOverlay text to reflect new flow
- Use adapter.get directly without SDK changes for faster implementation

This change eliminates the reliability gap where users could pay but not receive an order if the app closed before order creation completed.
- Add 'finalizingOrder' and 'checkingOrderStatus' keys to QPayCheckoutScreen
- Update both English and Mongolian translations
- Supports new loading messages in improved QPay checkout flow
Ensures onOrderComplete callback receives proper SDK Order instance.

ISSUE:
- checkOrderStatus gets order from API response (plain object)
- onOrderComplete callback expects SDK Order instance
- Type mismatch causes issues with Order methods

FIX:
- Import Order from @fleetbase/sdk
- Convert response to SDK instance before passing to callback
- Matches pattern in handleOrderCompletion

CODE:
import { Order } from '@fleetbase/sdk';

const orderInstance = order instanceof Order ? order : new Order(order);
handleOrderCompletion(orderInstance);

RESULT:
- onOrderComplete always receives SDK Order instance
- Order methods work correctly
- Consistent with other order handling code
Moved SDK Order instance conversion from caller to handleOrderCompletion itself.

PREVIOUS MISTAKE:
- Put conversion in checkOrderStatus only
- Other callers (WebSocket listener) would still break
- Not DRY - conversion would need to be in every caller

CORRECT DESIGN:
- Conversion INSIDE handleOrderCompletion
- ALL callers automatically benefit
- Single source of truth
- DRY principle

CALLERS THAT NOW WORK:
1. checkOrderStatus (status endpoint polling)
2. WebSocket listener (real-time callback events)

CODE:
const handleOrderCompletion = async (order) => {
    // Convert at entry point - all callers benefit
    const orderInstance = order instanceof Order ? order : new Order(order);

    // Use orderInstance everywhere
    addOrderToHistoryCache(customer.id, orderInstance);
    onOrderComplete(orderInstance);
};

RESULT:
- onOrderComplete always receives SDK Order instance
- Works from ANY caller
- Maintainable and clean
Prevents multiple simultaneous requests to checkout status endpoint.

ISSUE:
- Multiple status checks fired simultaneously (focus, app state, polling)
- Backend received 2+ requests at same time
- Could cause race conditions or duplicate order attempts
- Unnecessary load on backend

FIX:
- Added isCheckingStatus ref to track request in progress
- Check ref before making request
- Skip request if one already in progress
- Reset ref in finally block

CODE:
const isCheckingStatus = useRef(false);

const checkOrderStatus = async () => {
    if (isCheckingStatus.current) {
        console.log('Request already in progress, skipping');
        return;
    }

    isCheckingStatus.current = true;

    try {
        // Make request
    } finally {
        isCheckingStatus.current = false;
    }
};

BENEFITS:
- Only one status check at a time
- Prevents backend race conditions
- Reduces unnecessary API calls
- Better performance

RESULT:
- Sequential status checks only
- No simultaneous requests
- Cleaner logs
- More reliable checkout flow
- Create AddPhoneScreen for entering phone number
- Create VerifyPhoneScreen for SMS code verification
- Extend AuthContext with requestPhoneVerification() and verifyPhoneNumber()
- Add phone check prompt on ProfileScreen using useFocusEffect
- Register new screens in StoreNavigator (Authenticated group)
- Add English and Mongolian translations for new screens
- Prompt appears when user has no phone number on profile
- Uses native action sheet for user-friendly prompt
- Replace 'Cancel' with 'Later' button in ProfileScreen phone prompt
- Add 'addPhoneLater' translation key in English and Mongolian
- Users can now dismiss the prompt and add phone number later
- Improves UX by giving users control over when to add phone
…ring

- Replace ScreenWrapper with SafeAreaView in AddPhoneScreen
- Replace ScreenWrapper with SafeAreaView in VerifyPhoneScreen
- Fixes issue where back button was rendering behind tab navigation bar
- Uses theme.background.val for consistent background color
…overlap

- Import and use useSafeTabBarHeight hook in AddPhoneScreen
- Import and use useSafeTabBarHeight hook in VerifyPhoneScreen
- Apply tabBarHeight as bottom padding to prevent buttons from being hidden
- Ensures back/cancel buttons are visible above the tab bar
…mic returnTo navigation

- Add returnTo parameter support in AddPhoneScreen and VerifyPhoneScreen
- Update AccountScreen to use AddPhone flow instead of EditAccountProperty
- Update ProfileScreen to explicitly pass returnTo: 'Profile'
- Enables context-aware navigation: Account->AddPhone->Verify->Account or Profile->AddPhone->Verify->Profile
- Improves UX by returning users to the screen where they initiated the flow
- Remove 'cache: yarn' from setup-node step in all jobs
- Corepack must be enabled before any yarn caching
- Add 'Verify Yarn version' step to confirm correct version is active
- Fixes Yarn version mismatch error (1.22.22 vs 3.6.4)

This ensures Corepack activates Yarn 3.6.4 before Node.js tries to cache it.
- Change 'yarn install --immutable' to 'yarn install' in all jobs
- The --immutable flag was causing lockfile modification errors
- CI should allow lockfile updates when dependencies change
- Fixes: 'The lockfile would have been modified by this install, which is explicitly forbidden'
…onflicts

- Add 'enableScripts: false' to .yarnrc.yml
- Yarn 3 has native patch support and conflicts with patch-package
- This prevents the postinstall script from running and failing in CI
- TODO: Migrate to Yarn 3 native patches in the future
- Add YARN_ENABLE_INLINE_BUILDS=1 to global env
- This will display build errors inline instead of hiding them in /tmp files
- Will help us identify the actual cause of the workspace build failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant