Set initial location for GoRouter based on web platform and clean up unused imports in PublicFileViewer
This commit is contained in:
@@ -16,7 +16,10 @@ import 'pages/public_file_viewer.dart';
|
|||||||
import 'theme/app_theme.dart';
|
import 'theme/app_theme.dart';
|
||||||
import 'injection.dart';
|
import 'injection.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
|
||||||
final GoRouter _router = GoRouter(
|
final GoRouter _router = GoRouter(
|
||||||
|
initialLocation: kIsWeb ? Uri.base.path : '/',
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(path: '/', builder: (context, state) => const HomePage()),
|
GoRoute(path: '/', builder: (context, state) => const HomePage()),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:web/web.dart' as web;
|
import 'package:web/web.dart' as web;
|
||||||
import 'dart:ui_web' as ui_web;
|
import 'dart:ui_web' as ui_web;
|
||||||
@@ -10,8 +9,6 @@ import '../services/api_client.dart';
|
|||||||
import '../injection.dart';
|
import '../injection.dart';
|
||||||
import '../theme/modern_glass_button.dart';
|
import '../theme/modern_glass_button.dart';
|
||||||
import '../widgets/file_viewer_dispatch.dart';
|
import '../widgets/file_viewer_dispatch.dart';
|
||||||
import '../blocs/auth/auth_bloc.dart';
|
|
||||||
import '../blocs/auth/auth_state.dart';
|
|
||||||
|
|
||||||
class PublicFileViewer extends StatefulWidget {
|
class PublicFileViewer extends StatefulWidget {
|
||||||
final String token;
|
final String token;
|
||||||
@@ -52,18 +49,6 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
|||||||
_isLoading = false;
|
_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
|
// Initialize video player if it's a video file
|
||||||
if (_isVideoFile()) {
|
if (_isVideoFile()) {
|
||||||
await _initializeVideoPlayer();
|
await _initializeVideoPlayer();
|
||||||
|
|||||||
BIN
go_cloud/api
BIN
go_cloud/api
Binary file not shown.
Reference in New Issue
Block a user