From 00b44360137e24bf4034aac519c1be8700cc8e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Sat, 17 Jan 2026 03:02:04 +0100 Subject: [PATCH] Adjust audio player bar positioning and width for improved layout; add authentication token retrieval in file download URL generation --- b0esche_cloud/lib/pages/home_page.dart | 2 +- b0esche_cloud/lib/services/api_client.dart | 2 ++ b0esche_cloud/lib/services/file_service.dart | 12 +++++++++--- b0esche_cloud/lib/widgets/audio_player_bar.dart | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/b0esche_cloud/lib/pages/home_page.dart b/b0esche_cloud/lib/pages/home_page.dart index 475b59f..7a5c3dc 100644 --- a/b0esche_cloud/lib/pages/home_page.dart +++ b/b0esche_cloud/lib/pages/home_page.dart @@ -445,7 +445,7 @@ class _HomePageState extends State with TickerProviderStateMixin { _audioFileName != null && _audioFileUrl != null) Positioned( - right: -200, // adjust to position next to title + right: 120, // Add padding from right edge to avoid overlapping nav buttons child: SlideTransition( position: _audioBarOffset, child: AudioPlayerBar( diff --git a/b0esche_cloud/lib/services/api_client.dart b/b0esche_cloud/lib/services/api_client.dart index 4d8436d..5f33626 100644 --- a/b0esche_cloud/lib/services/api_client.dart +++ b/b0esche_cloud/lib/services/api_client.dart @@ -47,6 +47,8 @@ class ApiClient { String get baseUrl => _dio.options.baseUrl; + String? get currentToken => _getCurrentToken(); + String? _getCurrentToken() { // Get from SessionBloc state final state = _sessionBloc.state; diff --git a/b0esche_cloud/lib/services/file_service.dart b/b0esche_cloud/lib/services/file_service.dart index cdd9521..e0b0a88 100644 --- a/b0esche_cloud/lib/services/file_service.dart +++ b/b0esche_cloud/lib/services/file_service.dart @@ -121,10 +121,16 @@ class FileService { required String filePath, String? fileName, }) async { - // Return the full download URL + // Get authentication token + final token = _apiClient.currentToken; + if (token == null) { + throw Exception('No authentication token available'); + } + + // Return the full download URL with token final path = orgId.isEmpty - ? '/user/files/download?path=${Uri.encodeComponent(filePath)}' - : '/orgs/$orgId/files/download?path=${Uri.encodeComponent(filePath)}'; + ? '/user/files/download?path=${Uri.encodeComponent(filePath)}&token=${Uri.encodeComponent(token)}' + : '/orgs/$orgId/files/download?path=${Uri.encodeComponent(filePath)}&token=${Uri.encodeComponent(token)}'; return '$baseUrl$path'; } diff --git a/b0esche_cloud/lib/widgets/audio_player_bar.dart b/b0esche_cloud/lib/widgets/audio_player_bar.dart index 6ccbd18..3411353 100644 --- a/b0esche_cloud/lib/widgets/audio_player_bar.dart +++ b/b0esche_cloud/lib/widgets/audio_player_bar.dart @@ -193,7 +193,7 @@ class _AudioPlayerBarState extends State height: 48, width: MediaQuery.of(context).size.width * - 0.25, // Reduce width to 25% for better fit + 0.30, // Reduce width to 30% for better fit padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), decoration: AppTheme.glassDecoration.copyWith( borderRadius: BorderRadius.circular(16),