Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43137cde83 | ||
|
|
9ea2c94912 | ||
|
|
ad33679c2b | ||
|
|
c390f21114 | ||
|
|
b03ecef121 | ||
|
|
3d9d2621fa | ||
|
|
9c84e1eed4 | ||
|
|
e424af1a31 | ||
|
|
71d416ce90 | ||
|
|
91cdd20b3f | ||
|
|
235e68fa2b | ||
|
|
3279b28a76 | ||
|
|
d95abcea95 | ||
|
|
a73636a597 |
+1
-2
@@ -51,8 +51,7 @@ class UserLicenseSettingsServiceTest {
|
||||
|
||||
when(applicationProperties.getPremium()).thenReturn(premium);
|
||||
when(applicationProperties.getAutomaticallyGenerated()).thenReturn(automaticallyGenerated);
|
||||
when(automaticallyGenerated.getIsNewServer())
|
||||
.thenReturn(false); // Default: not a new server
|
||||
when(automaticallyGenerated.getIsNewServer()).thenReturn(false); // Default: not a new server
|
||||
when(settingsRepository.findSettings()).thenReturn(Optional.of(mockSettings));
|
||||
when(userService.getTotalUsersCount()).thenReturn(80L);
|
||||
when(settingsRepository.save(any(UserLicenseSettings.class)))
|
||||
|
||||
@@ -84,6 +84,7 @@ export function AppProviders({ children, appConfigRetryOptions, appConfigProvide
|
||||
<ScarfTrackingInitializer />
|
||||
<AppConfigLoader />
|
||||
<FileContextProvider enableUrlSync={true} enablePersistence={true}>
|
||||
<AppInitializer />
|
||||
<BrandingAssetManager />
|
||||
<ToolRegistryProvider>
|
||||
<NavigationProvider>
|
||||
@@ -92,7 +93,6 @@ export function AppProviders({ children, appConfigRetryOptions, appConfigProvide
|
||||
<HotkeyProvider>
|
||||
<SidebarProvider>
|
||||
<ViewerProvider>
|
||||
<AppInitializer />
|
||||
<PageEditorProvider>
|
||||
<SignatureProvider>
|
||||
<RightRailProvider>
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useOpenedFile } from '@app/hooks/useOpenedFile';
|
||||
import { fileOpenService } from '@app/services/fileOpenService';
|
||||
import { useFileManagement } from '@app/contexts/file/fileHooks';
|
||||
import { useToolWorkflow } from '@app/contexts/ToolWorkflowContext';
|
||||
import { useNavigationActions } from '@app/contexts/NavigationContext';
|
||||
import { useViewer } from '@app/contexts/ViewerContext';
|
||||
|
||||
/**
|
||||
* App initialization hook
|
||||
* Desktop version: Handles Tauri-specific file initialization
|
||||
* Requires FileContext - must be used inside FileContextProvider
|
||||
* - Handles files opened with the app (adds directly to FileContext)
|
||||
* - Opens single files in reader mode (collapsed tools for clean viewing)
|
||||
*/
|
||||
export function useAppInitialization(): void {
|
||||
// Get file management actions
|
||||
const { addFiles } = useFileManagement();
|
||||
const { setReaderMode } = useToolWorkflow();
|
||||
const { actions } = useNavigationActions();
|
||||
const { setActiveFileIndex } = useViewer();
|
||||
|
||||
// Handle files opened with app (Tauri mode)
|
||||
const { openedFilePaths, loading: openedFileLoading } = useOpenedFile();
|
||||
const hasSetInitialReaderMode = useRef(false);
|
||||
|
||||
// Load opened files and add directly to FileContext
|
||||
useEffect(() => {
|
||||
@@ -54,15 +46,6 @@ export function useAppInitialization(): void {
|
||||
if (filesArray.length > 0) {
|
||||
await addFiles(filesArray);
|
||||
console.log(`[Desktop] ${filesArray.length} opened file(s) added to FileContext`);
|
||||
|
||||
// Open single files in reader mode only on first app launch
|
||||
if (filesArray.length === 1 && !hasSetInitialReaderMode.current) {
|
||||
hasSetInitialReaderMode.current = true;
|
||||
setReaderMode(true);
|
||||
actions.setWorkbench('viewer');
|
||||
setActiveFileIndex(0);
|
||||
console.log('[Desktop] Opening in reader mode');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[Desktop] Failed to load opened files:', error);
|
||||
|
||||
Reference in New Issue
Block a user