Adjust audio player bar positioning and width for improved layout; add authentication token retrieval in file download URL generation

This commit is contained in:
Leon Bösche
2026-01-17 03:02:04 +01:00
parent 0a23133043
commit 00b4436013
4 changed files with 13 additions and 5 deletions

View File

@@ -445,7 +445,7 @@ class _HomePageState extends State<HomePage> 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(

View File

@@ -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;

View File

@@ -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';
}

View File

@@ -193,7 +193,7 @@ class _AudioPlayerBarState extends State<AudioPlayerBar>
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),