Skip to content

Commit

Permalink
Added user agent and screen width size to plausible (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
thePeras authored Jun 11, 2024
2 parents 02cd6d2 + cb22c24 commit 7e25ca3
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 88 deletions.
5 changes: 4 additions & 1 deletion uni/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:plausible_analytics/plausible_analytics.dart';
import 'package:provider/provider.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:ua_client_hints/ua_client_hints.dart';
import 'package:uni/controller/background_workers/background_callback.dart';
import 'package:uni/controller/cleanup.dart';
import 'package:uni/controller/fetchers/terms_and_conditions_fetcher.dart';
Expand Down Expand Up @@ -109,8 +110,10 @@ Future<void> main() async {
final plausibleUrl = dotenv.env['PLAUSIBLE_URL'];
final plausibleDomain = dotenv.env['PLAUSIBLE_DOMAIN'];

final ua = await userAgent();

final plausible = plausibleUrl != null && plausibleDomain != null
? Plausible(plausibleUrl, plausibleDomain)
? Plausible(plausibleUrl, plausibleDomain, userAgent: ua)
: null;

if (plausible == null) {
Expand Down
3 changes: 3 additions & 0 deletions uni/lib/model/providers/plausible/plausible_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class _PlausibleProviderState extends State<PlausibleProvider> {

@override
Widget build(BuildContext context) {
widget.plausible?.screenWidth =
MediaQuery.of(context).size.width.toString();

return Listener(
behavior: HitTestBehavior.translucent,
onPointerDown: (event) {
Expand Down
6 changes: 1 addition & 5 deletions uni/lib/view/profile/widgets/create_print_mb_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ Future<void> addMoneyDialog(BuildContext context) async {
}

final CurrencyTextInputFormatter formatter =
CurrencyTextInputFormatter.currency(
locale: 'pt-PT',
decimalDigits: 2,
symbol: '€ ',
);
CurrencyTextInputFormatter(locale: 'pt', decimalDigits: 2, symbol: '€ ');

double valueTextToNumber(String value) =>
double.parse(value.substring(0, value.length - 2).replaceAll(',', '.'));
Expand Down
Loading

0 comments on commit 7e25ca3

Please sign in to comment.