Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/flutter_inapp_purchase/lib/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ extension AndroidReplacementModeValue on AndroidReplacementMode {
return 2;
case AndroidReplacementMode.withoutProration:
return 3;
case AndroidReplacementMode.deferred:
return 4;
case AndroidReplacementMode.chargeFullPrice:
return 4;
case AndroidReplacementMode.deferred:
return 5;
Comment on lines 170 to 173

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Sync dependent tests/examples with this new mapping to prevent drift.

Lines 170-173 switch chargeFullPrice/deferred values, but existing references still encode the previous mapping (chargeFullPrice=5, deferred=4). Please update those usages in the same PR to avoid failing tests and contradictory sample behavior.

Suggested follow-up updates
--- a/libraries/flutter_inapp_purchase/test/enums_unit_test.dart
+++ b/libraries/flutter_inapp_purchase/test/enums_unit_test.dart
@@
-    expect(AndroidReplacementMode.chargeFullPrice.value, 5);
+    expect(AndroidReplacementMode.chargeFullPrice.value, 4);
+    expect(AndroidReplacementMode.deferred.value, 5);
--- a/libraries/flutter_inapp_purchase/example/lib/src/screens/subscription_flow_screen.dart
+++ b/libraries/flutter_inapp_purchase/example/lib/src/screens/subscription_flow_screen.dart
@@
-    'Deferred': 4,
-    'Immediate and Charge Full Price': 5,
+    'Immediate and Charge Full Price': 4,
+    'Deferred': 5,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libraries/flutter_inapp_purchase/lib/enums.dart` around lines 170 - 173, The
enum-to-integer mapping for AndroidReplacementMode was swapped
(AndroidReplacementMode.chargeFullPrice now returns 4 and
AndroidReplacementMode.deferred returns 5); find all dependent tests, examples,
and any serialization/deserialization code that reference the old numeric values
(search for literal usages of 4 and 5 tied to AndroidReplacementMode, usages of
AndroidReplacementMode.chargeFullPrice or AndroidReplacementMode.deferred in
tests/examples) and update them to match the new mapping so chargeFullPrice maps
to 4 and deferred maps to 5, ensuring assertions, fixtures, and sample data are
adjusted accordingly.

}
}
Expand Down