Fix log and analytics bugs

This commit is contained in:
problematicconsumer
2023-10-03 21:12:14 +03:30
parent ba071643ce
commit 8f15022443
16 changed files with 86 additions and 57 deletions

View File

@@ -50,16 +50,16 @@ class AppUpdateNotifier extends _$AppUpdateNotifier with AppLogger {
)
.match(
(err) {
loggy.warning("failed to get latest version, $err");
loggy.warning("failed to get latest version", err);
return state = AppUpdateState.error(err);
},
(remote) {
if (remote.version.compareTo(currentVersion) > 0) {
loggy.info("new version available: $remote");
loggy.debug("new version available: $remote");
return state = AppUpdateState.available(remote);
}
loggy.info(
"already using latest version[$currentVersion], remote: $remote",
"already using latest version[$currentVersion], remote: [${remote.version}]",
);
return state = const AppUpdateState.notAvailable();
},

View File

@@ -47,9 +47,9 @@ class ConnectivityController extends _$ConnectivityController with AppLogger {
return _disconnect();
}
loggy.debug("reconnecting, profile: [$profileId]");
await _core.restart(profileId).mapLeft((l) {
loggy.warning("error reconnecting: $l");
state = AsyncError(l, StackTrace.current);
await _core.restart(profileId).mapLeft((err) {
loggy.warning("error reconnecting", err);
state = AsyncError(err, StackTrace.current);
}).run();
}
}
@@ -67,16 +67,16 @@ class ConnectivityController extends _$ConnectivityController with AppLogger {
Future<void> _connect() async {
final activeProfile = await ref.read(activeProfileProvider.future);
await _core.start(activeProfile!.id).mapLeft((l) {
loggy.warning("error connecting: $l");
state = AsyncError(l, StackTrace.current);
await _core.start(activeProfile!.id).mapLeft((err) {
loggy.warning("error connecting", err);
state = AsyncError(err, StackTrace.current);
}).run();
}
Future<void> _disconnect() async {
await _core.stop().mapLeft((l) {
loggy.warning("error disconnecting: $l");
state = AsyncError(l, StackTrace.current);
await _core.stop().mapLeft((err) {
loggy.warning("error disconnecting", err);
state = AsyncError(err, StackTrace.current);
}).run();
}
}