Skip to content

Commit 5c40c00

Browse files
Releases/6.x.x/6.17.x/6.17.1 rc1 (#407)
* Purchase connector for flutter * runOnUi * Nullable * handle callbacks * ui thread callback * swift bridge file * register callback * docs * fixed the issue with MediationNetwork enums on Android - added a usage example of the api for testing. * This should fix the NullPointerException * Delivery 76214/update purchase connector version (#363) * bumped up PC versions * set back ios version * adding a note on the supported StoreKit to docs * typo fix * Squashed commit of the following: commit fa71c23 Merge: f420460 4f4ee27 Author: Dani-Koza-AF <[email protected]> Date: Thu Oct 31 15:16:50 2024 +0200 Merge remote-tracking branch 'origin/development' into development commit f420460 Author: Dani Koza <[email protected]> Date: Wed Oct 30 15:50:41 2024 +0200 Releases/6.x.x/6.15.x/6.15.2 rc1 (#358) * fixed the issue with MediationNetwork enums on Android * Added a usage example of the logAdRevenue api for testing. * Fix to the NullPointerException some clients face. * Versioning and change log commit 4f4ee27 Merge: a58a49b 25fb530 Author: Dani Koza <[email protected]> Date: Wed Oct 30 14:47:17 2024 +0200 Merge pull request #357 from AppsFlyerSDK/DELIVERY-63011/fix-android-null-pointer-exception This should fix the NullPointerException commit 25fb530 Author: Dani-Koza-AF <[email protected]> Date: Wed Oct 30 14:26:26 2024 +0200 This should fix the NullPointerException commit a58a49b Merge: 6213341 b85b1a4 Author: Dani-Koza-AF <[email protected]> Date: Mon Oct 28 12:30:10 2024 +0200 Merge remote-tracking branch 'origin/development' into development commit b85b1a4 Merge: 82764a4 6529458 Author: Dani Koza <[email protected]> Date: Mon Oct 28 12:15:32 2024 +0200 Merge pull request #353 from AppsFlyerSDK/dev/DELIVERY-71973/mediation-network-value-fix Fixed the issue with MediationNetwork enums on Android commit 6529458 Author: Dani-Koza-AF <[email protected]> Date: Sun Oct 27 17:47:00 2024 +0200 fixed the issue with MediationNetwork enums on Android - added a usage example of the api for testing. commit 6213341 Merge: 3272d7e 82764a4 Author: Dani-Koza-AF <[email protected]> Date: Wed Sep 4 15:51:28 2024 +0300 Merge pull request #338 from AppsFlyerSDK/releases/6.x.x/6.15.x/6.15.1-rc1 Releases/6.x.x/6.15.x/6.15.1 rc1 commit 82764a4 Merge: 3272d7e 6b76d63 Author: Dani-Koza-AF <[email protected]> Date: Wed Sep 4 15:15:03 2024 +0300 Merge pull request #337 from AppsFlyerSDK/dev/DELIVERY-67805/Update-Plugin-to-v6.15.1 Update plugin to v6.15.1 commit 6b76d63 Author: Dani-Koza-AF <[email protected]> Date: Wed Sep 4 15:13:04 2024 +0300 Added missing info in docs commit e7d4dc6 Author: Dani-Koza-AF <[email protected]> Date: Wed Sep 4 14:17:28 2024 +0300 Added documentation commit 9f90c8e Author: Dani-Koza-AF <[email protected]> Date: Tue Sep 3 17:48:33 2024 +0300 Improvement of Android side impl commit 079ccad Author: Dani-Koza-AF <[email protected]> Date: Tue Sep 3 17:22:48 2024 +0300 iOS side impl - Helper func to get the correct enum properly. - requireNonNullArgumentWithCall to make sure we actually get the arguments. - Lots of null safety checks due to testing failures encountered. commit 4a3a0d6 Author: Dani-Koza-AF <[email protected]> Date: Mon Sep 2 14:48:30 2024 +0300 Android side impl - Flutter didn't like the fact that we pass enums, had to change mediation network to String, handled later on native side. - Added an helper method to ensure null safety, hopefully will be embraced by other method in the future. commit d74054e Author: Dani-Koza-AF <[email protected]> Date: Sun Sep 1 16:43:24 2024 +0300 flutter side impl - New Enum introduced. - New API logAdRevenue. - New AdRevenueData class. - Upgraded Dart SDK versions limits a bit to start from 2.17.0 . commit 3272d7e Merge: 95a4348 248dcf5 Author: liaz-af <[email protected]> Date: Mon Aug 19 22:35:24 2024 +0300 Merge pull request #336 from dori-af/dori/udl-note Deep link UDL - added a note commit 248dcf5 Author: Dori Frost <[email protected]> Date: Sun Aug 18 16:35:07 2024 +0300 Deep link UDL - added a note Per Slack: https://appsflyer.slack.com/archives/C5RDRS58X/p1723186908673099 * closing potential memory leaks * removed duplicated declarations = * updated example project dependencies Aligned Flutter's Android compileOptions to AppsFlyer's Android SDK. * Push notification data collection documentation updates (#381) * updated BasicIntegration.md * docs: updated push notification API's * reverting addition of PC * post revert fixes * lint * Fixes of tests and typos * Dev/update manual consent api (#383) New consent api and more - setConsentData is now deprecated. - setConsentDataV2 is the new and recommended way to set manual user consent. - Add getVersionNumber api, returns the plugin version. - version bumps. - typos fix. - doc updates. - bug fix. * fixed Locale issue by forcing toUpperCase(Locale.ENGLISH) (#395) - Expanded the unit–tests to verify not only that the right native method is invoked, but also that the correct arguments are passed. * Doc fix (#400) doc fix - broken link * Add purchase connector to development branch (#402) * removed duplicated declaration * Update .gitignore for purchase connector feature * Add complete Purchase Connector implementation - Add Purchase Connector support for Android and iOS platforms - Implement conditional compilation with include/exclude source sets - Add comprehensive Dart API with type-safe models - Include platform-specific error handling and validation - Add Purchase Connector documentation - Support for both in-app purchases and subscriptions - Zero impact when disabled via gradle/podfile flags New files: - Complete lib/src/purchase_connector/ Dart implementation - Android: include/exclude-connector source sets with ConnectorWrapper - iOS: PurchaseConnectorPlugin.swift with conditional compilation - Documentation: PurchaseConnector.md Modified integration points: - Android: build.gradle, AppsflyerSdkPlugin.java - iOS: appsflyer_sdk.podspec with subspecs architecture - Flutter: appsflyer_sdk.dart main export file * Complete Purchase Connector integration with code generation - Add missing Purchase Connector constants and AFMediationNetwork enum - Update pubspec.yaml with required dependencies (json_annotation, build_runner, json_serializable) - Generate JSON serialization code for all Purchase Connector models - Fix all compilation errors and undefined references - All 39 tests passing ✅ - Purchase Connector fully functional with type-safe models Generated files: - lib/appsflyer_sdk.g.dart - JSON serialization support - All Purchase Connector model serialization methods Dependencies added: - json_annotation: ^4.9.0 (already present) - build_runner: ^2.3.0 - json_serializable: ^6.5.4 * setting the proper SDK versions * documentation small fix * restore and solve code conflicts and ghost code Aligned with development * Immediate actions to prevent NullPointerExceptions (#403) 1. Fixed startSDKwithHandler() method: Null checks moved inside lambda execution 2. Fixed runOnUIThread() method: Added null check for mCallbackChannel. 3. Immediately return initSdk method when dev key is missing. * Latest release updates - Docs + new API for Android (#406) * add disableAppSetId() method for AppSet ID opt-out * added a simple test for the new api * docs * another doc update * documents fix lint * doc lint * doc * doc fix * last time doc fix * docs * rules for cursor * Fix Android Purchase Connector compilation issue - Add missing AF_PURCHASE_CONNECTOR_CHANNEL and all Purchase Connector constants to Android AppsFlyerConstants.java - Update Android plugin version to 6.17.1 - Resolves 'Unresolved reference: AF_PURCHASE_CONNECTOR_CHANNEL' error when appsflyer.enable_purchase_connector=true Issue: Kotlin code was referencing constants that only existed in Dart file but not in Android Java constants file. * Attempt to fix iOS * missing constant usage added * logging added to find out problems * trying to fix iOS * all works now, manual test passed --------- Co-authored-by: Paz Lavi <[email protected]>
1 parent a848b2e commit 5c40c00

38 files changed

+2749
-117
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
description: Flutter & Federated‑Plugin Development Guidelines
3+
alwaysApply: true
4+
---
5+
6+
## 1. Flutter Best Practices (App + Plugin)
7+
8+
- Adapt to existing project architecture while maintaining clean‑code principles
9+
- Use Flutter 3.x features and Material 3 design
10+
- Implement clean architecture with the BLoC pattern
11+
- Follow proper state‑management principles
12+
- Use dependency injection where appropriate
13+
- Implement robust error handling
14+
- Follow platform‑specific design guidelines
15+
- Apply proper localization techniques
16+
- Provide a minimal, null‑safe Dart API surface that hides platform details
17+
- Follow the federated‑plugin model (`platform_interface`, `+android`, `+ios` packages)
18+
- Keep native code idiomatic for each platform (Kotlin/Swift/Obj‑C/Java/C·++)
19+
- Expose asynchronous APIs via `Future`s/`Stream`s that map 1‑to‑1 with platform callbacks
20+
- Use Pigeon or FFI when type safety or performance warrants it
21+
- Guard platform‑specific calls with `Platform.isX` checks
22+
- Publish clear documentation and an `example/` app that runs on all supported platforms
23+
24+
## 2. Reference Project Structure
25+
26+
packages/
27+
my_plugin/ # Public‑facing federated plugin
28+
lib/
29+
src/
30+
my_plugin.dart
31+
android/ # Kotlin (preferred) or Java
32+
src/main/kotlin/…/
33+
ios/ # Swift (preferred) or Obj‑C
34+
Classes/…/
35+
pigeon/ # *.dart pigeon files (if used)
36+
pubspec.yaml
37+
CHANGELOG.md
38+
my_plugin_platform_interface/ # Pure‑Dart platform interface
39+
my_plugin_android/ # Android‑only implementation (if federated)
40+
my_plugin_ios/ # iOS‑only implementation (if federated)
41+
example/ # Runnable demo + integration tests
42+
lib/
43+
android/
44+
ios/
45+
tools/ # Scripts: CI, code‑gen, coverage
46+
47+
## 3. Coding Guidelines
48+
49+
1. Use null‑safety throughout Dart; match Kotlin/Swift nullability annotations.
50+
2. Keep the **platform_interface** API minimal; annotate internal items with `@visibleForTesting`.
51+
3. Convert platform exceptions to Dart errors using an `Either`/sealed‑result pattern.
52+
4. Follow semantic versioning; bump **MAJOR** for breaking Dart *or* native API changes.
53+
5. Name `MethodChannel` constants `<plugin>.methods` and `EventChannel` constants `<plugin>.events`.
54+
6. Document every public method with a platform‑support table (✓ / ✗ for Android, iOS, Web, macOS, …).
55+
7. Use Gradle Version Catalog (`libs.versions.toml`) and Swift Package Manager to pin native SDKs.
56+
8. Keep Android `minSdk`/`compileSdk` and iOS deployment target in sync with Flutter stable.
57+
9. Provide dart‑doc examples and link to the example app for each API.
58+
10. Practise TDD on both Dart and native sides (unit + integration).
59+
60+
## 4. Widget Guidelines (for the example app)
61+
62+
- Keep widgets small and focused
63+
- Use `const` constructors when possible
64+
- Supply meaningful widget keys
65+
- Follow sound layout principles
66+
- Respect widget lifecycle methods
67+
- Provide error boundaries
68+
- Optimise with `const`/memoisation where feasible
69+
- Meet accessibility requirements
70+
71+
## 5. Performance Guidelines
72+
73+
1. Cache images; move heavy work off the main isolate.
74+
2. Optimise `ListView`/sliver usage with `itemExtent`, `addAutomaticKeepAlives`, `cacheExtent`.
75+
3. Minimise rebuilds via selective BLoC updates or `ValueListenableBuilder`s.
76+
4. Avoid `MethodChannel` calls inside `build()`; batch or cache native look‑ups.
77+
5. Prefer FFI for high‑frequency calls; benchmark against `MethodChannel`.
78+
6. Initialise native SDKs lazily on first API call.
79+
7. Shrink Android dependencies (R8) and strip unused ABIs; enable dead‑code stripping on iOS.
80+
8. Use compile‑time flags such as `-O3` and `--split-debug-info`.
81+
82+
## 6. Testing Guidelines
83+
84+
1. Write Dart unit tests for business logic (`platform_interface` + pure‑Dart code).
85+
2. Provide widget tests for UI in the example app.
86+
3. Add **integration_test** runs on Android emulator and iOS simulator in CI.
87+
4. Generate `MethodChannel` mocks with Mockito or Pigeon test stubs.
88+
5. On Android, add instrumentation tests to verify native SDK initialisation.
89+
6. On iOS, add XCTests to confirm plugin registration through the registrar.
90+
7. Maintain ≥ 80 % combined line coverage; block PRs that drop coverage.
91+
8. Use test names like `<ClassUnderTest>_<behavior>_<expected>`.
92+
9. Automate CI workflows for PR, release, and pub.dev/GitHub publishing.
93+
94+
## 7. Distribution & Maintenance
95+
96+
- Run `dart pub publish --dry-run` in CI before tagging.
97+
- Maintain a clear **CHANGELOG.md** grouped by *Added* / *Fixed* / *BREAKING*.
98+
- Align Git tags (`vX.Y.Z`) with `pubspec.yaml` version.
99+
- Show README badges: pub points, popularity, likes, CI status.
100+
- Support both CocoaPods and Swift Package Manager (if applicable); document set‑up steps.
101+
- If applicable, publish an AGP plugin to the Gradle Plugin Portal.
102+
- Enforce `dart format`, `swiftformat`, `ktlint` in pre‑commit hooks.
103+
- Audit licenses; include a `NOTICE` file when bundling third‑party code.
104+
105+
## 8. Platform Channel Design
106+
107+
1. Prefer **Pigeon** for compile‑time safety; otherwise use `MethodChannel`/`EventChannel`.
108+
2. Name channels uniquely in lower‑case: `com.company.plugin/methods`.
109+
3. Do not pass large binary blobs through channels; use files or FFI.
110+
4. Specify threading expectations—return results on the main/current isolate.
111+
5. Map native error codes to dedicated Dart `Exception` subclasses.
112+
6. When streaming via `EventChannel`, honour back‑pressure.
113+
7. Keep DTOs JSON‑serialisable with explicit schema versioning.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ example/web/*
107107

108108
example/android/app/.cxx
109109

110+
example/android/app/.cxx/*
111+
110112
example/\.metadata
111113
example/analysis_options.yaml
112114

113-
114115
node_modules/
115116

116117
covBadgeGen.js

0 commit comments

Comments
 (0)