Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove Ensu EnteCore fallback stubs

Manav Rathif3d157c68478
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatView.swift
index 528e243e88..0d293251c2 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct ChatView: View {
@@ -511,13 +510,3 @@ private struct ToastMessage: Identifiable {
let id = UUID()
let text: String
}
-
-#else
-import SwiftUI
-
-struct ChatView: View {
- var body: some View {
- Text("Chat unavailable")
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift
index 1b2a9968b8..d3aad6b74c 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift
@@ -1,241 +1,7 @@
import Foundation
import SwiftUI
-#if canImport(EnteCore)
import EnteCore
-#else
-final class CredentialStore {
- static let shared = CredentialStore()
- func getOrCreateChatDbKey() -> Data {
- Data()
- }
-}
-
-enum EnsuLogLevel: String {
- case info
- case warning
- case error
-}
-
-struct EnsuLogger {
- let tag: String
-
- func info(_ message: String, details: String? = nil) {}
- func warning(_ message: String, details: String? = nil) {}
- func error(_ message: String, _ error: Error? = nil, details: String? = nil) {}
-}
-
-final class EnsuLogging {
- static let shared = EnsuLogging()
-
- func start() {}
-
- func logger(_ tag: String) -> EnsuLogger {
- EnsuLogger(tag: tag)
- }
-
- func log(level: EnsuLogLevel, tag: String, message: String, details: String? = nil, error: Error? = nil) {}
-
- func todayLogFileURL() -> URL { URL(fileURLWithPath: "") }
- func listLogFiles() -> [URL] { [] }
- func readLogText(fileURL: URL) -> String { "" }
- func createLogsArchive() throws -> URL { URL(fileURLWithPath: "") }
-}
-
-struct InferenceModelTarget: Equatable {
- let id: String
- let url: String
- let mmprojUrl: String?
- let contextLength: Int?
- let maxTokens: Int?
-}
-
-struct InferenceDownloadProgress: Equatable {
- let percent: Int
- let status: String
-}
-
-enum InferenceMessageRole {
- case user
- case assistant
- case system
-
- var roleString: String {
- switch self {
- case .user:
- return "user"
- case .assistant:
- return "assistant"
- case .system:
- return "system"
- }
- }
-}
-
-struct InferenceMessage {
- let text: String
- let role: InferenceMessageRole
- let hasAttachments: Bool
-}
-
-struct InferenceGenerationSummary {
- let jobId: Int64
- let generatedTokens: Int
- let totalTimeMs: Int64?
-}
-
-final class InferenceRsProvider {
- init(modelDir: URL) {
- _ = modelDir
- }
-
- func ensureModelReady(
- target: InferenceModelTarget,
- onProgress: @escaping (InferenceDownloadProgress) -> Void
- ) async throws {
- _ = (target, onProgress)
- }
-
- func generateChat(
- target: InferenceModelTarget,
- messages: [InferenceMessage],
- imageFiles: [URL],
- temperature: Float,
- maxTokens: Int?,
- onToken: @escaping (String) -> Void
- ) async throws -> InferenceGenerationSummary {
- _ = (target, messages, imageFiles, temperature, maxTokens, onToken)
- return InferenceGenerationSummary(jobId: 0, generatedTokens: 0, totalTimeMs: nil)
- }
-
- func isModelDownloaded(target: InferenceModelTarget) -> Bool {
- _ = target
- return true
- }
-
- func prewarmImageInference(target: InferenceModelTarget) async {
- _ = target
- }
-
- func estimatedDownloadSize(target: InferenceModelTarget) async -> Int64? {
- _ = target
- return nil
- }
-
- func loadedContextLength(target: InferenceModelTarget) -> Int? {
- _ = target
- return nil
- }
-
- func stopGeneration() {}
-
- func resetContext() {}
-
- func cancelDownload() {}
-}
-
-@MainActor
-final class ModelSettingsStore: ObservableObject {
- static let shared = ModelSettingsStore()
-
- var temperature: String = ""
- var contextLength: String = ""
- var maxTokens: String = ""
- var useCustomModel: Bool = false
- var modelUrl: String = ""
- var mmprojUrl: String = ""
-
- func currentTarget() -> InferenceModelTarget {
- let context = Int(contextLength)
- let maxOutput = Int(maxTokens)
- return InferenceModelTarget(
- id: "default",
- url: "",
- mmprojUrl: nil,
- contextLength: context,
- maxTokens: maxOutput
- )
- }
-}
-
-enum MessageSender {
- case selfUser
- case other
-}
-
-enum AttachmentKind {
- case image
- case document
-}
-
-struct AttachmentMeta {
- let id: String
- let kind: AttachmentKind
- let size: Int64
- let name: String
-}
-
-struct LlmChatSession {
- let uuid: String
- let title: String
- let updatedAtUs: Int64
-}
-
-struct LlmChatMessage {
- let uuid: String
- let sender: MessageSender
- let createdAtUs: Int64
- let text: String
- let parentMessageUuid: String?
- let attachments: [AttachmentMeta]
-}
-
-final class EnsuDb {
- static func open(mainDbPath: String, attachmentsDbPath: String, key: Data) throws -> EnsuDb {
- _ = (mainDbPath, attachmentsDbPath, key)
- return EnsuDb()
- }
-
- func listSessions() throws -> [LlmChatSession] { [] }
-
- func getMessages(sessionUuid: String) throws -> [LlmChatMessage] {
- _ = sessionUuid
- return []
- }
-
- func deleteSession(uuid: String) throws {
- _ = uuid
- }
-
- func insertMessage(
- sessionUuid: String,
- sender: MessageSender,
- text: String,
- parentMessageUuid: String?,
- attachments: [AttachmentMeta]
- ) throws -> LlmChatMessage {
- _ = (sessionUuid, sender, text, parentMessageUuid, attachments)
- return LlmChatMessage(
- uuid: UUID().uuidString,
- sender: sender,
- createdAtUs: Int64(Date().timeIntervalSince1970 * 1_000_000),
- text: text,
- parentMessageUuid: parentMessageUuid,
- attachments: attachments
- )
- }
-
- func createSession(title: String) throws -> LlmChatSession {
- LlmChatSession(uuid: UUID().uuidString, title: title, updatedAtUs: Int64(Date().timeIntervalSince1970 * 1_000_000))
- }
-
- func updateSessionTitle(uuid: String, title: String) throws {
- _ = (uuid, title)
- }
-}
-#endif
-
-#if canImport(EnteCore)
typealias LlmChatSession = Session
@@ -2520,9 +2286,3 @@ private final class DownloadProgressTracker {
)
}
}
-#else
-@MainActor
-final class ChatViewModel: ObservableObject {
- init() {}
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift
index 32b130f6d0..c0f9afb38f 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct DownloadOnboardingView: View {
@@ -388,4 +387,3 @@ struct ModelProgressIndicator: View {
}
}
}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/LaTeXView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/LaTeXView.swift
index 51d331692c..ae1302977e 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/LaTeXView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/LaTeXView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
import SwiftMath
@@ -223,4 +222,3 @@ private final class MathLabelContainerView: NSView {
}
}
#endif
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift
index 73525bef4a..9b755d81e8 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
import PhotosUI
import UniformTypeIdentifiers
@@ -525,12 +524,3 @@ private extension UIView {
}
}
#endif
-#else
-import SwiftUI
-
-struct MessageInputView: View {
- var body: some View {
- Text("Input unavailable")
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageList/MessageListComponents.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageList/MessageListComponents.swift
index 0fd7715879..0e77cc08ff 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageList/MessageListComponents.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageList/MessageListComponents.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
import Markdown
#if os(macOS)
@@ -1394,4 +1393,3 @@ struct ScrollChange: Equatable {
var isGenerating: Bool = false
var isAtBottom: Bool = true
}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageListView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageListView.swift
index 762cb27f6e..a3ca6476ef 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageListView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageListView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct MessageListView: View {
@@ -407,13 +406,3 @@ private struct StreamingDotsView: View {
}
}
}
-
-#else
-import SwiftUI
-
-struct MessageListView: View {
- var body: some View {
- Text("Messages unavailable")
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/SessionDrawerView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/SessionDrawerView.swift
index 117255bf13..73f2cded48 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/SessionDrawerView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/SessionDrawerView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct SessionDrawerView: View {
@@ -228,13 +227,3 @@ private struct SessionSection: Identifiable {
let title: String
let sessions: [ChatSession]
}
-
-#else
-import SwiftUI
-
-struct SessionDrawerView: View {
- var body: some View {
- Text("Sessions unavailable")
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift
index a8a6e4f9b9..ef7e2c9bd5 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import Foundation
#if os(iOS)
import AVFoundation
@@ -475,4 +474,3 @@ private final class TranscriptionProgressCallback: TranscriptionModelEventCallba
}
}
#endif
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Components/EnsuComponents.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Components/EnsuComponents.swift
index d7ae7f5c31..5ac00120ed 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Components/EnsuComponents.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Components/EnsuComponents.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
#if os(iOS)
import UIKit
@@ -388,183 +387,3 @@ struct MacSheetHeader<Leading: View, Center: View, Trailing: View>: View {
.background(EnsuColor.backgroundBase)
}
}
-#else
-import SwiftUI
-
-struct PrimaryButton: View {
- let text: String
- var isLoading: Bool = false
- var isEnabled: Bool = true
- let action: () -> Void
-
- var body: some View {
- Button(text) {
- action()
- }
- .disabled(!isEnabled || isLoading)
- }
-}
-
-struct TextLink: View {
- let text: String
- let action: () -> Void
-
- var body: some View {
- Button(action: action) {
- Text(text)
- .underline()
- }
- }
-}
-
-struct ActionButton: View {
- let icon: String
- var isSystemSymbol: Bool = false
- var tooltip: String? = nil
- var color: Color = .primary
- let action: () -> Void
-
- var body: some View {
- Button(action: action) {
- Group {
- if isSystemSymbol {
- Image(systemName: icon)
- } else {
- Image(icon)
- }
- }
- .frame(width: 36, height: 36)
- }
- .accessibilityLabel(tooltip ?? "")
- }
-}
-
-struct TextActionButton: View {
- let text: String
- let action: () -> Void
-
- var body: some View {
- Button(action: action) {
- Text(text)
- .padding(.horizontal, 4)
- .frame(height: 36)
- }
- }
-}
-
-struct AttachmentChip: View {
- let name: String
- let size: String
- let icon: String
- var isUploading: Bool = false
- var onDelete: (() -> Void)? = nil
-
- var body: some View {
- HStack(spacing: 8) {
- Image(icon)
- .resizable()
- .scaledToFit()
- .frame(width: 14, height: 14)
-
- VStack(alignment: .leading, spacing: 2) {
- Text(name)
- .lineLimit(1)
- Text(size)
- .lineLimit(1)
- }
- .frame(maxWidth: 180, alignment: .leading)
-
- if isUploading {
- ProgressView()
- .scaleEffect(0.7)
- }
-
- if let onDelete {
- Button(action: onDelete) {
- Image(systemName: "xmark")
- }
- .frame(width: 32, height: 32)
- }
- }
- .padding(.horizontal, 10)
- .padding(.vertical, 6)
- }
-}
-
-struct ImageAttachmentThumbnail: View {
- let url: URL?
- let accessibilityLabel: String
- var width: CGFloat
- var height: CGFloat
- var portraitWidth: CGFloat? = nil
- var portraitHeight: CGFloat? = nil
- var squareSize: CGFloat? = nil
- var isUploading: Bool = false
- var onDelete: (() -> Void)? = nil
-
- var body: some View {
- ZStack(alignment: .topTrailing) {
- RoundedRectangle(cornerRadius: 12, style: .continuous)
- .fill(Color.secondary.opacity(0.14))
- .frame(width: width, height: height)
- .overlay {
- Image(systemName: "photo")
- .foregroundStyle(.secondary)
- }
-
- if isUploading {
- ProgressView()
- .frame(width: width, height: height)
- }
-
- if let onDelete {
- Button(action: onDelete) {
- Image(systemName: "xmark")
- }
- .frame(width: 28, height: 28)
- }
- }
- .accessibilityLabel(accessibilityLabel)
- }
-}
-
-struct ToastView: View {
- let message: String
-
- var body: some View {
- Text(message)
- .padding(.horizontal, 16)
- .padding(.vertical, 10)
- }
-}
-
-struct MacSheetHeader<Leading: View, Center: View, Trailing: View>: View {
- let leading: Leading
- let center: Center
- let trailing: Trailing
-
- init(
- @ViewBuilder leading: () -> Leading,
- @ViewBuilder center: () -> Center,
- @ViewBuilder trailing: () -> Trailing
- ) {
- self.leading = leading()
- self.center = center()
- self.trailing = trailing()
- }
-
- var body: some View {
- ZStack {
- center
-
- HStack {
- leading
- Spacer()
- trailing
- }
- }
- .padding(.horizontal, 16)
- .padding(.vertical, 8)
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Components/WhatsNewSheet.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Components/WhatsNewSheet.swift
index 1a1fd4ff37..41d2cded98 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Components/WhatsNewSheet.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Components/WhatsNewSheet.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct WhatsNewSheet: View {
@@ -45,4 +44,3 @@ private struct WhatsNewEntryView: View {
}
}
}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/FeatureFlags.swift b/mobile/native/darwin/Apps/Ensu/Ensu/FeatureFlags.swift
index 59e3ce39f0..a3a3bf4892 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/FeatureFlags.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/FeatureFlags.swift
@@ -1,7 +1,5 @@
-#if canImport(EnteCore)
import Foundation
enum EnsuFeatureFlags {
static let enableImageUploads = true
}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/HomeView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/HomeView.swift
index 113c3af48c..06a3569ef5 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/HomeView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/HomeView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct HomeView: View {
@@ -8,12 +7,3 @@ struct HomeView: View {
ChatView(viewModel: chatModel)
}
}
-#else
-import SwiftUI
-
-struct HomeView: View {
- var body: some View {
- Text("Home unavailable")
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/ModelSettings/ModelSettingsView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/ModelSettings/ModelSettingsView.swift
index 587c718461..c6a29bd50e 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/ModelSettings/ModelSettingsView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/ModelSettings/ModelSettingsView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct ModelSettingsView: View {
@@ -460,13 +459,3 @@ private struct ModelChoice: Identifiable {
self.isCustom = isCustom
}
}
-
-#else
-import SwiftUI
-
-struct ModelSettingsView: View {
- var body: some View {
- Text("Model settings unavailable")
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewContent.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewContent.swift
index 8209132d49..9a67142913 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewContent.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewContent.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import Foundation
struct WhatsNewEntry: Equatable {
@@ -23,4 +22,3 @@ enum WhatsNewContent {
)
]
}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewService.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewService.swift
index 29c45b661d..87e0ad550f 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewService.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Services/WhatsNewService.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import Foundation
struct PendingWhatsNew: Identifiable {
@@ -44,4 +43,3 @@ final class WhatsNewService {
defaults.set(WhatsNewContent.version, forKey: seenVersionKey)
}
}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Settings/LogsView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Settings/LogsView.swift
index fd4e0db04d..0c69ae642e 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Settings/LogsView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Settings/LogsView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
struct LogsView: View {
@@ -436,13 +435,3 @@ private final class MacShareSheet: NSObject {
}
}
#endif
-
-#else
-import SwiftUI
-
-struct LogsView: View {
- var body: some View {
- Text("Logs unavailable")
- }
-}
-#endif
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Settings/SettingsView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Settings/SettingsView.swift
index 109c50fd7f..afbc03c073 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Settings/SettingsView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Settings/SettingsView.swift
@@ -1,4 +1,3 @@
-#if canImport(EnteCore)
import SwiftUI
import Foundation
@@ -431,14 +430,3 @@ private struct SettingsActionItem: Identifiable {
let iconName: String
let action: () -> Void
}
-#else
-import SwiftUI
-
-struct SettingsView: View {
- let onSignIn: () -> Void
-
- var body: some View {
- Text("Settings unavailable")
- }
-}
-#endif