Skip to content

refactor(plugin): replace global config state with explicit internal config passing#16

Merged
konodioda727 merged 3 commits intokonodioda727:mainfrom
BlackishGreen33:bg/plugin/explicit-config-passing
Mar 27, 2026
Merged

refactor(plugin): replace global config state with explicit internal config passing#16
konodioda727 merged 3 commits intokonodioda727:mainfrom
BlackishGreen33:bg/plugin/explicit-config-passing

Conversation

@BlackishGreen33
Copy link
Copy Markdown
Contributor

Summary

  • replace module-level config state with a resolved config object passed explicitly through internal plugin layers
  • keep the public JPushPluginProps API unchanged while removing hidden cross-module dependencies
  • fix Android vendor gating so Huawei and FCM integrations respect enabled: false
  • add regression coverage to prove config isolation and disabled-vendor behavior

Testing

  • npm run build
  • npm test -- --runInBand
  • npm run lint (not runnable in the current local workspace because eslint is not installed in node_modules)

Copilot AI review requested due to automatic review settings March 27, 2026 08:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Expo config plugin internals to eliminate module-level mutable config state by resolving plugin props once and passing a normalized config object through iOS/Android modification layers. This also corrects Android vendor “enabled” gating for Huawei/FCM and adds regression tests to prevent cross-instance config leakage.

Changes:

  • Removed the global utils/config state and introduced ResolvedJPushPluginProps + resolveProps() for normalized internal config passing.
  • Updated iOS/Android mod entrypoints to accept resolved props explicitly (and fixed Huawei/FCM injection to require enabled === true).
  • Added regression tests for per-instance config isolation and for “disabled vendor” behavior (Huawei/FCM).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
plugin/src/utils/config.ts Deletes global mutable config getters/setters to remove hidden state.
plugin/src/types.ts Adds ResolvedJPushPluginProps and resolveProps() for internal normalization.
plugin/src/index.ts Resolves props once and passes them into iOS/Android layers instead of setting global state.
plugin/src/ios/infoPlist.ts Writes Info.plist values from explicitly passed resolved props (no global getters).
plugin/src/ios/index.ts Threads resolved props through iOS config application.
plugin/src/android/index.ts Threads resolved props through Android config application.
plugin/src/android/projectBuildGradle.ts Gates Huawei/FCM classpaths and Huawei repo injection on enabled === true.
plugin/src/android/gradleProperties.ts Gates Huawei Gradle 8 compatibility property on enabled === true.
plugin/src/android/appBuildGradle.ts Gates Huawei/FCM dependencies + apply-plugins on enabled === true; uses explicit packageName.
plugin/tests/nativeIosMods.test.ts Adds regression test ensuring Info.plist values don’t leak across plugin instances.
plugin/tests/nativeAndroidMods.test.ts Adds regression tests for config isolation and for Huawei/FCM disabled-vendor behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/src/types.ts
@konodioda727 konodioda727 merged commit ccc9845 into konodioda727:main Mar 27, 2026
1 check passed
@BlackishGreen33 BlackishGreen33 deleted the bg/plugin/explicit-config-passing branch April 16, 2026 03:22
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.

3 participants