mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 01:10: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(
|
return logEvent(
|
||||||
LightmeterAnalyticsEvent.unlockProFeatures,
|
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/data/models/feature.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/providers/remote_config_provider.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/res/dimens.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/utils/show_buy_pro_dialog.dart';
|
import 'package:lightmeter/screens/settings/components/utils/show_buy_pro_dialog.dart';
|
||||||
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
||||||
|
@ -11,17 +12,17 @@ class BuyProListTile extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final unlockFeaturesEnabled = RemoteConfig.isEnabled(context, Feature.unlockProFeaturesText);
|
||||||
final status = IAPProducts.productOf(context, IAPProductType.paidFeatures)?.status;
|
final status = IAPProducts.productOf(context, IAPProductType.paidFeatures)?.status;
|
||||||
final isPending = status == IAPProductStatus.purchased || status == null;
|
final isPending = status == IAPProductStatus.purchased || status == null;
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Icon(Icons.star),
|
leading: const Icon(Icons.star),
|
||||||
title: Text(
|
title: Text(unlockFeaturesEnabled ? S.of(context).unlockProFeatures : S.of(context).buyLightmeterPro),
|
||||||
RemoteConfig.isEnabled(context, Feature.unlockProFeaturesText)
|
|
||||||
? S.of(context).unlockProFeatures
|
|
||||||
: S.of(context).buyLightmeterPro,
|
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showBuyProDialog(context);
|
showBuyProDialog(context);
|
||||||
|
ServicesProvider.of(context)
|
||||||
|
.analytics
|
||||||
|
.logUnlockProFeatures(unlockFeaturesEnabled ? 'Unlock Pro features' : 'Buy Lightmeter Pro');
|
||||||
},
|
},
|
||||||
trailing: isPending
|
trailing: isPending
|
||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/data/models/feature.dart';
|
import 'package:lightmeter/data/models/feature.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/providers/remote_config_provider.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/res/dimens.dart';
|
||||||
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
||||||
|
|
||||||
|
@ -30,9 +29,6 @@ Future<void> showBuyProDialog(BuildContext context) {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
IAPProductsProvider.of(context).buy(IAPProductType.paidFeatures);
|
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),
|
child: Text(unlockFeaturesEnabled ? S.of(context).unlock : S.of(context).buy),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue