Skip to content

Commit ac9fa29

Browse files
authored
feat!: 6.0.0 Major Refactoring - Complete Breaking Changes (#510)
## 🚀 Summary Major refactoring for flutter_inapp_purchase v6.0.0 with complete breaking changes to improve type safety, code organization, and developer experience. ## 💥 BREAKING CHANGES ### File Structure - Moved all enums from `types.dart` to new `enums.dart` file - Renamed `Store.dart` to `enums.dart` for consistency - Split module-specific code into separate files: - `modules/android.dart` for Android-specific functionality - `modules/ios.dart` for iOS-specific functionality - Created dedicated type files: - `types/iap_android_types.dart` - `types/iap_ios_types.dart` ### Type Safety Improvements - Fixed all `List<dynamic>?` warnings with explicit type annotations - Added explicit `Future<dynamic>` return types where applicable - Fixed all type inference issues with explicit parameter types - Improved null safety throughout the codebase ### Removed Deprecated APIs - Removed unused `_finishTransactionIOSOld` method - Cleaned up deprecated methods scheduled for removal in v6.0.0 ### Error Handling - Created new `utils/error_mapping.dart` for centralized error handling - Improved error type definitions and mapping ## ✨ New Features - Added `use_iap.dart` hook for Flutter Hooks integration - Better separation of concerns with module-specific files - Improved type definitions for Android and iOS platforms ## 📝 Migration Guide ### Import Changes ```dart // Before import 'package:flutter_inapp_purchase/Store.dart'; import 'package:flutter_inapp_purchase/types.dart'; // After import 'package:flutter_inapp_purchase/enums.dart'; import 'package:flutter_inapp_purchase/types.dart'; ``` ### Enum Usage All enums are now imported from `enums.dart`. The `types.dart` file exports `enums.dart` for backward compatibility, but direct imports are recommended. ### Platform-Specific Code ```dart // Android-specific import 'package:flutter_inapp_purchase/modules/android.dart'; // iOS-specific import 'package:flutter_inapp_purchase/modules/ios.dart'; ``` ## 🧪 Test Plan - [x] All existing tests pass - [x] Type checking passes without warnings - [x] Example app runs correctly on both platforms - [ ] Migration from v5.x works as documented ## 📊 Impact This is a major version bump (v6.0.0) with extensive breaking changes. All users will need to update their code when upgrading. Closes #505 #507 #503 #501 #500 #496 #495 #494 #491 #482
1 parent e99bce0 commit ac9fa29

File tree

95 files changed

+15260
-4330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+15260
-4330
lines changed

.claude/settings.local.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
pubspec.lock
77

88
build/
9+
.claude/
910

10-
# dooboolab
1111
.idea/
1212
flutter_inapp.iml
1313
flutter_inapp_android.iml

.pubignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Documentation site (not needed for pub.dev)
2+
3+
docs/
4+
5+
# Development files
6+
7+
.vscode/
8+
.claude/
9+
10+
# CI/CD files
11+
12+
.github/
13+
14+
# Example app
15+
16+
example/
17+
18+
# Test files
19+
20+
test/

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Editor settings
33
"editor.formatOnSave": true,
44
"editor.codeActionsOnSave": {
5-
"source.fixAll": true
5+
"source.fixAll": "explicit"
66
},
77

88
// Dart & Flutter settings
@@ -13,7 +13,7 @@
1313
"editor.suggest.snippetsPreventQuickSuggestions": false,
1414
"editor.suggestSelection": "first",
1515
"editor.tabCompletion": "onlySnippets",
16-
"editor.wordBasedSuggestions": false
16+
"editor.wordBasedSuggestions": "off"
1717
},
1818

1919
// Files to exclude from explorer
@@ -62,5 +62,5 @@
6262
// Docusaurus specific
6363
"typescript.tsdk": "docs/node_modules/typescript/lib",
6464
"npm.packageManager": "npm",
65-
"cSpell.words": ["inapp"]
65+
"cSpell.words": ["inapp", "Inapp"]
6666
}

CHANGELOG.md

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,103 @@
1+
## 6.0.0-rc.1
2+
3+
### Release Candidate
4+
5+
This is a release candidate for v6.0.0 with significant breaking changes. Please test thoroughly before using in production.
6+
7+
### Package Changes
8+
9+
- **Package**: Changed package name from `dev.hyochan.flutterinapppurchase` to `dev.hyo.flutterinapppurchase`
10+
- **Documentation**: Moved from `docs/` to `doc/` directory for pub.dev convention
11+
- **Version**: First release candidate for v6.0.0 major version
12+
13+
### Breaking Changes
14+
15+
- **iOS**: Now requires iOS 11.0+ (previously 8.0+)
16+
- **iOS**: StoreKit 2 is now used by default on iOS 15.0+ devices
17+
- **Android**: Updated to Billing Client v8.0.0 (from v6.0.1)
18+
- **API**: Complete refactoring of class structure and enum naming conventions
19+
- `ErrorCode` enum values changed from `E_UNKNOWN` to `eUnknown` (lowerCamelCase)
20+
- `PeriodUnitIOS` enum values changed from `DAY` to `day` (lowerCamelCase)
21+
- Platform-specific classes moved to mixins (`FlutterInappPurchaseIOS`, `FlutterInappPurchaseAndroid`)
22+
- Channel access changed from static to instance member
23+
24+
### New Features
25+
26+
- **iOS**: Full StoreKit 2 support for iOS 15.0+
27+
- Automatic transaction verification
28+
- Better subscription management
29+
- Improved error handling
30+
- No receipt validation needed for StoreKit 2
31+
- **iOS**: Automatic fallback to StoreKit 1 for iOS 11.0-14.x
32+
- **Android**: Support for all Billing Client v8 features
33+
- **Architecture**: New mixin-based architecture for better code organization
34+
- Platform-specific code separated into `modules/ios.dart` and `modules/android.dart`
35+
- Improved testability and maintainability
36+
37+
### Migration Guide
38+
39+
- Update all `ErrorCode` references:
40+
```dart
41+
// Before
42+
ErrorCode.E_USER_CANCELLED
43+
// After
44+
ErrorCode.eUserCancelled
45+
```
46+
- Update channel access in tests:
47+
```dart
48+
// Before
49+
FlutterInappPurchase.channel
50+
// After
51+
FlutterInappPurchase.instance.channel
52+
```
53+
- StoreKit 2 will be used automatically on supported devices
54+
- StoreKit Configuration files (.storekit) work with StoreKit 2 on iOS 15+
55+
56+
## 6.0.0
57+
58+
### Breaking Changes
59+
60+
- **iOS**: Now requires iOS 11.0+ (previously 8.0+)
61+
- **iOS**: StoreKit 2 is now used by default on iOS 15.0+ devices
62+
- **Android**: Updated to Billing Client v8.0.0 (from v6.0.1)
63+
- **API**: Complete refactoring of class structure and enum naming conventions
64+
- `ErrorCode` enum values changed from `E_UNKNOWN` to `eUnknown` (lowerCamelCase)
65+
- `PeriodUnitIOS` enum values changed from `DAY` to `day` (lowerCamelCase)
66+
- Platform-specific classes moved to mixins (`FlutterInappPurchaseIOS`, `FlutterInappPurchaseAndroid`)
67+
- Channel access changed from static to instance member
68+
69+
### New Features
70+
71+
- **iOS**: Full StoreKit 2 support for iOS 15.0+
72+
- Automatic transaction verification
73+
- Better subscription management
74+
- Improved error handling
75+
- No receipt validation needed for StoreKit 2
76+
- **iOS**: Automatic fallback to StoreKit 1 for iOS 11.0-14.x
77+
- **Android**: Support for all Billing Client v8 features
78+
- **Architecture**: New mixin-based architecture for better code organization
79+
- Platform-specific code separated into `modules/ios.dart` and `modules/android.dart`
80+
- Improved testability and maintainability
81+
82+
### Migration Guide
83+
84+
- Update all `ErrorCode` references:
85+
```dart
86+
// Before
87+
ErrorCode.E_USER_CANCELLED
88+
// After
89+
ErrorCode.eUserCancelled
90+
```
91+
- Update channel access in tests:
92+
```dart
93+
// Before
94+
FlutterInappPurchase.channel
95+
// After
96+
FlutterInappPurchase.instance.channel
97+
```
98+
- StoreKit 2 will be used automatically on supported devices
99+
- StoreKit Configuration files (.storekit) work with StoreKit 2 on iOS 15+
100+
1101
## 5.6.2
2102

3103
- fix: removed references to deprecated v1 Android embedding by @moodstubos in https://github.com/hyochan/flutter_inapp_purchase/pull/497
@@ -438,4 +538,4 @@ Republishing since sourcode seems not merged correctly.
438538
## 0.1.0
439539

440540
- Initial release of beta
441-
- Moved code from [react-native-iap](https://github.com/dooboolab/react-native-iap)
541+
- Moved code from [react-native-iap](https://github.com/hyochan/react-native-iap)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 dooboolab
3+
Copyright (c) 2025 hyochan
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Package.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "flutter_inapp_purchase",
8+
platforms: [
9+
.iOS("12.0")
10+
],
11+
products: [
12+
.library(name: "flutter-inapp-purchase", targets: ["flutter_inapp_purchase"])
13+
],
14+
dependencies: [],
15+
targets: [
16+
.target(
17+
name: "flutter_inapp_purchase",
18+
dependencies: [],
19+
path: "ios/Classes",
20+
resources: [
21+
.process("../Assets")
22+
],
23+
publicHeadersPath: "",
24+
cSettings: [
25+
.headerSearchPath("../Flutter"),
26+
.headerSearchPath("../../../Flutter/Export")
27+
]
28+
)
29+
]
30+
)

0 commit comments

Comments
 (0)