mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 07:44:26 +01:00
Simply implement snippet running.
This commit is contained in:
@@ -6,7 +6,10 @@ class Analysis {
|
||||
static const _url = 'https://countly.xuty.cc';
|
||||
static const _key = '80372a2a66424b32d0ac8991bfa1ef058bd36b1f';
|
||||
|
||||
static bool _enabled = false;
|
||||
|
||||
static Future<void> init(bool debug) async {
|
||||
_enabled = true;
|
||||
await Countly.setLoggingEnabled(debug);
|
||||
await Countly.init(_url, _key);
|
||||
await Countly.start();
|
||||
@@ -15,10 +18,14 @@ class Analysis {
|
||||
}
|
||||
|
||||
static void recordView(String view) {
|
||||
Countly.recordView(view);
|
||||
if (_enabled) {
|
||||
Countly.recordView(view);
|
||||
}
|
||||
}
|
||||
|
||||
static void recordException(Object exception, [bool fatal = false]) {
|
||||
Countly.logException(exception.toString(), !fatal, null);
|
||||
if (_enabled) {
|
||||
Countly.logException(exception.toString(), !fatal, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ bool isDarkMode(BuildContext context) =>
|
||||
void showSnackBar(BuildContext context, Widget child) =>
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: child));
|
||||
|
||||
void showSnackBarWithAction(
|
||||
BuildContext context, String content, String action, Function onTap) {
|
||||
void showSnackBarWithAction(BuildContext context, String content, String action,
|
||||
GestureTapCallback onTap) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(content),
|
||||
action: SnackBarAction(
|
||||
label: action,
|
||||
onPressed: () => onTap,
|
||||
onPressed: onTap,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user