diff --git a/AIStudyApp/AIStudyApp.xcodeproj/project.xcworkspace/xcuserdata/Admin1.xcuserdatad/UserInterfaceState.xcuserstate b/AIStudyApp/AIStudyApp.xcodeproj/project.xcworkspace/xcuserdata/Admin1.xcuserdatad/UserInterfaceState.xcuserstate index 8e62750..af49be5 100644 Binary files a/AIStudyApp/AIStudyApp.xcodeproj/project.xcworkspace/xcuserdata/Admin1.xcuserdatad/UserInterfaceState.xcuserstate and b/AIStudyApp/AIStudyApp.xcodeproj/project.xcworkspace/xcuserdata/Admin1.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/AIStudyApp/AIStudyApp/Features/MaterialReader/MaterialReaderView.swift b/AIStudyApp/AIStudyApp/Features/MaterialReader/MaterialReaderView.swift index aadf06b..1a90013 100644 --- a/AIStudyApp/AIStudyApp/Features/MaterialReader/MaterialReaderView.swift +++ b/AIStudyApp/AIStudyApp/Features/MaterialReader/MaterialReaderView.swift @@ -24,7 +24,7 @@ final class MaterialReaderViewModel: ObservableObject { @Published var stats: TextStats? let materialId: String - let filePath: String + var filePath: String let materialType: MaterialType let mode: PreviewMode @@ -109,19 +109,9 @@ struct MaterialReaderView: View { @Environment(\.scenePhase) private var scenePhase @State private var isParsing = false @State private var parseMessage = "" - @State private var downloadedFilePath: String? - private let title: String private let knowledgeBaseId: String? - /// Resolved file path: uses downloaded temp file if original is empty/missing - private var resolvedPath: String { - if !vm.filePath.isEmpty && FileManager.default.fileExists(atPath: vm.filePath) { - return vm.filePath - } - return downloadedFilePath ?? vm.filePath - } - // V2 session manager (primary) + V1 collector (fallback) private let sessionManager = ReadingRuntimeSessionManager.shared private let collector = ReadingEventCollector.shared @@ -262,8 +252,8 @@ struct MaterialReaderView: View { let localURL = FileManager.default.temporaryDirectory .appendingPathComponent("source_\(vm.materialId).\(ext)") try data.write(to: localURL) - downloadedFilePath = localURL.path print("[MaterialReader] Downloaded to: \(localURL.path), size: \(data.count)") + vm.filePath = localURL.path } } catch { print("[MaterialReader] COS download failed: \(error.localizedDescription)")