Conversation
WalkthroughThis PR makes multiple focused changes: strengthens mock typings and adds a prefetch in expo-image mocks; adjusts MMKV clear iteration; removes iOS associatedDomains and simplifies appStoreUrl in app.config; adds itunesItemId to config and uses it in AppUpdateNeeded and StoreUpdateAvailableBanner; exposes handleSetIsPayingUser in SubscriptionContext and updates SubscriptionContextProvider to gate paying-user checks by authenticated user, call Purchase.setUser(user), and expose an imperative setter; adds Purchase.syncPurchases(); converts DateFormats enum to a const object with a derived DateFormat type and updates related hooks; updates several Sentry-related type signatures; narrows ProductTrackingStorage visibility; and modifies useAppState effect dependencies. Sequence Diagram(s)sequenceDiagram
participant App
participant SubscriptionContextProvider
participant AuthContext
participant Purchase
App->>SubscriptionContextProvider: Mount / consume context
SubscriptionContextProvider->>AuthContext: Read current user
alt user exists
AuthContext-->>SubscriptionContextProvider: user
SubscriptionContextProvider->>Purchase: setUser(user)
Purchase-->>SubscriptionContextProvider: ack
SubscriptionContextProvider->>Purchase: isPayingUser()
Purchase-->>SubscriptionContextProvider: paying status
SubscriptionContextProvider-->>App: Provide isPayingUser + handleSetIsPayingUser
else no user
AuthContext-->>SubscriptionContextProvider: no user
SubscriptionContextProvider-->>App: Provide isPayingUser = false + handleSetIsPayingUser
end
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
__mocks__/react-native-mmkv.ts (1)
1-35:⚠️ Potential issue | 🟡 MinorFix Prettier formatting issues flagged by CI.
The pipeline reports Prettier found code style issues in this file. Run
yarn prettier --writeto auto-fix.
🤖 Fix all issues with AI agents
In `@__mocks__/expo-image.tsx`:
- Around line 1-6: The mock currently types the Image component props as
ViewProps, which rejects real expo-image props like source or contentFit; update
the mock to import ImageProps from "expo-image" and type the Image component
signature as (props: ImageProps) => JSX.Element, and when spreading props into
the View (inside the Image function) cast props to unknown as ViewProps to avoid
prop type mismatch while preserving the real Image API surface; keep the
component implementation as a simple View wrapper named Image so tests using
expo-image props type-check.
In `@src/infra/monitoring/errorMonitoring.ts`:
- Around line 107-109: The file has Prettier formatting issues around the
message method (message(message: string, context?: Parameters<typeof
Sentry.captureMessage>[1])) in errorMonitoring.ts; run your formatter or apply
Prettier fixes: run `yarn prettier --write
src/infra/monitoring/errorMonitoring.ts` or format the file in your editor so
the Sentry.captureMessage call and method signature adhere to project Prettier
rules, then re-run the pipeline and commit the formatted file.
In `@src/infra/monitoring/performanceMonitoring.ts`:
- Around line 11-13: Prettier is flagging formatting in the
startIndependentTransaction method where Sentry.startInactiveSpan is called; fix
it by running your project's formatter (yarn prettier --write) on the file
containing the startIndependentTransaction method or reformat that function so
it adheres to Prettier rules (ensure the call to Sentry.startInactiveSpan in
startIndependentTransaction is correctly spaced/indented and the file is saved
after formatting).
🧹 Nitpick comments (3)
src/shared/components/appUpdateNeeded/AppUpdateNeeded.tsx (1)
39-52: Optional: Consider extracting the store URL opening logic to a shared utility.This
onPresshandler is nearly identical to the one inStoreUpdateAvailableBanner.tsx. A shared utility function (e.g.,openAppStore()) could reduce duplication.💡 Example shared utility
// In a shared utils file, e.g., src/shared/utils/linking.ts import { Linking } from 'react-native'; import { IS_IOS, config } from '$domain/constants'; import { Logger } from '$infra/logger'; export const openAppStore = async () => { try { await Linking.openURL( IS_IOS ? `https://apps.apple.com/app/${config.itunesItemId}` : `market://details?id=${config.bundleId}&showAllReviews=true`, ); } catch (error) { Logger.error({ error, message: 'Failed to open app store to update the app', }); } };src/domain/contexts/subscriptionContext/SubscriptionContextProvider.tsx (1)
39-39: Variable shadowing: rename innerisPayingUserto avoid confusion.The local variable
isPayingUseron line 39 shadows the state variable declared on line 21. This can lead to confusion and potential bugs during maintenance.♻️ Proposed fix
- const isPayingUser = await Purchase.isPayingUser(); + const payingUserStatus = await Purchase.isPayingUser(); - setIsPayingUser(isPayingUser); + setIsPayingUser(payingUserStatus);src/infra/purchase/purchase.ts (1)
74-77: Consider adding error handling for consistency withmakePurchase().The
syncPurchases()method lacks error handling, whilemakePurchase()includes try/catch withErrorMonitoring.exception(). Although this is consistent with therestorePurchases()pattern, the coding guidelines require error handling for all async/await operations.💡 Optional: Add error handling for monitoring
async syncPurchases() { - await RevenueCat.syncPurchases(); + try { + await RevenueCat.syncPurchases(); + } catch (error) { + ErrorMonitoring.exception(error); + } }
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/infra/monitoring/performanceMonitoring.ts`:
- Around line 4-9: The startTransaction<T> method currently calls
Sentry.startSpan(context, callback) but doesn't return its result, so change
startTransaction to return the callback's result by returning the value from
Sentry.startSpan(context, callback) (preserve the generic <T> and the existing
parameters and callback signature) so callers receive the expected T instead of
undefined.
- Around line 11-15: The function startIndependentTransaction currently calls
Sentry.startInactiveSpan(context) but does not return the Span, preventing
callers from ending it; modify startIndependentTransaction to return the result
of Sentry.startInactiveSpan(context) so callers receive the Span instance and
can call .end() when done (refer to the startIndependentTransaction function and
Sentry.startInactiveSpan call).
Summary by CodeRabbit
New Features
Bug Fixes
Chores