diff --git a/lib/data/analytics/analytics.dart b/lib/data/analytics/analytics.dart index 94b7550..1bd6496 100644 --- a/lib/data/analytics/analytics.dart +++ b/lib/data/analytics/analytics.dart @@ -25,10 +25,10 @@ class LightmeterAnalytics { ); } - Future logProFeaturesPurchaseAttempt(String purchaseButtonText) async { + Future logUnlockProFeatures(String listTileTitle) async { return logEvent( LightmeterAnalyticsEvent.unlockProFeatures, - parameters: {"purchaseButtonText": purchaseButtonText}, + parameters: {"listTileTitle": listTileTitle}, ); } } diff --git a/lib/screens/settings/components/lightmeter_pro/components/buy_pro/widget_list_tile_buy_pro.dart b/lib/screens/settings/components/lightmeter_pro/components/buy_pro/widget_list_tile_buy_pro.dart index 986a7ef..5f8adcd 100644 --- a/lib/screens/settings/components/lightmeter_pro/components/buy_pro/widget_list_tile_buy_pro.dart +++ b/lib/screens/settings/components/lightmeter_pro/components/buy_pro/widget_list_tile_buy_pro.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/data/models/feature.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/providers/remote_config_provider.dart'; +import 'package:lightmeter/providers/services_provider.dart'; import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/settings/components/utils/show_buy_pro_dialog.dart'; import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; @@ -11,17 +12,17 @@ class BuyProListTile extends StatelessWidget { @override Widget build(BuildContext context) { + final unlockFeaturesEnabled = RemoteConfig.isEnabled(context, Feature.unlockProFeaturesText); final status = IAPProducts.productOf(context, IAPProductType.paidFeatures)?.status; final isPending = status == IAPProductStatus.purchased || status == null; return ListTile( leading: const Icon(Icons.star), - title: Text( - RemoteConfig.isEnabled(context, Feature.unlockProFeaturesText) - ? S.of(context).unlockProFeatures - : S.of(context).buyLightmeterPro, - ), + title: Text(unlockFeaturesEnabled ? S.of(context).unlockProFeatures : S.of(context).buyLightmeterPro), onTap: () { showBuyProDialog(context); + ServicesProvider.of(context) + .analytics + .logUnlockProFeatures(unlockFeaturesEnabled ? 'Unlock Pro features' : 'Buy Lightmeter Pro'); }, trailing: isPending ? const SizedBox( diff --git a/lib/screens/settings/components/utils/show_buy_pro_dialog.dart b/lib/screens/settings/components/utils/show_buy_pro_dialog.dart index 8460397..50edbd1 100644 --- a/lib/screens/settings/components/utils/show_buy_pro_dialog.dart +++ b/lib/screens/settings/components/utils/show_buy_pro_dialog.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/data/models/feature.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/providers/remote_config_provider.dart'; -import 'package:lightmeter/providers/services_provider.dart'; import 'package:lightmeter/res/dimens.dart'; import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; @@ -30,9 +29,6 @@ Future showBuyProDialog(BuildContext context) { onPressed: () { Navigator.of(context).pop(); IAPProductsProvider.of(context).buy(IAPProductType.paidFeatures); - ServicesProvider.of(context) - .analytics - .logProFeaturesPurchaseAttempt(unlockFeaturesEnabled ? "Unlock" : "Buy"); }, child: Text(unlockFeaturesEnabled ? S.of(context).unlock : S.of(context).buy), ),