From 4ce020b1f6fd30e460f1d314bd65cb18079490da Mon Sep 17 00:00:00 2001 From: Codel1417 <13484789+Codel1417@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:48:20 -0400 Subject: [PATCH] add OS version to analytics --- lib/Backend/plausible_dio.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Backend/plausible_dio.dart b/lib/Backend/plausible_dio.dart index 97da271e..3a0536f7 100644 --- a/lib/Backend/plausible_dio.dart +++ b/lib/Backend/plausible_dio.dart @@ -1,5 +1,7 @@ import 'dart:convert'; +import 'package:cross_platform/cross_platform.dart'; +import 'package:device_info_plus/device_info_plus.dart'; import 'package:dio/dio.dart'; import 'package:flutter/foundation.dart'; import 'package:install_referrer/install_referrer.dart'; @@ -41,6 +43,13 @@ class PlausibleDio extends Plausible { props['App Version'] = (await PackageInfo.fromPlatform()).version; props['App Build'] = (await PackageInfo.fromPlatform()).buildNumber; + if (Platform.isAndroid) { + AndroidDeviceInfo androidDeviceInfo = await DeviceInfoPlugin().androidInfo; + props['OS Version'] = 'Android ${androidDeviceInfo.version.release}'; + } else { + IosDeviceInfo iosDeviceInfo = await DeviceInfoPlugin().iosInfo; + props['OS Version'] = 'iOS ${iosDeviceInfo.systemVersion}'; + } // Http Post request see https://plausible.io/docs/events-api try { Object body = {