mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 17:00:39 +00:00
log list tile tap instead of dialog
This commit is contained in:
parent
690badccd2
commit
822ba8c7f8
3 changed files with 8 additions and 11 deletions
|
@ -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},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue