-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
54 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:plausible_analytics/plausible_analytics.dart'; | ||
import 'package:sentry_hive/sentry_hive.dart'; | ||
|
||
import '../Definitions/Device/BaseDeviceDefinition.dart'; | ||
|
||
class CustomNavObserver extends NavigatorObserver { | ||
/// The [Plausible] instance to report page views to. | ||
final Plausible plausible; | ||
|
||
CustomNavObserver(this.plausible); | ||
|
||
@override | ||
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) { | ||
super.didPush(route, previousRoute); | ||
String? name = route.settings.name; | ||
String refferalName = previousRoute?.settings.name ?? ""; | ||
if (name != null) { | ||
plausible.screenWidth = MediaQuery.of(route.navigator!.context).size.width.toString(); | ||
plausible.event(page: route.settings.name.toString(), props: {"Number Of Devices": SentryHive.box<BaseStoredDevice>('devices').length.toString()}, referrer: refferalName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,11 @@ import 'dart:async'; | |
import 'dart:developer'; | ||
|
||
import 'package:feedback_sentry/feedback_sentry.dart'; | ||
import 'package:fk_user_agent/fk_user_agent.dart'; | ||
import 'package:flex_color_scheme/flex_color_scheme.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:flutter_localizations/flutter_localizations.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
@@ -37,13 +39,20 @@ FutureOr<SentryEvent?> beforeSend(SentryEvent event, {Hint? hint}) async { | |
} | ||
} | ||
|
||
const String serverUrl = "https://plausible.codel1417.xyz"; | ||
const String domain = "tail_app"; | ||
const String serverUrl = "https://plausable.codel1417.xyz"; | ||
const String domain = "tail-app"; | ||
|
||
final plausible = Plausible(serverUrl, domain); | ||
final Plausible plausible = Plausible(serverUrl, domain); | ||
|
||
Future<void> main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
await FkUserAgent.init(); | ||
// Platform messages may fail, so we use a try/catch PlatformException. | ||
try { | ||
String platformVersion = FkUserAgent.userAgent!; | ||
plausible.userAgent = platformVersion; | ||
} on PlatformException {} | ||
plausible.enabled = true; | ||
Flogger.init(config: const FloggerConfig(showDebugLogs: true, printClassName: true, printMethodName: true, showDateTime: false)); | ||
PlatformDispatcher.instance.onError = (error, stack) { | ||
Flogger.e(error.toString(), stackTrace: stack); | ||
|
@@ -79,7 +88,6 @@ Future<void> main() async { | |
SentryHive.openBox<Trigger>('triggers'); | ||
SentryHive.openBox<MoveList>('sequences'); | ||
SentryHive.openBox<BaseStoredDevice>('devices'); | ||
plausible.enabled = false; | ||
await SentryFlutter.init( | ||
(options) { | ||
options.dsn = 'https://[email protected]/2'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters