log product id for IAP errors

This commit is contained in:
Vadim 2024-01-27 21:53:58 +01:00
parent 210de80bd7
commit 4bfbf5d4fd
4 changed files with 16 additions and 1 deletions

View file

@ -49,4 +49,6 @@ class LightmeterAnalytics {
information: information,
);
}
Future<void> setCustomKey(String key, String value) async => _api.setCustomKey(key, value);
}

View file

@ -10,4 +10,6 @@ abstract class ILightmeterAnalyticsApi {
dynamic reason,
Iterable<Object> information = const [],
});
Future<void> setCustomKey(String key, String value);
}

View file

@ -39,4 +39,9 @@ class LightmeterAnalyticsFirebase implements ILightmeterAnalyticsApi {
fatal: true,
);
}
@override
Future<void> setCustomKey(String key, String value) async {
await FirebaseCrashlytics.instance.setCustomKey(key, value);
}
}

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/services_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart';
import 'package:lightmeter/screens/shared/transparent_dialog/widget_dialog_transparent.dart';
@ -44,7 +45,12 @@ class ProFeaturesDialog extends StatelessWidget {
),
FilledButton(
onPressed: () {
_close(context).then((_) => IAPProductsProvider.maybeOf(context)?.buy(IAPProductType.paidFeatures));
_close(context).then((_) {
ServicesProvider.of(context)
.analytics
.setCustomKey('iap_product_type', IAPProductType.paidFeatures.storeId);
IAPProductsProvider.maybeOf(context)?.buy(IAPProductType.paidFeatures);
});
},
child: Text(S.of(context).unlock),
),