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

Add Push Notifications command #34

Merged
merged 47 commits into from
Apr 26, 2024
Merged

Add Push Notifications command #34

merged 47 commits into from
Apr 26, 2024

Conversation

codeofdiego
Copy link
Contributor

@codeofdiego codeofdiego commented Feb 27, 2024

This PR adds the ability to set up Push Notifications as an independent command to be used after the user executes the initial create setup. It performs the following changes in the project:

  • Add React Native Firebase and messaging dependencies
  • Copies a template directory with a new useNotifications hook and requestNotificationPermission utility
  • Updates the App.tsx file to import and run the hook
  • Adds the native folders to the .gitignore file
  • Adds required config object to the app.json file.

To achieve some of these changes 3 new utility functions were added:

  • readAppJson - returns the app.json file as a parsed json object
  • addAppJsonConfig - deep merges a provided ExpoConfig config with the existing content of the app.json file
  • injectHooks - takes a list of hooks and their imports, and injects them in the App.tsx file

Additionally, this PR includes new rules for import organizations in the .eslintrc.js.eta template, this was necessary to give us the ability to reorganize imports when we inject code/imports in existing files. This will be a repeating scenario as we add more commands to Betl.

Preview

Collapsed Expanded
Screenshot 2024-02-27 at 14 27 21 Screenshot 2024-02-27 at 14 27 24

@codeofdiego codeofdiego self-assigned this Feb 27, 2024
@codeofdiego codeofdiego marked this pull request as ready for review February 27, 2024 20:00
Copy link

@stevehanson stevehanson left a comment

Choose a reason for hiding this comment

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

This is looking great! Thank you for working on this 🙌 I'm still going through this but wanted to get a first round of feedback back.

src/commands/eslint.ts Outdated Show resolved Hide resolved
src/commands/notifications.ts Show resolved Hide resolved
src/commands/notifications.ts Outdated Show resolved Hide resolved
src/commands/notifications.ts Outdated Show resolved Hide resolved
src/commands/notifications.ts Outdated Show resolved Hide resolved
src/commands/notifications.ts Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
src/util/addAppJsonConfig.ts Outdated Show resolved Hide resolved
src/util/injectHooks.ts Outdated Show resolved Hide resolved
@codeofdiego
Copy link
Contributor Author

This should be good for review again.

Copy link

@stevehanson stevehanson left a comment

Choose a reason for hiding this comment

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

Thanks for all of this great work! It seems like it's getting close!

src/commands/notifications.ts Outdated Show resolved Hide resolved
src/cli.ts Outdated Show resolved Hide resolved
src/commands/__tests__/notifications.test.ts Show resolved Hide resolved
src/commands/__tests__/notifications.test.ts Outdated Show resolved Hide resolved
src/commands/__tests__/notifications.test.ts Show resolved Hide resolved
src/util/injectHooks.ts Outdated Show resolved Hide resolved
src/util/injectHooks.ts Outdated Show resolved Hide resolved
templates/eslint/.eslintrc.js.eta Outdated Show resolved Hide resolved
templates/eslint/.eslintrc.js.eta Outdated Show resolved Hide resolved
@codeofdiego
Copy link
Contributor Author

Hi @stevehanson, please let me know if there's anything left on this PR.

This includes the addNotifications command itself, an app.config.ts file to include the google service files without changing the contents of app.json directly and a requestNotificationPermission utility to be added separately
This will be necessary when dynamically adding imports to ensure the right order is kept.
This will help run linter after performing changes to app files
codeofdiego and others added 21 commits April 26, 2024 13:26
We thought this was a bit too heavy handed and might interfere with projects that already have native changes being tracked
Co-authored-by: Stephen Hanson <[email protected]>
We decided to discuss it further as part of the eslint-config project instead. For now organizing impots does not affect belt functionality.
Copy link

@stevehanson stevehanson left a comment

Choose a reason for hiding this comment

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

Great work!

@codeofdiego codeofdiego merged commit fc43e72 into main Apr 26, 2024
2 checks passed
@codeofdiego codeofdiego deleted the notifications branch April 26, 2024 21:21
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.

2 participants