refactor:plausible
parent
0656a92dc7
commit
8cc6b838de
|
|
@ -96,6 +96,7 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
|
|||
} else if (state == AppLifecycleState.resumed) {
|
||||
LoggerUtil.logNStackInfo("The application is resumed");
|
||||
|
||||
if (PlausibleUtil.isPlausibleInitialized()) {
|
||||
// check if plausible is UP
|
||||
await PlausibleUtil.hello();
|
||||
|
||||
|
|
@ -106,6 +107,9 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
|
|||
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