mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 00:10:47 +00:00
added price to IAPProduct
This commit is contained in:
parent
bae5ead8f0
commit
26a9dd05d3
13 changed files with 34 additions and 5 deletions
|
@ -9,15 +9,18 @@ enum IAPProductType { paidFeatures }
|
|||
class IAPProduct {
|
||||
final String storeId;
|
||||
final IAPProductStatus status;
|
||||
final String price;
|
||||
|
||||
const IAPProduct({
|
||||
required this.storeId,
|
||||
this.status = IAPProductStatus.purchasable,
|
||||
required this.price,
|
||||
});
|
||||
|
||||
IAPProduct copyWith({IAPProductStatus? status}) => IAPProduct(
|
||||
storeId: storeId,
|
||||
status: status ?? this.status,
|
||||
price: price,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class IAPProductsProviderState extends State<IAPProductsProvider> {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: IAPProductStatus.purchased,
|
||||
price: '0.0\$',
|
||||
)
|
||||
],
|
||||
child: widget.child,
|
||||
|
|
|
@ -27,6 +27,7 @@ class MockIAPProductsProviderState extends State<MockIAPProductsProvider> {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: _purchased ? IAPProductStatus.purchased : IAPProductStatus.purchasable,
|
||||
price: '0.0\$',
|
||||
),
|
||||
]),
|
||||
child: widget.child,
|
||||
|
|
|
@ -107,6 +107,15 @@
|
|||
"unlockProFeatures": "Unlock Pro features",
|
||||
"unlockProFeaturesDescription": "Unlock professional features:\n \u2022 Equipment profiles containing filters for aperture, shutter speed, and more\n \u2022 List of films with compensation for what's known as reciprocity failure\n \u2022 Spot metering & Histogram\n \u2022 And more!\n\nBy unlocking Pro features you support the development and make it possible to add new features to the app.",
|
||||
"unlock": "Unlock",
|
||||
"proFeaturesSupportText": "By purchasing you support the development and make it possible to add new features to the app.",
|
||||
"unlockFor": "Unlock for {price}",
|
||||
"@unlockFor": {
|
||||
"price": {
|
||||
"version": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tooltipAdd": "Add",
|
||||
"tooltipClose": "Close",
|
||||
"tooltipExpand": "Expand",
|
||||
|
|
|
@ -25,7 +25,13 @@ Future<void> runLightmeterApp(Environment env) async {
|
|||
runApp(
|
||||
env.buildType == BuildType.dev
|
||||
? IAPProducts(
|
||||
products: [IAPProduct(storeId: IAPProductType.paidFeatures.storeId)],
|
||||
products: [
|
||||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: IAPProductStatus.purchasable,
|
||||
price: '0.0\$',
|
||||
),
|
||||
],
|
||||
child: application,
|
||||
)
|
||||
: IAPProductsProvider(
|
||||
|
|
|
@ -52,7 +52,7 @@ class ProFeaturesDialog extends StatelessWidget {
|
|||
IAPProductsProvider.maybeOf(context)?.buy(IAPProductType.paidFeatures);
|
||||
});
|
||||
},
|
||||
child: Text(S.of(context).unlock),
|
||||
child: Text(S.of(context).unlockFor(IAPProducts.productOf(context, IAPProductType.paidFeatures)!.price)),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -91,6 +91,7 @@ class _GoldenTestApplicationMockState extends State<GoldenTestApplicationMock> {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: widget.productStatus,
|
||||
price: '0.0\$',
|
||||
),
|
||||
],
|
||||
child: ApplicationWrapper(
|
||||
|
|
|
@ -26,6 +26,7 @@ void main() {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: productStatus,
|
||||
price: '0.0\$',
|
||||
),
|
||||
],
|
||||
child: EquipmentProfileProvider(
|
||||
|
|
|
@ -26,6 +26,7 @@ void main() {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: productStatus,
|
||||
price: '0.0\$',
|
||||
),
|
||||
],
|
||||
child: FilmsProvider(
|
||||
|
|
|
@ -28,6 +28,7 @@ void main() {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: IAPProductStatus.purchased,
|
||||
price: '0.0\$',
|
||||
),
|
||||
],
|
||||
child: EquipmentProfileProvider(
|
||||
|
|
|
@ -27,6 +27,7 @@ void main() {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: IAPProductStatus.purchased,
|
||||
price: '0.0\$',
|
||||
),
|
||||
],
|
||||
child: FilmsProvider(
|
||||
|
|
|
@ -28,6 +28,7 @@ void main() {
|
|||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
status: IAPProductStatus.purchased,
|
||||
price: '0.0\$',
|
||||
),
|
||||
],
|
||||
child: EquipmentProfileProvider(
|
||||
|
|
|
@ -7,6 +7,8 @@ import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
|||
|
||||
import '../../../application_mock.dart';
|
||||
|
||||
const _price = '0.0\$';
|
||||
|
||||
void main() {
|
||||
Future<void> pumpApplication(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
|
@ -14,6 +16,7 @@ void main() {
|
|||
products: [
|
||||
IAPProduct(
|
||||
storeId: IAPProductType.paidFeatures.storeId,
|
||||
price: _price,
|
||||
),
|
||||
],
|
||||
child: const WidgetTestApplicationMock(
|
||||
|
@ -33,9 +36,9 @@ void main() {
|
|||
expect(find.byType(TransparentDialog), findsOneWidget);
|
||||
expect(find.text(S.current.proFeatures), findsNWidgets(2));
|
||||
expect(find.text(S.current.cancel), findsOneWidget);
|
||||
expect(find.text(S.current.unlock), findsOneWidget);
|
||||
expect(find.text(S.current.unlockFor(_price)), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text(S.current.unlock));
|
||||
await tester.tap(find.text(S.current.unlockFor(_price)));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(TransparentDialog), findsNothing);
|
||||
},
|
||||
|
@ -50,7 +53,7 @@ void main() {
|
|||
expect(find.byType(TransparentDialog), findsOneWidget);
|
||||
expect(find.text(S.current.proFeatures), findsNWidgets(2));
|
||||
expect(find.text(S.current.cancel), findsOneWidget);
|
||||
expect(find.text(S.current.unlock), findsOneWidget);
|
||||
expect(find.text(S.current.unlockFor(_price)), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text(S.current.cancel));
|
||||
await tester.pumpAndSettle();
|
||||
|
|
Loading…
Reference in a new issue