Skip to content

fix(flutter,react-native): move the embedded Android Push code to its own package - #2051

Merged
ChiragAgg5k merged 3 commits into
mainfrom
fix/embedded-push-packages
Oct 15, 2026
Merged

ChiragAgg5k merged 3 commits into
mainfrom
fix/embedded-push-packages

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

The Flutter plugin and the React Native module embed the Android Push code under the Android SDK's own packages. An app that depends on two of the three SDKs fails to build, and the merged manifest declares the same components twice:

Duplicate class io.appwrite.services.PushService found in modules appwrite (Flutter plugin) and sdk-for-android

The embedded copies now use the plugin packages each SDK already has. The Android SDK keeps its packages, and its output is byte-identical to main.

before after
Flutter io.appwrite.services, io.appwrite.exceptions io.appwrite.flutter.services, io.appwrite.flutter.exceptions
React Native same as Android io.appwrite.reactnative.services, io.appwrite.reactnative.exceptions

pushNamespace in the shared templates follows the language (io.<title>.<language> outside Android). That also gives each copy its own broadcast actions and notification-icon meta-data key (io.appwrite.flutter.push.notification_icon), and the READMEs say so.

Fully qualified classes shared between the generated trees (2.5.x client spec):

before after
flutter ∩ android 21 0
react-native ∩ android 21 0
flutter ∩ react-native 22 0

The plugin's Android code compiles in a Flutter app (classes.jar: 35 classes, all under io/appwrite/flutter, none shared with the Android library's 316). testEmbeddedAndroidPushClassesDoNotCollide fails on main with the duplicate list and passes here.

Closes #2053

… own package

The Flutter plugin and the React Native module embedded the Android SDK's Push classes under io.appwrite.services and io.appwrite.exceptions, so an app depending on two of the three SDKs failed with duplicate classes and colliding manifest components. The embedded copies now live under io.appwrite.flutter and io.appwrite.reactnative, with their own broadcast actions and notification-icon meta-data key. The Android SDK keeps its packages.
@hansi-codes

hansi-codes Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The generator now emits embedded Flutter and React Native Android Push classes, manifest components, broadcast actions, and notification metadata under SDK-specific packages, while leaving the Android SDK package unchanged. Bridge imports and README examples follow those package names, and generation and end-to-end tests cover collisions and native Push behavior.

Latest changes: The newest commits update the Flutter and React Native Android e2e harnesses to copy their new package trees and use the corresponding service imports and broadcast actions.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 20
File Change
src/SDK/Language/Flutter.php Generates the embedded Flutter Push sources under the Flutter-specific package.
src/SDK/Language/ReactNative.php Generates the embedded React Native Push sources under the React Native-specific package.
templates/android/library/src/main/AndroidManifest.xml.twig Uses language-specific package names for embedded Push components.
templates/android/library/src/main/java/io/package/services/PushBackground.kt.twig Uses the Push-specific namespace for background classes, actions, and metadata.
templates/android/library/src/main/java/io/package/services/PushBridge.kt.twig Uses the new namespace for the Push bridge.
templates/android/library/src/main/java/io/package/services/PushCore.kt.twig Uses the new namespace for Push core classes and exception imports.
templates/android/library/src/main/java/io/package/services/PushOpenActivity.kt.twig Uses the new namespace for the Push open activity.
templates/android/library/src/main/java/io/package/services/PushReceiver.kt.twig Uses the new namespace for the Push receiver.
templates/android/library/src/main/java/io/package/services/PushService.kt.twig Uses the new namespace for the Push service.
templates/android/library/src/main/java/io/package/services/PushWakeups.kt.twig Uses the new namespace for Push wakeup components.
templates/android/push/Exception.kt.twig Generates the embedded Push exception under the SDK-specific namespace.
templates/flutter/README.md.twig Updates Flutter manifest-removal and notification-icon metadata examples.
templates/flutter/android/src/main/kotlin/io/package/flutter/PushPlugin.kt.twig Imports Push classes from the Flutter-specific package.
templates/react-native/README.md.twig Updates React Native manifest-removal and notification-icon metadata examples.
templates/react-native/android/src/main/java/io/package/reactnative/PushModule.kt.twig Imports Push classes from the React Native-specific package.
tests/generation/GenerationTest.php Checks that generated Android, Flutter, and React Native Kotlin classes do not collide.
tests/e2e/FlutterStableTest.php Copies the Flutter-specific generated package into the Robolectric test project.
tests/e2e/ReactNativeAndroidTest.php Copies the React Native-specific generated package into the Robolectric test project.
tests/e2e/languages/flutter/android-test/Tests.kt Uses Flutter-specific Push imports and broadcast action in native e2e coverage.
tests/e2e/languages/react-native/android-test/Tests.kt Uses React Native-specific Push imports and broadcast action in native e2e coverage.

Merged main (52ebead); no changes to this PR's code since 30f7761 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Tier S · Looks good to merge. Summary

…ve e2e

The Robolectric projects copied the plugin's Android sources from io/appwrite/services and io/appwrite/exceptions, and imported and broadcast with the old package names.
…kages

# Conflicts:
#	tests/generation/GenerationTest.php
@ChiragAgg5k
ChiragAgg5k merged commit dec4730 into main Oct 15, 2026
61 checks passed
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.

Move the embedded Android Push code to its own package

1 participant