feat: error reporting with logs (#45)

* feat: add ability to get logs file from ui

* test: add unit test for log line parsing in logs_provider

* refactor: update all logs to obfuscate sensitive information

* feat: generate dynamic zip file name for logs export

* feat: enhance logging in audiobook player and provider for better debugging

* refactor: extract user display logic into UserBar widget for offline access of settings and logs

* feat: add About section with app metadata and source code link in YouPage
This commit is contained in:
Dr.Blank 2024-10-03 05:54:29 -04:00 committed by GitHub
parent 7b0c2c4b88
commit 35a2d7cfce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 861 additions and 176 deletions

View file

@ -90,6 +90,12 @@ class Routes {
name: 'openIDCallback',
parentRoute: onboarding,
);
// logs page
static const logs = _SimpleRoute(
pathName: 'logs',
name: 'logs',
);
}
// a class to store path

View file

@ -5,10 +5,12 @@ import 'package:vaani/features/explore/view/explore_page.dart';
import 'package:vaani/features/explore/view/search_result_page.dart';
import 'package:vaani/features/item_viewer/view/library_item_page.dart';
import 'package:vaani/features/library_browser/view/library_browser_page.dart';
import 'package:vaani/features/logging/view/logs_page.dart';
import 'package:vaani/features/onboarding/view/callback_page.dart';
import 'package:vaani/features/onboarding/view/onboarding_single_page.dart';
import 'package:vaani/features/you/view/server_manager.dart';
import 'package:vaani/features/you/view/you_page.dart';
import 'package:vaani/main.dart';
import 'package:vaani/pages/home_page.dart';
import 'package:vaani/settings/view/app_settings_page.dart';
import 'package:vaani/settings/view/auto_sleep_timer_settings_page.dart';
@ -215,6 +217,14 @@ class MyAppRouter {
),
],
),
// loggers page
GoRoute(
path: Routes.logs.localPath,
name: Routes.logs.name,
// builder: (context, state) => const LogsPage(),
pageBuilder: defaultPageBuilder(const LogsPage()),
),
],
);
@ -225,7 +235,7 @@ class MyAppRouter {
// extract the code and state from the uri
final code = state.uri.queryParameters['code'];
final stateParam = state.uri.queryParameters['state'];
debugPrint('deep linking callback: code: $code, state: $stateParam');
appLogger.fine('deep linking callback: code: $code, state: $stateParam');
var callbackPage =
CallbackPage(code: code, state: stateParam, key: ValueKey(stateParam));

View file

@ -6,6 +6,7 @@ import 'package:vaani/features/explore/providers/search_controller.dart';
import 'package:vaani/features/player/providers/player_form.dart';
import 'package:vaani/features/player/view/audiobook_player.dart';
import 'package:vaani/features/player/view/player_when_expanded.dart';
import 'package:vaani/main.dart';
import 'package:vaani/router/router.dart';
// stack to track changes in navigationShell.currentIndex
@ -42,13 +43,13 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
onBackButtonPressed() async {
final isPlayerExpanded = playerProgress != playerMinHeight;
debugPrint(
appLogger.fine(
'BackButtonListener: Back button pressed, isPlayerExpanded: $isPlayerExpanded, stack: $navigationShellStack, pendingPlayerModals: $pendingPlayerModals',
);
// close miniplayer if it is open
if (isPlayerExpanded && pendingPlayerModals == 0) {
debugPrint(
appLogger.fine(
'BackButtonListener: closing the player',
);
audioBookMiniplayerController.animateToHeight(state: PanelState.MIN);
@ -59,7 +60,7 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
final canPop = GoRouter.of(context).canPop();
if (canPop) {
debugPrint(
appLogger.fine(
'BackButtonListener: passing it to the router as canPop is true',
);
return false;
@ -69,7 +70,7 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
// pop the last index from the stack and navigate to it
final index = navigationShellStack.last;
navigationShellStack.remove(index);
debugPrint('BackButtonListener: popping the stack, index: $index');
appLogger.fine('BackButtonListener: popping the stack, index: $index');
// if the stack is empty, navigate to home else navigate to the last index
if (navigationShellStack.isNotEmpty) {
@ -79,12 +80,12 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
}
if (navigationShell.currentIndex != 0) {
// if the stack is empty and the current branch is not home, navigate to home
debugPrint('BackButtonListener: navigating to home');
appLogger.fine('BackButtonListener: navigating to home');
navigationShell.goBranch(0);
return true;
}
debugPrint('BackButtonListener: passing it to the router');
appLogger.fine('BackButtonListener: passing it to the router');
return false;
}
@ -149,12 +150,11 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
navigationShellStack.remove(index);
}
navigationShellStack.add(index);
debugPrint('Tapped index: $index, stack: $navigationShellStack');
appLogger.fine('Tapped index: $index, stack: $navigationShellStack');
// Check if the current branch is the same as the branch that was tapped.
// If it is, debugPrint a message to the console.
if (index == navigationShell.currentIndex) {
debugPrint('Tapped the current branch');
appLogger.fine('Tapped the current branch');
// if current branch is explore, open the search view
if (index == 2) {