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

feat(native-app): add upgrade wall to app #16164

Merged
merged 16 commits into from
Oct 2, 2024
Merged

Conversation

thoreyjona
Copy link
Contributor

@thoreyjona thoreyjona commented Sep 26, 2024

What

Adding support for upgrade wall to the app. Minimum supported version is configured as a feature flag text in ConfigCat, so if users have older versions of the app they will get prompted with an upgrade wall.

The upgrade wall has a prop closable, if that is set to true we will display a "soft" upgrade wall, i.e. closable one.

I added a prop to preferencesStore called skippedSoftUpdate so if we are displaying a soft update wall then we keep track if the user clicks the Skip button or closes the modal with the x. So then we can check on that flag next time when deciding if we want to show a soft update wall. (Note: one bug is that we don't set this preference flag if the user swipes down the soft update wall - looked into it for a bit but did not find a good way for it, deciding it is not worth the effort for now - car revisit later if we want).

Also added custom user agent header to all api requests from the app on the format:
IslandIsApp (<versionNumber>) Build/<buildNumber>(<Platform>/<PlatformVersion>)
For example:
IslandIsApp (1.4.3) Build/143 (ios/18)
IslandIsApp (1.4.3) Build/143 (android/31)

I have verified in Data Dog that the user agent is coming all the way (for both ios and android):
Screenshot 2024-09-26 at 10 35 36
(see link to request here)

Why

When subpoena/law and order functionality goes live we want to have the option to use an upgrade wall for the app if needed.

Screenshots / Gifs

ios:

RPReplay_Final1727344778.mov

android:

Screen.Recording.Sept.26.from.Google.Play.Store.mp4

Closable upgrade wall:

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new screen for app updates, prompting users to update the app with localized messages.
    • Added a version check during app initialization to prompt users for updates if necessary.
    • Enhanced user agent information in requests for better tracking.
    • Added a property to track if a soft update has been skipped by the user.
  • Bug Fixes

    • Improved layout and styling of the passkey screen for better user experience.
  • Chores

    • Added a new dependency for version comparison tasks.
  • Documentation

    • Updated localization files for English and Icelandic to support new update prompts.

@thoreyjona thoreyjona requested review from a team as code owners September 26, 2024 10:43
Copy link
Contributor

coderabbitai bot commented Sep 26, 2024

Walkthrough

The changes introduce various updates across multiple files in the iOS application. Key modifications include the addition of a new UpdateAppScreen component for prompting users to update the app, enhancements to user-agent handling, and updates to localization files for both English and Icelandic. Additionally, new utility functions for version checking and custom user-agent generation have been implemented. The project configuration has also been adjusted to accommodate these changes, particularly in the linking settings and component registration.

Changes

Files Change Summary
apps/native/app/ios/IslandApp.xcodeproj/project.pbxproj Modified OTHER_LDFLAGS format from single string to multi-line array in multiple instances.
apps/native/app/package.json Added new dependency compare-versions with version 6.1.1.
apps/native/app/src/graphql/client.ts Added getCustomUserAgent import and included 'User-Agent' header in authLink function.
apps/native/app/src/messages/en.ts Added new localization entries for app update prompts.
apps/native/app/src/messages/is.ts Added new Icelandic localization entries for app update prompts.
apps/native/app/src/screens/home/home.tsx Introduced checkAppVersion function to check for app updates during component initialization.
apps/native/app/src/screens/passkey/passkey.tsx Updated UI components and styling, replaced image source, added new styled components.
apps/native/app/src/screens/update-app/update-app.tsx Created UpdateAppScreen component for update prompts, including modal navigation and buttons.
apps/native/app/src/ui/lib/navigation-bar-sheet/navigation-bar-sheet.tsx Added optional closable parameter to control close button visibility.
apps/native/app/src/utils/component-registry.ts Updated ComponentRegistry to include new entries for PasskeyScreen and UpdateAppScreen.
apps/native/app/src/utils/lifecycle/setup-components.tsx Registered UpdateAppScreen with registerComponent.
apps/native/app/src/utils/lifecycle/setup-routes.ts Added new route /update-app for modal navigation to UpdateAppScreen.
apps/native/app/src/utils/minimum-app-version.ts Introduced needsToUpdateAppVersion function to check app version against minimum supported version.
apps/native/app/src/utils/user-agent.ts Added getCustomUserAgent function to generate a custom user agent string.
apps/native/app/src/stores/preferences-store.ts Added skippedSoftUpdate property to track if a soft update was skipped by the user.

Possibly related PRs

  • feat(native-app): Add passkeys support to app #15057: The main PR introduces changes to the project.pbxproj file related to the OTHER_LDFLAGS setting, while this PR adds new dependencies and modifies the package.json, which may indirectly relate to the build process but does not directly affect the same files or settings.
  • feat(native-app): add app widgets to home screen #15902: The main PR modifies the project.pbxproj file, and this PR updates the Info.plist and build.gradle files to reflect a new version of the application, indicating a version bump that aligns with the changes made in the main PR.
  • feat(native-app): Implement universal links #15961: The main PR focuses on enhancing deep link handling and notification management, while this PR introduces universal links and modifies the IslandApp.entitlements file, which directly relates to the handling of links within the app.
  • feat(native-app): update applications screen #15964: The main PR updates the applications screen, and this PR introduces significant modifications to the ApplicationsScreen component, enhancing its functionality and organization, which aligns with the objectives of improving user experience in the main PR.

Suggested reviewers

  • eirikurn
  • birkir

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.84%. Comparing base (81e07f5) to head (dc1d293).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16164      +/-   ##
==========================================
- Coverage   36.93%   36.84%   -0.10%     
==========================================
  Files        6781     6781              
  Lines      139960   140357     +397     
  Branches    39792    39991     +199     
==========================================
+ Hits        51700    51715      +15     
- Misses      88260    88642     +382     
Flag Coverage Δ
air-discount-scheme-backend 54.22% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-catalogue-services 77.85% <ø> (ø)
api-domains-air-discount-scheme 36.95% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.77% <ø> (ø)
api-domains-communications 39.92% <ø> (ø)
api-domains-criminal-record 47.93% <ø> (ø)
api-domains-driving-license 44.48% <ø> (ø)
api-domains-education 31.74% <ø> (ø)
api-domains-health-insurance 34.78% <ø> (ø)
api-domains-mortgage-certificate 35.71% <ø> (ø)
api-domains-payment-schedule 41.22% <ø> (ø)
application-api-files 57.91% <ø> (ø)
application-core 71.62% <ø> (ø)
application-system-api 41.66% <ø> (ø)
application-template-api-modules 24.40% <ø> (+0.01%) ⬆️
application-templates-accident-notification 29.44% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.63% <ø> (ø)
application-templates-driving-license 18.70% <ø> (ø)
application-templates-estate 12.33% <ø> (ø)
application-templates-example-payment 25.41% <ø> (ø)
application-templates-financial-aid 14.34% <ø> (ø)
application-templates-general-petition 23.68% <ø> (ø)
application-templates-health-insurance 26.62% <ø> (ø)
application-templates-inheritance-report 6.45% <ø> (ø)
application-templates-marriage-conditions 15.23% <ø> (ø)
application-templates-mortgage-certificate 43.96% <ø> (ø)
application-templates-parental-leave 30.15% <ø> (+0.12%) ⬆️
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.29% <ø> (ø)
auth-admin-web 2.43% <ø> (ø)
auth-nest-tools 31.31% <ø> (ø)
auth-react 22.80% <ø> (ø)
auth-shared 75.00% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.73% <ø> (ø)
clients-driving-license-book 43.90% <ø> (ø)
clients-financial-statements-inao 49.25% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-middlewares 72.77% <ø> (-0.34%) ⬇️
clients-regulations 42.71% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.64% <ø> (ø)
clients-zendesk 54.61% <ø> (ø)
cms 0.43% <ø> (ø)
cms-translations 39.04% <ø> (ø)
content-search-index-manager 95.65% <ø> (ø)
content-search-toolkit 8.16% <ø> (ø)
contentful-apps 5.58% <ø> (ø)
dokobit-signing 63.20% <ø> (ø)
download-service 44.09% <ø> (ø)
email-service 60.97% <ø> (ø)
feature-flags 90.97% <ø> (ø)
file-storage 53.48% <ø> (ø)
financial-aid-backend 56.53% <ø> (ø)
financial-aid-shared 19.03% <ø> (ø)
icelandic-names-registry-backend 54.55% <ø> (ø)
infra-nest-server 48.75% <ø> (-0.26%) ⬇️
infra-tracing 43.24% <ø> (ø)
island-ui-core 28.47% <ø> (ø)
judicial-system-api 18.30% <ø> (ø)
judicial-system-audit-trail 69.10% <ø> (ø)
judicial-system-backend 55.28% <ø> (ø)
judicial-system-formatters 79.76% <ø> (ø)
judicial-system-message 67.12% <ø> (ø)
judicial-system-message-handler 48.17% <ø> (ø)
judicial-system-scheduler 69.17% <ø> (ø)
judicial-system-types 48.35% <ø> (ø)
judicial-system-web 28.11% <ø> (ø)
license-api 42.69% <ø> (+0.07%) ⬆️
localization 10.15% <ø> (ø)
logging 48.43% <ø> (ø)
message-queue 68.50% <ø> (ø)
nest-audit 68.20% <ø> (ø)
nest-config 78.32% <ø> (ø)
nest-feature-flags 51.95% <ø> (ø)
nest-problem 46.34% <ø> (ø)
nest-sequelize 94.44% <ø> (ø)
nest-swagger 51.71% <ø> (ø)
nova-sms 62.56% <ø> (ø)
portals-admin-regulations-admin 1.88% <ø> (ø)
portals-core 16.17% <ø> (ø)
reference-backend 50.41% <ø> (ø)
regulations 16.78% <ø> (ø)
residence-history 85.00% <ø> (ø)
services-auth-admin-api 51.98% <ø> (ø)
services-auth-delegation-api 57.93% <ø> (+0.06%) ⬆️
services-auth-ids-api 51.88% <ø> (+<0.01%) ⬆️
services-auth-personal-representative 45.52% <ø> (-0.03%) ⬇️
services-auth-personal-representative-public 41.64% <ø> (+0.04%) ⬆️
services-auth-public-api 49.37% <ø> (+0.01%) ⬆️
services-documents 61.17% <ø> (ø)
services-endorsements-api 55.22% <ø> (ø)
services-sessions 65.74% <ø> (-0.05%) ⬇️
services-university-gateway 48.50% <ø> (+0.19%) ⬆️
services-user-notification 47.07% <ø> (ø)
services-user-profile 62.36% <ø> (+0.07%) ⬆️
shared-components 27.68% <ø> (ø)
shared-form-fields 31.63% <ø> (ø)
shared-mocking 64.62% <ø> (ø)
shared-pii 92.85% <ø> (ø)
shared-problem 87.50% <ø> (ø)
shared-utils 28.01% <ø> (ø)
skilavottord-ws 24.24% <ø> (ø)
web 1.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 20 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81e07f5...dc1d293. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 26, 2024

Datadog Report

All test runs 9db1999 🔗

101 Total Test Services: 1 Failed, 98 Passed
🔻 Test Sessions change in coverage: 3 decreased, 5 increased, 192 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
services-auth-ids-api 4 0 0 148 0 59.2s 1 decreased (-0.19%) Link
air-discount-scheme-backend 0 0 0 81 0 30.96s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.72s N/A Link
api 0 0 0 4 0 3.02s N/A Link
api-catalogue-services 0 0 0 23 0 12.57s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 20.13s N/A Link
api-domains-assets 0 0 0 3 0 12.94s N/A Link
api-domains-auth-admin 0 0 0 18 0 14.21s N/A Link
api-domains-communications 0 0 0 5 0 34.97s N/A Link
api-domains-criminal-record 0 0 0 5 0 10.66s N/A Link

❌ Failed Tests (4)

  • DelegationsController Given a user is authenticated GET with general mandate delegation type should get all general mandate scopes - apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts - Details

    Expand for error
     Validation error
    
  • DelegationsController Given a user is authenticated GET with general mandate delegation type should only return valid general mandates - apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts - Details

    Expand for error
     Validation error
    
  • DelegationsController Given a user is authenticated GET with general mandate delegation type should return all general mandate scopes and other preset scopes - apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts - Details

    Expand for error
     Validation error
    
  • DelegationsController Given a user is authenticated GET with general mandate delegation type should return mergedDelegationDTO with the generalMandate - apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts - Details

    Expand for error
     Validation error
    

🔻 Code Coverage Decreases vs Default Branch (3)

  • clients-middlewares - jest 75.5% (-0.2%) - Details
  • services-auth-ids-api - jest 44.88% (-0.19%) - Details
  • infra-nest-server - jest 56.11% (-0.17%) - Details

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (14)
apps/native/app/src/utils/user-agent.ts (2)

4-10: Implementation looks good, but consider adding error handling.

The getCustomUserAgent function correctly implements the required user agent format as specified in the PR objectives. It's concise and readable.

Consider adding error handling to manage potential failures when calling DeviceInfo or Platform APIs. For example:

export const getCustomUserAgent = (): string => {
  try {
    return [
      `IslandIsApp (${DeviceInfo.getVersion()})`,
      `Build/${DeviceInfo.getBuildNumber()}`,
      `(${Platform.OS}/${Platform.Version})`,
    ].join(' ')
  } catch (error) {
    console.error('Failed to generate custom user agent:', error)
    return 'IslandIsApp (Unknown)'
  }
}

This ensures that even if there's an error, a default user agent is returned.


1-10: Enhance TypeScript usage for better type safety.

While the current implementation works, we can improve type safety and code clarity with TypeScript features.

Consider these TypeScript enhancements:

  1. Add a return type annotation to the getCustomUserAgent function:

    export const getCustomUserAgent = (): string => {
      // ... existing implementation
    }
  2. If you're using a recent TypeScript version that supports import type assertions, you could add them to the imports for extra clarity:

    import { Platform } from 'react-native' assert { type: 'module' };
    import DeviceInfo from 'react-native-device-info' assert { type: 'module' };

These changes will improve type checking and make the code's intent clearer.

apps/native/app/src/ui/lib/navigation-bar-sheet/navigation-bar-sheet.tsx (2)

75-75: LGTM! Consider using a more specific type for closable.

The addition of the closable parameter with a default value of true is a good implementation that aligns with the PR objectives and maintains backward compatibility. The type definition is correctly updated.

Consider using a more specific type for closable:

closable?: boolean

This change would make the type more explicit and improve code readability.

Also applies to: 82-82


97-103: LGTM! Consider extracting the title rendering logic for improved readability.

The conditional rendering of the Header component and the updated title handling logic are well-implemented. These changes align with the PR objectives and improve the component's flexibility.

To improve readability, consider extracting the title rendering logic into a separate function:

const renderTitle = () => {
  if (typeof title === 'string') {
    return <HeaderTitle>{title}</HeaderTitle>;
  }
  return title;
};

// Then in the JSX:
{(closable || title) && (
  <Header style={style}>
    {renderTitle()}
    {/* ... rest of the Header content ... */}
  </Header>
)}

This refactoring would make the component's structure easier to understand at a glance.

apps/native/app/src/screens/update-app/update-app.tsx (3)

1-37: LGTM! Consider extracting styled components.

The imports and styled components are well-organized and follow React Native best practices. The use of theme values in styled components promotes consistency across the app.

Consider extracting the styled components to a separate file (e.g., update-app.styles.ts) to improve code organization and reusability, especially if the component grows larger in the future.


49-65: LGTM! Consider adding componentId to useEffect dependencies.

The component declaration and use of useEffect to set up navigation options based on the closable prop are well implemented. However, there's a minor improvement that can be made:

Add componentId to the useEffect dependency array to ensure the effect runs if the componentId changes:

-  }, [])
+  }, [componentId, closable])

This change will make the effect more robust and compliant with React's rules of hooks.


67-132: LGTM! Consider adding accessibility props to images.

The component's render method is well-structured and follows React Native best practices. The use of localization and conditional rendering based on the closable prop is excellent. However, there are a couple of improvements that can enhance the component:

  1. Add accessibility props to the Image components:
<Image
  source={logo}
  resizeMode="contain"
  style={{ width: 45, height: 45 }}
+ accessibilityLabel={intl.formatMessage({ id: 'updateApp.logoAlt', defaultMessage: 'Iceland.is logo' })}
+ accessibilityRole="image"
/>

<Image
  source={illustrationSrc}
  style={{ width: 210, height: 240 }}
  resizeMode="contain"
+ accessibilityLabel={intl.formatMessage({ id: 'updateApp.illustrationAlt', defaultMessage: 'Update illustration' })}
+ accessibilityRole="image"
/>
  1. Consider using a constant for the app store URLs to improve maintainability:
const APP_STORE_URL = 'https://apps.apple.com/app/%C3%ADsland-is-stafr%C3%A6nt-%C3%ADsland/id1569828682';
const PLAY_STORE_URL = 'https://play.google.com/store/apps/details?id=is.island.app';

// Then in the onPress handler:
Linking.openURL(isIos ? APP_STORE_URL : PLAY_STORE_URL)

These changes will improve accessibility and make the code more maintainable.

apps/native/app/src/utils/lifecycle/setup-components.tsx (1)

107-107: LGTM: Registration of UpdateAppScreen component

The UpdateAppScreen component is correctly registered with the appropriate identifier. This registration aligns with the PR objectives of adding an upgrade wall to the app.

Consider grouping related screens together for better code organization. For instance, you might want to place this registration near other update-related or system-level screens if they exist.

apps/native/app/src/screens/passkey/passkey.tsx (2)

34-48: LGTM: New styled components enhance code organization.

The introduction of Host, ButtonWrapper, and Title styled components improves code organization and reusability. They follow React and styled-components best practices and maintain consistency with the theme.

Consider adding JSDoc comments to these new components to improve code documentation. For example:

/**
 * Wrapper component that centers its children both vertically and horizontally.
 */
const Host = styled.View`
  // ... existing styles
`

Line range hint 102-135: LGTM: Improved component structure using new styled components.

The updates to the component's structure, including the use of the Host component and the Title component, improve code readability and maintain consistent styling. The adjustment of the illustration image dimensions is also noted.

Consider extracting the image dimensions into constants or theme variables for easier maintenance. For example:

const ILLUSTRATION_WIDTH = 210;
const ILLUSTRATION_HEIGHT = 240;

// ... in the component
<Image
  source={illustrationSrc}
  style={{ width: ILLUSTRATION_WIDTH, height: ILLUSTRATION_HEIGHT }}
  resizeMode="contain"
/>
apps/native/app/src/screens/home/home.tsx (1)

259-264: LGTM: App version check implementation.

The checkAppVersion function and its integration look good. It correctly implements the upgrade wall feature as described in the PR objectives. The use of useCallback for memoization is a good practice.

Consider adding error handling to the checkAppVersion function:

const checkAppVersion = useCallback(async () => {
  try {
    const needsUpdate = await needsToUpdateAppVersion()
    if (needsUpdate) {
      navigateTo('/update-app', { closable: false })
    }
  } catch (error) {
    console.error('Failed to check app version:', error)
    // Consider implementing a fallback behavior or user notification
  }
}, [])

This will ensure that any errors during the version check are logged and handled gracefully.

Also applies to: 272-273

apps/native/app/src/utils/lifecycle/setup-routes.ts (1)

183-201: LGTM! Consider a minor improvement for consistency.

The new route for /update-app is well-implemented and aligns with the PR objectives. The use of swipeToDismiss: false is appropriate for an update screen.

For consistency with other modal routes in this file, consider extracting the modal options into a separate object:

const updateAppModalOptions: Options = {
  modal: {
    swipeToDismiss: false,
  },
};

addRoute('/update-app', async (passProps) => {
  Navigation.showModal({
    stack: {
      options: updateAppModalOptions,
      children: [
        {
          component: {
            name: ComponentRegistry.UpdateAppScreen,
            passProps,
          },
        },
      ],
    },
  })
})

This approach would improve readability and make it easier to maintain consistent modal options across different routes.

apps/native/app/src/messages/en.ts (1)

599-605: LGTM! New translations added for the update app feature.

The new translations for the 'updateApp' feature align well with the PR objectives. They provide clear messages for prompting users to update their app version.

For consistency with other translation keys in this file, consider using sentence case for the 'buttonSkip' key:

-  'updateApp.buttonSkip': 'Skip',
+  'updateApp.buttonSkip': 'Skip',
apps/native/app/src/messages/is.ts (1)

598-604: LGTM! Consider a minor improvement for consistency.

The new translations for the app update feature look good and align well with the PR objectives. They provide clear and concise messages for the update prompt, including an option to skip the update.

For consistency with other multi-word keys in the file, consider using camelCase for 'buttonSkip':

-  'updateApp.buttonSkip': 'Sleppa',
+  'updateApp.buttonSkip': 'Sleppa',

This change would make the key naming consistent with others like 'updateApp.description'.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c3b59aa and a5e13fe.

⛔ Files ignored due to path filters (5)
  • apps/native/app/ios/Podfile.lock is excluded by !**/*.lock
  • apps/native/app/src/assets/illustrations/digital-services-m1-dots.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • apps/native/app/ios/IslandApp.xcodeproj/project.pbxproj (3 hunks)
  • apps/native/app/package.json (1 hunks)
  • apps/native/app/src/graphql/client.ts (2 hunks)
  • apps/native/app/src/messages/en.ts (1 hunks)
  • apps/native/app/src/messages/is.ts (1 hunks)
  • apps/native/app/src/screens/home/home.tsx (2 hunks)
  • apps/native/app/src/screens/passkey/passkey.tsx (5 hunks)
  • apps/native/app/src/screens/update-app/update-app.tsx (1 hunks)
  • apps/native/app/src/ui/lib/navigation-bar-sheet/navigation-bar-sheet.tsx (2 hunks)
  • apps/native/app/src/utils/component-registry.ts (1 hunks)
  • apps/native/app/src/utils/lifecycle/setup-components.tsx (2 hunks)
  • apps/native/app/src/utils/lifecycle/setup-routes.ts (1 hunks)
  • apps/native/app/src/utils/minum-app-version.ts (1 hunks)
  • apps/native/app/src/utils/user-agent.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
apps/native/app/ios/IslandApp.xcodeproj/project.pbxproj (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/package.json (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/graphql/client.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/messages/en.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/messages/is.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/screens/home/home.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/screens/passkey/passkey.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/screens/update-app/update-app.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/navigation-bar-sheet/navigation-bar-sheet.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/component-registry.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/lifecycle/setup-components.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/lifecycle/setup-routes.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/minum-app-version.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/user-agent.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (24)
apps/native/app/src/utils/user-agent.ts (1)

1-2: Imports look good.

The necessary modules are correctly imported, and there's no unnecessary import bloat.

apps/native/app/src/utils/minum-app-version.ts (2)

1-3: LGTM: Imports are appropriate and follow best practices.

The imports are well-chosen for the task at hand. Using react-native-device-info for version retrieval and compare-versions for version comparison are good practices in React Native development.


5-18: LGTM: Well-implemented version comparison function.

The needsToUpdateAppVersion function is well-structured and follows TypeScript and React Native best practices. It correctly handles asynchronous operations and uses appropriate libraries for version retrieval and comparison.

apps/native/app/src/ui/lib/navigation-bar-sheet/navigation-bar-sheet.tsx (3)

95-95: LGTM! Handle rendering logic updated correctly.

The conditional rendering of the Handle component has been updated to include the closable check. This change correctly implements the new functionality to control UI element visibility based on the closable parameter.


104-129: LGTM! CloseButton rendering updated correctly.

The conditional rendering of the CloseButton based on the closable parameter is well-implemented. This change correctly aligns with the PR objectives to control the visibility of the close button while maintaining the rendering of other icons.


Line range hint 1-134: Overall, the changes are well-implemented and align with the PR objectives.

The modifications to the NavigationBarSheet component successfully introduce the closable functionality while maintaining backward compatibility and adhering to NextJS and React Native best practices. The component's type safety is preserved, and the conditional rendering logic is correctly implemented.

A few minor suggestions have been made to further improve code readability and maintainability, but these are not critical issues.

apps/native/app/src/screens/update-app/update-app.tsx (2)

39-47: LGTM! Good use of custom hooks for navigation options.

The creation and use of a custom hook for navigation options is a great practice. It enhances code reusability and keeps the component clean. The options set are appropriate for a modal screen, hiding the top bar and controlling the hardware back button behavior.


135-135: LGTM! Consistent use of navigation options.

The assignment of navigation options using the getNavigationOptions function is consistent with the custom hook created earlier in the file. This approach ensures that the component uses the predefined navigation options, maintaining consistency across the app.

apps/native/app/package.json (1)

55-55: New dependency added: compare-versions

The addition of the compare-versions package (version 6.1.1) aligns with the PR objectives, particularly for implementing the upgrade wall feature. This package will likely be used to compare the user's app version with the minimum supported version.

A few points to consider:

  1. Ensure that this package is actually used in the implementation of the upgrade wall feature.
  2. Verify that version 6.1.1 is the latest stable version and doesn't have any known vulnerabilities.
  3. Consider adding a comment in the code where this package is used, explaining its purpose in the context of the upgrade wall feature.

To ensure the package is being used correctly, please run the following command:

This will help verify that the package is imported and used in the relevant files for the upgrade wall feature.

✅ Verification successful

Dependency compare-versions usage verified

The compare-versions package (version 6.1.1) is correctly imported and utilized in src/utils/minum-app-version.ts. This confirms that the addition aligns with the PR objectives, specifically for implementing the upgrade wall feature.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of compare-versions in the codebase
rg --type typescript --type javascript 'import.*compare-versions'

Length of output: 102


Script:

#!/bin/bash
# Search for usage of compare-versions in .ts and .js files
rg 'import.*compare-versions' -g '*.ts' -g '*.js'

Length of output: 145

apps/native/app/src/graphql/client.ts (2)

23-23: LGTM: Import statement for custom user agent function.

The import statement for getCustomUserAgent is correctly added and follows TypeScript best practices.


138-138: Verify completeness of User-Agent implementation.

The addition of the custom User-Agent header in the authLink is correct and aligns with the PR objectives. However, as per a previous review comment, we should consider adding this header in other relevant places:

  1. In the errorLink within this file.
  2. In the auth-store.ts file.

To ensure consistency, please run the following script to check for other potential locations where the User-Agent should be added:

Please review the output and consider adding the User-Agent header in these locations if appropriate.

✅ Verification successful

Retry the header search with corrected file type specifications.

Please run the following script to check for other locations where the User-Agent might need to be added:


User-Agent header implementation verified, minor enhancement suggested.

The User-Agent header is correctly implemented in the authLink within apps/native/app/src/graphql/client.ts. However, for consistency, consider adding it to the errorLink as well. No changes are needed in auth-store.ts.

To add the User-Agent header to the errorLink, you can modify it like this:

const errorLink = onError(({ graphQLErrors, networkError }) => {
  if (graphQLErrors)
    graphQLErrors.forEach(({ message, locations, path }) =>
      console.log(
        `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`,
      ),
    )
  if (networkError) console.log(`[Network error]: ${networkError}`)
})

// Add this line before creating the ApolloClient instance
errorLink.setOptions({
  headers: {
    'User-Agent': getCustomUserAgent(),
  },
})

This change will ensure that the User-Agent header is consistently applied across both authLink and errorLink.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other locations where User-Agent might need to be added

# Search for headers being set in the current file
echo "Checking current file for other header settings:"
rg --type typescript -A 5 'headers:' apps/native/app/src/graphql/client.ts

# Search for headers being set in auth-store.ts
echo "\nChecking auth-store.ts for header settings:"
rg --type typescript -A 5 'headers:' apps/native/app/src/stores/auth-store.ts

Length of output: 430


Script:

#!/bin/bash
# Description: Check for other locations where User-Agent might need to be added

# Search for headers being set in the current file
echo "Checking current file for other header settings:"
fd --extension ts --extension tsx . apps/native/app/src/graphql/client.ts | xargs rg -A 5 'headers:'

# Search for headers being set in auth-store.ts
echo -e "\nChecking auth-store.ts for header settings:"
fd --extension ts --extension tsx . apps/native/app/src/stores/auth-store.ts | xargs rg -A 5 'headers:'

Length of output: 342981

apps/native/app/src/utils/lifecycle/setup-components.tsx (2)

28-28: LGTM: Import statement for UpdateAppScreen

The import statement for the UpdateAppScreen component is correctly added and follows the existing pattern in the file. This import is necessary for the subsequent registration of the component.


28-28: Summary: Changes align with PR objectives

The addition of the UpdateAppScreen import and its registration in the component setup process aligns well with the PR objectives of implementing an upgrade wall feature. These changes lay the groundwork for prompting users to upgrade when using older versions of the app.

The implementation follows NextJS best practices and maintains consistent code style with the rest of the file. Good use of TypeScript ensures type safety for the new component.

To ensure the UpdateAppScreen is implemented correctly, let's verify its existence and basic structure:

Also applies to: 107-107

apps/native/app/src/screens/passkey/passkey.tsx (4)

18-18: LGTM: Updated illustration import.

The change to import 'digital-services-m1-dots.png' instead of 'digital-services-m1.png' looks good. This update likely reflects an intentional change to use a newer version of the illustration.


Line range hint 136-219: LGTM: Improved button layout with ButtonWrapper.

The use of the ButtonWrapper component for the buttons enhances layout consistency and improves the overall structure of the component. The functionality of the buttons remains intact, which is good.


Line range hint 1-234: Note: NextJS best practices not applicable.

This file is a React Native component and does not directly involve NextJS. Therefore, the NextJS best practices mentioned in the coding guidelines are not applicable to this specific file.


Line range hint 1-234: LGTM: Appropriate TypeScript usage.

The file demonstrates proper use of TypeScript, including type annotations and imports. The changes made do not introduce any TypeScript-related issues, and the overall usage remains consistent and appropriate.

apps/native/app/src/screens/home/home.tsx (3)

31-31: LGTM: Import statement for version checking utility.

The import for needsToUpdateAppVersion is correctly placed and follows proper naming conventions.


34-34: LGTM: Import statement for navigation utility.

The import for navigateTo is correctly placed and follows proper naming conventions.


Line range hint 1-420: Summary: Upgrade wall feature successfully implemented.

The changes in this file successfully implement the upgrade wall feature as described in the PR objectives. The implementation:

  1. Correctly imports necessary utilities.
  2. Implements a version check function using async/await.
  3. Integrates the version check into the component's lifecycle.
  4. Uses a non-closable navigation to the update screen when needed.

The code follows React and TypeScript best practices, making good use of hooks like useCallback and useEffect. The implementation is well-integrated into the existing MainHomeScreen component.

One minor suggestion for improvement has been made regarding error handling in the checkAppVersion function.

Overall, this implementation meets the requirements and maintains good code quality.

apps/native/app/ios/IslandApp.xcodeproj/project.pbxproj (4)

553-556: Consistency check for OTHER_LDFLAGS changes

The changes to OTHER_LDFLAGS are consistent across all three configurations (Testing, Release, and Debug). This consistency is good practice and reduces the risk of configuration-specific issues.

To ensure that the changes are indeed consistent across all configurations, you can run the following command to compare the OTHER_LDFLAGS settings:

#!/bin/bash
# Compare OTHER_LDFLAGS across all configurations
echo "Testing configuration:"
sed -n '/name = Testing/,/name = /p' IslandApp.xcodeproj/project.pbxproj | grep OTHER_LDFLAGS
echo "\nRelease configuration:"
sed -n '/name = Release/,/name = /p' IslandApp.xcodeproj/project.pbxproj | grep OTHER_LDFLAGS
echo "\nDebug configuration:"
sed -n '/name = Debug/,/name = /p' IslandApp.xcodeproj/project.pbxproj | grep OTHER_LDFLAGS

Also applies to: 628-631, 751-754


751-754: Modification of OTHER_LDFLAGS in Debug configuration

The OTHER_LDFLAGS setting has been changed from a single string to an array format, consistent with the changes in the Testing and Release configurations.

To ensure this change doesn't introduce any build issues, please verify the build process in the Debug configuration. You can run the following command to check if there are any linker warnings or errors:

#!/bin/bash
# Check for linker warnings or errors in the Debug configuration
xcodebuild -project IslandApp.xcodeproj -scheme IslandApp -configuration Debug clean build | grep -i "ld: warning" || echo "No linker warnings found."

628-631: Modification of OTHER_LDFLAGS in Release configuration

The OTHER_LDFLAGS setting has been changed from a single string to an array format, consistent with the change in the Testing configuration.

To ensure this change doesn't introduce any build issues, please verify the build process in the Release configuration. You can run the following command to check if there are any linker warnings or errors:


553-556: Modification of OTHER_LDFLAGS in Testing configuration

The OTHER_LDFLAGS setting has been changed from a single string to an array format. This change is consistent with modern Xcode practices for specifying build flags.

To ensure this change doesn't introduce any build issues, please verify the build process in the Testing configuration. You can run the following command to check if there are any linker warnings or errors:

apps/native/app/src/utils/minum-app-version.ts Outdated Show resolved Hide resolved
apps/native/app/src/utils/minum-app-version.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (3)
apps/native/app/src/utils/minimum-app-version.ts (2)

5-18: Function implementation looks good, consider adding error handling.

The needsToUpdateAppVersion function is well-implemented and follows a logical flow. It correctly handles the case when the minimum supported version is not available. The use of async/await for feature flag retrieval is appropriate.

Consider adding try-catch blocks to handle potential errors from DeviceInfo.getVersion() or compareVersions.compare(). This would make the function more robust and prevent unexpected crashes. For example:

export const needsToUpdateAppVersion = async (): Promise<boolean> => {
  try {
    const minimumVersionSupported = await featureFlagClient?.getValueAsync(
      'minimumSupportedAppVersion',
      '1.0.0',
    )

    if (!minimumVersionSupported) {
      return false
    }

    const currentVersion = DeviceInfo.getVersion()

    return compareVersions.compare(minimumVersionSupported, currentVersion, '>')
  } catch (error) {
    console.error('Error checking app version:', error)
    return false // or handle the error as appropriate for your use case
  }
}

5-18: Consider adding explicit type annotations for improved type safety.

While the function's return type is correctly annotated, adding explicit type annotations for minimumVersionSupported and currentVersion variables would enhance code readability and type safety.

Consider adding the following type annotations:

export const needsToUpdateAppVersion = async (): Promise<boolean> => {
  const minimumVersionSupported: string | undefined = await featureFlagClient?.getValueAsync(
    'minimumSupportedAppVersion',
    '1.0.0',
  )

  if (!minimumVersionSupported) {
    return false
  }

  const currentVersion: string = DeviceInfo.getVersion()

  return compareVersions.compare(minimumVersionSupported, currentVersion, '>')
}

This change would make the types of these variables explicit and potentially catch type-related issues earlier in the development process.

apps/native/app/src/stores/preferences-store.ts (1)

35-35: LGTM! Consider adding a brief comment.

The addition of skippedSoftUpdate to the PreferencesStore interface is appropriate and aligns with the PR objectives. The boolean type is suitable for this flag.

Consider adding a brief comment above this property to explain its purpose, e.g.:

/** Indicates whether the user has skipped a soft update prompt */
skippedSoftUpdate: boolean

This would enhance code readability and maintainability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a5e13fe and 2889412.

📒 Files selected for processing (3)
  • apps/native/app/src/screens/update-app/update-app.tsx (1 hunks)
  • apps/native/app/src/stores/preferences-store.ts (2 hunks)
  • apps/native/app/src/utils/minimum-app-version.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/native/app/src/screens/update-app/update-app.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/native/app/src/stores/preferences-store.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/minimum-app-version.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (4)
apps/native/app/src/utils/minimum-app-version.ts (2)

1-3: LGTM: Imports are well-structured and appropriate.

The import statements are clear, concise, and follow good practices. They import the necessary dependencies for version comparison and device information retrieval.


1-18: LGTM: Adheres to NextJS best practices for utility functions.

The file location and implementation align well with NextJS best practices for organizing utility functions. The needsToUpdateAppVersion function is platform-agnostic and can be used in both server-side and client-side contexts, which is beneficial for a NextJS application.

apps/native/app/src/stores/preferences-store.ts (2)

75-75: LGTM! Default value is appropriate.

Setting skippedSoftUpdate to false in the defaultPreferences object is correct. This ensures that the initial state assumes the user hasn't skipped any soft updates, which is the expected default behavior.


Line range hint 1-156: Overall, the changes are well-implemented and follow best practices.

The additions to the PreferencesStore interface and defaultPreferences object are consistent and properly typed. The file continues to adhere to NextJS and TypeScript best practices, making effective use of Zustand for state management. These changes enhance the app's ability to track whether a user has skipped a soft update, aligning well with the PR objectives.

Copy link
Contributor

@snaerseljan snaerseljan left a comment

Choose a reason for hiding this comment

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

Awesome job 💯 . This is looking good. Few nits as always but nothing breaking 😅

apps/native/app/src/graphql/client.ts Show resolved Hide resolved
apps/native/app/src/screens/home/home.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/update-app/update-app.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/update-app/update-app.tsx Outdated Show resolved Hide resolved
@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Oct 2, 2024
Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (1)
apps/native/app/src/screens/update-app/update-app.tsx (1)

49-65: LGTM: Component definition and props are well-structured.

The UpdateAppScreen component is defined correctly with appropriate props and follows React Native best practices. The use of useEffect to dynamically update navigation options based on the closable prop is a good approach.

Consider adding a comment explaining the purpose of the closable prop and its impact on the component's behavior. This would improve code readability and maintainability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2889412 and d75a062.

📒 Files selected for processing (3)
  • apps/native/app/src/screens/home/home.tsx (2 hunks)
  • apps/native/app/src/screens/update-app/update-app.tsx (1 hunks)
  • apps/native/app/src/utils/minimum-app-version.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/native/app/src/utils/minimum-app-version.ts
🧰 Additional context used
📓 Path-based instructions (2)
apps/native/app/src/screens/home/home.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/screens/update-app/update-app.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (5)
apps/native/app/src/screens/update-app/update-app.tsx (2)

1-37: LGTM: Imports and styled components are well-organized.

The imports cover all necessary components and utilities for the UpdateAppScreen. The styled components are defined clearly and follow the project's styling conventions. The previous comment about margin-vertical has been addressed in the Text styled component.


39-47: LGTM: Navigation options are well-configured.

The navigation options are appropriately set for a modal screen, with the top bar hidden and hardware back button behavior configured. The use of createNavigationOptionHooks promotes reusability and consistency across the app.

apps/native/app/src/screens/home/home.tsx (3)

31-31: LGTM: New imports are correctly added and follow best practices.

The new imports for needsToUpdateAppVersion and navigateTo are correctly placed and follow proper naming conventions. They are imported from relative paths, which is a good practice for internal modules.

Also applies to: 34-34


259-264: LGTM: New isAppUpdateRequired function is well-implemented.

The new async function is correctly implemented using useCallback for memoization. It properly handles the asynchronous needsToUpdateAppVersion call and conditionally navigates to the update screen. The function name is clear and descriptive, addressing the past review comment.


272-273: LGTM: useEffect hook updated correctly to include app version check.

The isAppUpdateRequired function is appropriately added to the useEffect hook, ensuring that the app version check is performed when the component mounts. The added comment clearly explains the purpose of the new line, enhancing code readability.

@kodiakhq kodiakhq bot merged commit 06f5a62 into main Oct 2, 2024
261 checks passed
@kodiakhq kodiakhq bot deleted the feat/app-add-upgrade-wall branch October 2, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants