diff --git a/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart b/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart index bcb844e..e02b65f 100644 --- a/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart +++ b/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart @@ -193,9 +193,7 @@ class FileBrowserBloc extends Bloc { ) { final oldOrgId = _currentOrgId; final clearedCount = _currentFiles.length; - print( - '[FILE-BROWSER] Switching workspace, oldOrgId=$oldOrgId, newOrgId=${event.nextOrgId}, clearing=$clearedCount files, reloading state', - ); + emit(DirectoryInitial()); _currentOrgId = event.nextOrgId; _currentPath = '/'; diff --git a/b0esche_cloud/lib/blocs/organization/organization_bloc.dart b/b0esche_cloud/lib/blocs/organization/organization_bloc.dart index e42aa7e..248eee1 100644 --- a/b0esche_cloud/lib/blocs/organization/organization_bloc.dart +++ b/b0esche_cloud/lib/blocs/organization/organization_bloc.dart @@ -105,12 +105,8 @@ class OrganizationBloc extends Bloc { CreateOrganization event, Emitter emit, ) async { - print( - '[DEBUG-ORG-CREATION] CreateOrganization event received with name: "${event.name}"', - ); final name = event.name.trim(); if (name.isEmpty) { - print('[DEBUG-ORG-CREATION] Name is empty after trim'); // Try to preserve current state if possible if (state is OrganizationLoaded) { emit( @@ -156,14 +152,9 @@ class OrganizationBloc extends Bloc { ), ); - print( - '[DEBUG-ORG-CREATION] About to call orgApi.createOrganization with name: "$name"', - ); try { final newOrg = await orgApi.createOrganization(name); - print( - '[DEBUG-ORG-CREATION] API returned successfully: ${newOrg.id} - ${newOrg.name}', - ); + final updatedOrgs = [...existingOrgs, newOrg]; emit(OrganizationLoaded(organizations: updatedOrgs, selectedOrg: newOrg)); // Reset blocs and load permissions for new org @@ -172,7 +163,6 @@ class OrganizationBloc extends Bloc { uploadBloc.add(ResetUploads()); permissionBloc.add(LoadPermissions(newOrg.id)); } catch (e) { - print('[DEBUG-ORG-CREATION] Error caught: $e'); emit( OrganizationLoaded( organizations: existingOrgs, diff --git a/b0esche_cloud/lib/blocs/upload/upload_bloc.dart b/b0esche_cloud/lib/blocs/upload/upload_bloc.dart index 25c871f..538d716 100644 --- a/b0esche_cloud/lib/blocs/upload/upload_bloc.dart +++ b/b0esche_cloud/lib/blocs/upload/upload_bloc.dart @@ -24,18 +24,11 @@ class UploadBloc extends Bloc { for (final file in event.files) { try { - print( - '[UploadBloc] Starting upload for ${file.name} to orgId=${event.orgId}, path=${file.path}', - ); - print( - '[UploadBloc] File bytes: ${file.bytes?.length ?? 0} bytes, localPath: ${file.localPath}', - ); // Simulate upload await _fileRepository.uploadFile(event.orgId, file); - print('[UploadBloc] Upload successful for ${file.name}'); + add(UploadCompleted(file)); } catch (e) { - print('[UploadBloc] Upload failed for ${file.name}: $e'); add(UploadFailed(fileName: file.name, error: e.toString())); } } diff --git a/b0esche_cloud/lib/pages/document_viewer.dart b/b0esche_cloud/lib/pages/document_viewer.dart index 0305607..5dba01d 100644 --- a/b0esche_cloud/lib/pages/document_viewer.dart +++ b/b0esche_cloud/lib/pages/document_viewer.dart @@ -179,24 +179,13 @@ class _DocumentViewerModalState extends State { if (state is DocumentViewerReady) { if (state.caps.isPdf) { // Log the URL and auth being used for debugging - print('Loading PDF from: ${state.viewUrl}'); - print('Token: ${state.token.substring(0, 20)}...'); - print('Headers being passed: Authorization: Bearer ${state.token.substring(0, 20)}...'); + // Pass token via Authorization header - SfPdfViewer supports headers parameter return SfPdfViewer.network( state.viewUrl.toString(), - headers: { - 'Authorization': 'Bearer ${state.token}', - }, - onDocumentLoadFailed: (details) { - print('❌ PDF load FAILED'); - print(' Error: ${details.error}'); - print(' Description: ${details.description}'); - }, - onDocumentLoaded: (PdfDocumentLoadedDetails details) { - print('✅ PDF loaded successfully'); - print(' Pages: ${details.document.pages.count}'); - }, + headers: {'Authorization': 'Bearer ${state.token}'}, + onDocumentLoadFailed: (details) {}, + onDocumentLoaded: (PdfDocumentLoadedDetails details) {}, ); } else { return Container( diff --git a/b0esche_cloud/lib/pages/file_explorer.dart b/b0esche_cloud/lib/pages/file_explorer.dart index cfcf33b..cda45c1 100644 --- a/b0esche_cloud/lib/pages/file_explorer.dart +++ b/b0esche_cloud/lib/pages/file_explorer.dart @@ -67,9 +67,7 @@ class _FileExplorerState extends State { if (oldWidget.orgId != widget.orgId) { // Reset and reload when switching between Personal and Org workspaces final bloc = context.read(); - print( - '[FILE-BROWSER] UI detected workspace switch, oldOrgId=${oldWidget.orgId}, newOrgId=${widget.orgId}, clearing local view', - ); + bloc.add(ResetFileBrowser(widget.orgId)); bloc.add(LoadDirectory(orgId: widget.orgId, path: '/')); } diff --git a/b0esche_cloud/lib/pages/home_page.dart b/b0esche_cloud/lib/pages/home_page.dart index 62684fe..3f0c14e 100644 --- a/b0esche_cloud/lib/pages/home_page.dart +++ b/b0esche_cloud/lib/pages/home_page.dart @@ -352,7 +352,7 @@ class _HomePageState extends State with TickerProviderStateMixin { return Padding( padding: EdgeInsets.only( top: MediaQuery.of(context).size.width < 600 - ? 88.0 + ? 96.0 : 78.0, ), child: AnimatedContainer( diff --git a/b0esche_cloud/lib/services/api_client.dart b/b0esche_cloud/lib/services/api_client.dart index a271b65..4d8436d 100644 --- a/b0esche_cloud/lib/services/api_client.dart +++ b/b0esche_cloud/lib/services/api_client.dart @@ -74,19 +74,11 @@ class ApiClient { dynamic data, required T Function(dynamic data) fromJson, }) async { - print( - '[DEBUG-API-CLIENT] POST request starting - path: $path, data: $data', - ); try { final response = await _dio.post(path, data: data); - print( - '[DEBUG-API-CLIENT] POST response received - status: ${response.statusCode}, data: ${response.data}', - ); + return fromJson(response.data); } on DioException catch (e) { - print( - '[DEBUG-API-CLIENT] POST request failed - type: ${e.type}, message: ${e.message}, status: ${e.response?.statusCode}', - ); throw _handleError(e); } } diff --git a/b0esche_cloud/lib/services/org_api.dart b/b0esche_cloud/lib/services/org_api.dart index 1521b1a..e1526df 100644 --- a/b0esche_cloud/lib/services/org_api.dart +++ b/b0esche_cloud/lib/services/org_api.dart @@ -15,9 +15,6 @@ class OrgApi { } Future createOrganization(String name) async { - print( - '[DEBUG-ORG-CREATION] OrgApi.createOrganization called with name: "$name"', - ); developer.log('POST /orgs with payload: {"name": "$name"}', name: 'OrgApi'); try { @@ -26,12 +23,9 @@ class OrgApi { data: {'name': name}, fromJson: (data) => Organization.fromJson(data), ); - print( - '[DEBUG-ORG-CREATION] OrgApi.createOrganization returned: ${result.id}', - ); + return result; } catch (e) { - print('[DEBUG-ORG-CREATION] OrgApi.createOrganization error: $e'); rethrow; } }