Set initial location for GoRouter based on web platform and clean up unused imports in PublicFileViewer

This commit is contained in:
Leon Bösche
2026-01-25 18:59:28 +01:00
parent 3fb556c8f1
commit b041cd5440
3 changed files with 3 additions and 15 deletions

View File

@@ -16,7 +16,10 @@ import 'pages/public_file_viewer.dart';
import 'theme/app_theme.dart';
import 'injection.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
final GoRouter _router = GoRouter(
initialLocation: kIsWeb ? Uri.base.path : '/',
routes: [
GoRoute(path: '/', builder: (context, state) => const HomePage()),
GoRoute(

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:web/web.dart' as web;
import 'dart:ui_web' as ui_web;
@@ -10,8 +9,6 @@ import '../services/api_client.dart';
import '../injection.dart';
import '../theme/modern_glass_button.dart';
import '../widgets/file_viewer_dispatch.dart';
import '../blocs/auth/auth_bloc.dart';
import '../blocs/auth/auth_state.dart';
class PublicFileViewer extends StatefulWidget {
final String token;
@@ -52,18 +49,6 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
_isLoading = false;
});
// If user is authenticated and has internal access, redirect to internal viewer
if (_fileData?['fileId'] != null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
final authState = context.read<AuthBloc>().state;
if (authState is AuthAuthenticated) {
final orgId = _fileData!['orgId'] ?? '';
final fileId = _fileData!['fileId'];
context.go('/viewer/$orgId/$fileId');
}
});
}
// Initialize video player if it's a video file
if (_isVideoFile()) {
await _initializeVideoPlayer();

Binary file not shown.