changed how analytics work

This commit is contained in:
Kima
2024-10-02 21:06:01 +02:00
parent d7741ca1c4
commit 816ddf58a2
4 changed files with 53 additions and 30 deletions

View File

@@ -5,6 +5,7 @@ import 'package:refilc_plus/providers/plus_provider.dart';
import 'package:refilc_plus/ui/mobile/plus/activation_view/activation_view.dart';
import 'package:refilc_mobile_ui/plus/plus_screen.i18n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:uuid/uuid.dart';
class PlusPlanCard extends StatelessWidget {
const PlusPlanCard({
@@ -53,18 +54,24 @@ class PlusPlanCard extends StatelessWidget {
if (Provider.of<SettingsProvider>(context, listen: false).xFilcId ==
"none") {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text(
"Be kell kapcsolnod a Névtelen Analitikát a beállítások főoldalán, mielőtt reFilc+ előfizetést vásárolnál!",
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
),
backgroundColor: Colors.white,
));
return;
Provider.of<SettingsProvider>(context, listen: false)
.update(xFilcId: const Uuid().v4(), store: true);
}
// if (Provider.of<SettingsProvider>(context, listen: false).xFilcId ==
// "none") {
// ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
// content: Text(
// "Be kell kapcsolnod a Névtelen Analitikát a beállítások főoldalán, mielőtt reFilc+ előfizetést vásárolnál!",
// style:
// TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
// ),
// backgroundColor: Colors.white,
// ));
// return;
// }
if (Provider.of<PlusProvider>(context, listen: false).hasPremium) {
if (!active) {
launchUrl(

View File

@@ -1177,7 +1177,7 @@ class SettingsScreenState extends State<SettingsScreen>
secondary: Icon(
FeatherIcons.barChart2,
size: 22.0,
color: settings.xFilcId != "none"
color: settings.analyticsEnabled
? AppColors.of(context).text.withOpacity(0.95)
: AppColors.of(context).text.withOpacity(.25),
),
@@ -1187,28 +1187,29 @@ class SettingsScreenState extends State<SettingsScreen>
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.xFilcId != "none" ? 1.0 : .5),
settings.analyticsEnabled ? 1.0 : .5),
),
),
subtitle: Text(
"Anonymous Usage Analytics".i18n,
style: TextStyle(
color: AppColors.of(context).text.withOpacity(
settings.xFilcId != "none" ? .5 : .2),
color: AppColors.of(context)
.text
.withOpacity(settings.analyticsEnabled ? .5 : .2),
),
),
onChanged: (v) {
String newId;
if (v == false) {
newId = "none";
} else if (settings.xFilcId == "none") {
newId = SettingsProvider.defaultSettings().xFilcId;
} else {
newId = settings.xFilcId;
}
settings.update(xFilcId: newId);
// String newId;
// if (v == false) {
// newId = "none";
// } else if (settings.xFilcId == "none") {
// newId = SettingsProvider.defaultSettings().xFilcId;
// } else {
// newId = settings.xFilcId;
// }
settings.update(analyticsEnabled: v);
},
value: settings.xFilcId != "none",
value: settings.analyticsEnabled,
activeColor: Theme.of(context).colorScheme.secondary,
),
),