log list tile tap instead of dialog

This commit is contained in:
Vadim 2023-10-30 17:46:27 +01:00
parent 690badccd2
commit 822ba8c7f8
3 changed files with 8 additions and 11 deletions

View file

@ -25,10 +25,10 @@ class LightmeterAnalytics {
);
}
Future<void> logProFeaturesPurchaseAttempt(String purchaseButtonText) async {
Future<void> logUnlockProFeatures(String listTileTitle) async {
return logEvent(
LightmeterAnalyticsEvent.unlockProFeatures,
parameters: {"purchaseButtonText": purchaseButtonText},
parameters: {"listTileTitle": listTileTitle},
);
}
}

View file

@ -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(

View file

@ -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<void> 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),
),