refactor:plausible
parent
0656a92dc7
commit
8cc6b838de
|
|
@ -96,16 +96,20 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
|
|||
} else if (state == AppLifecycleState.resumed) {
|
||||
LoggerUtil.logNStackInfo("The application is resumed");
|
||||
|
||||
// check if plausible is UP
|
||||
await PlausibleUtil.hello();
|
||||
if (PlausibleUtil.isPlausibleInitialized()) {
|
||||
// check if plausible is UP
|
||||
await PlausibleUtil.hello();
|
||||
|
||||
PlausibleUtil.addEvent(
|
||||
name: 'access',
|
||||
page: 'access',
|
||||
referrer: 'referrerPage',
|
||||
props: {
|
||||
'name': SharedPrefs().login,
|
||||
});
|
||||
PlausibleUtil.addEvent(
|
||||
name: 'access',
|
||||
page: 'access',
|
||||
referrer: 'referrerPage',
|
||||
props: {
|
||||
'name': SharedPrefs().login,
|
||||
});
|
||||
} else {
|
||||
await PlausibleUtil.initializePlausible(window.physicalSize.width);
|
||||
}
|
||||
} else if (state == AppLifecycleState.inactive) {
|
||||
LoggerUtil.logNStackInfo("The application is inactive");
|
||||
} else if (state == AppLifecycleState.detached) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ import 'package:mobdr/network/get_ip_address.dart';
|
|||
class PlausibleUtil {
|
||||
static PlausibleTracker? plausible;
|
||||
|
||||
static bool isPlausibleInitialized() {
|
||||
return plausible != null;
|
||||
}
|
||||
|
||||
static Future<void> initializePlausible(double screenWidth) async {
|
||||
plausible = PlausibleTracker(
|
||||
"https://plausible.q2ii.fr",
|
||||
|
|
|
|||
Loading…
Reference in New Issue