Skip to content

feat: misc code updates#457

Merged
tsyirvo merged 3 commits intodevelopfrom
feat/miscCodeUpdates
Feb 15, 2026
Merged

feat: misc code updates#457
tsyirvo merged 3 commits intodevelopfrom
feat/miscCodeUpdates

Conversation

@tsyirvo
Copy link
Owner

@tsyirvo tsyirvo commented Feb 14, 2026

Summary by CodeRabbit

  • New Features

    • Manual in-app purchase synchronization.
    • Subscription status now respects signed-in user and exposes an imperatively callable setter.
  • Bug Fixes

    • App update / store banners now use the configured App Store ID for iOS.
    • Updated app-state listener behavior for foreground/background detection.
  • Chores

    • Type, config, monitoring, date-format, mock and logging improvements; Storybook typing cleaned up; minor storage visibility change.

@tsyirvo tsyirvo self-assigned this Feb 14, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

Walkthrough

This 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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "feat: misc code updates" is vague and generic, using non-descriptive terms that do not convey meaningful information about the substantial changes in this PR. Replace with a specific title that captures the main change, such as "feat: refactor type imports and improve subscription context" or "feat: consolidate iTunes configuration and enhance type safety".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/miscCodeUpdates

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟡 Minor

Fix Prettier formatting issues flagged by CI.

The pipeline reports Prettier found code style issues in this file. Run yarn prettier --write to 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 onPress handler is nearly identical to the one in StoreUpdateAvailableBanner.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 inner isPayingUser to avoid confusion.

The local variable isPayingUser on 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 with makePurchase().

The syncPurchases() method lacks error handling, while makePurchase() includes try/catch with ErrorMonitoring.exception(). Although this is consistent with the restorePurchases() 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);
+    }
   }

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@tsyirvo tsyirvo merged commit 5e526ae into develop Feb 15, 2026
2 checks passed
@tsyirvo tsyirvo deleted the feat/miscCodeUpdates branch February 15, 2026 15:29
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