Skip to content

armgit / ente

Public Imported from GitHub
0

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

Trim unused Ensu app surfaces

Manav Rathib4cd943c2452
diff --git a/mobile/native/android/apps/ensu/data/src/main/java/io/ente/ensu/data/llm/InferenceRsProvider.kt b/mobile/native/android/apps/ensu/data/src/main/java/io/ente/ensu/data/llm/InferenceRsProvider.kt
index bb726b4d38..1166520993 100644
--- a/mobile/native/android/apps/ensu/data/src/main/java/io/ente/ensu/data/llm/InferenceRsProvider.kt
+++ b/mobile/native/android/apps/ensu/data/src/main/java/io/ente/ensu/data/llm/InferenceRsProvider.kt
@@ -6,7 +6,6 @@ import android.net.Uri
import android.os.Environment
import android.util.Log
import io.ente.ensu.domain.device.DeviceCapabilityProvider
-import io.ente.ensu.domain.device.UnknownDeviceCapabilityProvider
import io.ente.ensu.domain.device.requireChatSupported
import io.ente.ensu.domain.llm.DownloadProgress
import io.ente.ensu.domain.llm.GenerationSummary
@@ -55,8 +54,8 @@ import kotlin.math.max
class InferenceRsProvider(
context: Context,
private val modelDir: File,
+ private val deviceCapabilityProvider: DeviceCapabilityProvider,
private val legacyModelDir: File? = null,
- private val deviceCapabilityProvider: DeviceCapabilityProvider = UnknownDeviceCapabilityProvider,
private val ioDispatcher: kotlinx.coroutines.CoroutineDispatcher = Dispatchers.IO
) : LlmProvider {
private data class LoadedModelKey(
diff --git a/mobile/native/android/apps/ensu/data/src/main/java/io/ente/ensu/data/logging/InMemoryLogRepository.kt b/mobile/native/android/apps/ensu/data/src/main/java/io/ente/ensu/data/logging/InMemoryLogRepository.kt
deleted file mode 100644
index 49bdba565c..0000000000
--- a/mobile/native/android/apps/ensu/data/src/main/java/io/ente/ensu/data/logging/InMemoryLogRepository.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.ente.ensu.data.logging
-
-import io.ente.ensu.domain.logging.LogRepository
-import io.ente.ensu.domain.model.LogEntry
-import io.ente.ensu.domain.model.LogLevel
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.asStateFlow
-import kotlinx.coroutines.flow.update
-
-class InMemoryLogRepository : LogRepository {
- private val _logs = MutableStateFlow<List<LogEntry>>(emptyList())
- override val logs: StateFlow<List<LogEntry>> = _logs.asStateFlow()
-
- override fun log(level: LogLevel, message: String, details: String?, tag: String?, throwable: Throwable?) {
- val entry = LogEntryBuilder.buildEntry(
- level = level,
- message = message,
- details = details,
- tag = tag,
- throwable = throwable
- )
- _logs.update { (listOf(entry) + it).take(500) }
- }
-}
diff --git a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/device/ChatDeviceCapability.kt b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/device/ChatDeviceCapability.kt
index ef9b3d6c58..b1b36e46a3 100644
--- a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/device/ChatDeviceCapability.kt
+++ b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/device/ChatDeviceCapability.kt
@@ -26,10 +26,6 @@ interface DeviceCapabilityProvider {
fun chatCapability(): ChatDeviceCapability
}
-object UnknownDeviceCapabilityProvider : DeviceCapabilityProvider {
- override fun chatCapability(): ChatDeviceCapability = ChatDeviceCapability.Unknown
-}
-
class UnsupportedDeviceMemoryException(
val capability: ChatDeviceCapability.UnsupportedLowMemory
) : IllegalStateException("Device does not have enough RAM for local chat")
diff --git a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/logging/LogRepository.kt b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/logging/LogRepository.kt
index dd47c4f1c7..0c6bb18a85 100644
--- a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/logging/LogRepository.kt
+++ b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/logging/LogRepository.kt
@@ -2,7 +2,6 @@ package io.ente.ensu.domain.logging
import io.ente.ensu.domain.model.LogEntry
import io.ente.ensu.domain.model.LogLevel
-import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
interface LogRepository {
@@ -15,10 +14,3 @@ interface LogRepository {
throwable: Throwable? = null
)
}
-
-object NoOpLogRepository : LogRepository {
- private val emptyFlow = MutableStateFlow<List<LogEntry>>(emptyList())
- override val logs: StateFlow<List<LogEntry>> = emptyFlow
-
- override fun log(level: LogLevel, message: String, details: String?, tag: String?, throwable: Throwable?) = Unit
-}
diff --git a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt
index 88cfab8879..50fa22baa7 100644
--- a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt
+++ b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt
@@ -3,10 +3,8 @@ package io.ente.ensu.domain.store
import io.ente.ensu.domain.chat.ChatRepository
import io.ente.ensu.domain.device.ChatDeviceCapability
import io.ente.ensu.domain.device.DeviceCapabilityProvider
-import io.ente.ensu.domain.device.UnknownDeviceCapabilityProvider
import io.ente.ensu.domain.llm.LlmProvider
import io.ente.ensu.domain.logging.LogRepository
-import io.ente.ensu.domain.logging.NoOpLogRepository
import io.ente.ensu.domain.model.Attachment
import io.ente.ensu.domain.model.ChatMessage
import io.ente.ensu.domain.model.EnsuDefaults
@@ -25,10 +23,10 @@ class AppStore(
private val sessionPreferences: SessionPreferences,
private val chatRepository: ChatRepository,
private val llmProvider: LlmProvider,
- private val deviceCapabilityProvider: DeviceCapabilityProvider = UnknownDeviceCapabilityProvider,
+ private val deviceCapabilityProvider: DeviceCapabilityProvider,
val ensuDefaults: EnsuDefaults,
- private val clock: () -> Long = { System.currentTimeMillis() },
- private val logRepository: LogRepository = NoOpLogRepository
+ private val logRepository: LogRepository,
+ private val clock: () -> Long = { System.currentTimeMillis() }
) {
private val _state = MutableStateFlow(AppState())
val state: StateFlow<AppState> = _state.asStateFlow()
diff --git a/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxproj b/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxproj
index b998bac731..3b556eb0b9 100644
--- a/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxproj
+++ b/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.pbxproj
@@ -11,7 +11,6 @@
DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = DAF584662E61BB8300F8A08F /* ZIPFoundation */; };
DB9F1C3C2F9D123400ABCD02 /* Markdown in Frameworks */ = {isa = PBXBuildFile; productRef = DB9F1C3B2F9D123400ABCD02 /* Markdown */; };
DBA3E91C2F7A6B9000AA11BB /* SwiftMath in Frameworks */ = {isa = PBXBuildFile; productRef = DBA3E91B2F7A6B9000AA11BB /* SwiftMath */; };
- DBC1A0032FD0123400ABCD02 /* RiveRuntime in Frameworks */ = {isa = PBXBuildFile; productRef = DBC1A0022FD0123400ABCD02 /* RiveRuntime */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -66,7 +65,6 @@
DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */,
DBA3E91C2F7A6B9000AA11BB /* SwiftMath in Frameworks */,
DB9F1C3C2F9D123400ABCD02 /* Markdown in Frameworks */,
- DBC1A0032FD0123400ABCD02 /* RiveRuntime in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -151,7 +149,6 @@
DAF584662E61BB8300F8A08F /* ZIPFoundation */,
DBA3E91B2F7A6B9000AA11BB /* SwiftMath */,
DB9F1C3B2F9D123400ABCD02 /* Markdown */,
- DBC1A0022FD0123400ABCD02 /* RiveRuntime */,
);
productName = Ensu;
productReference = DA72BC612E5F87A000D128FF /* Ensu.app */;
@@ -189,7 +186,6 @@
DBA3E91A2F7A6B9000AA11BB /* XCRemoteSwiftPackageReference "SwiftMath" */,
DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */,
DB9F1C3A2F9D123400ABCD02 /* XCRemoteSwiftPackageReference "swift-markdown" */,
- DBC1A0012FD0123400ABCD02 /* XCRemoteSwiftPackageReference "rive-ios" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = DA72BC622E5F87A000D128FF /* Products */;
@@ -608,14 +604,6 @@
minimumVersion = 1.7.3;
};
};
- DBC1A0012FD0123400ABCD02 /* XCRemoteSwiftPackageReference "rive-ios" */ = {
- isa = XCRemoteSwiftPackageReference;
- repositoryURL = "https://github.com/rive-app/rive-ios.git";
- requirement = {
- kind = upToNextMajorVersion;
- minimumVersion = 6.9.0;
- };
- };
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
@@ -634,11 +622,6 @@
package = DBA3E91A2F7A6B9000AA11BB /* XCRemoteSwiftPackageReference "SwiftMath" */;
productName = SwiftMath;
};
- DBC1A0022FD0123400ABCD02 /* RiveRuntime */ = {
- isa = XCSwiftPackageProductDependency;
- package = DBC1A0012FD0123400ABCD02 /* XCRemoteSwiftPackageReference "rive-ios" */;
- productName = RiveRuntime;
- };
/* End XCSwiftPackageProductDependency section */
};
rootObject = DA72BC592E5F87A000D128FF /* Project object */;
diff --git a/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index 8f4aaba647..8a8c927e17 100644
--- a/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/mobile/native/apple/apps/ensu/Ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -1,15 +1,6 @@
{
"originHash" : "df4c339047e0bba04154f554ebecda553116891c5ddcb81d37ef7d8676e1f66d",
"pins" : [
- {
- "identity" : "rive-ios",
- "kind" : "remoteSourceControl",
- "location" : "https://github.com/rive-app/rive-ios.git",
- "state" : {
- "revision" : "388cebf85b8fc2258b93f86dd3e26a30fb070fd0",
- "version" : "6.15.1"
- }
- },
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
diff --git a/mobile/native/apple/apps/ensu/Ensu/Chat/DownloadToastView.swift b/mobile/native/apple/apps/ensu/Ensu/Chat/DownloadToastView.swift
deleted file mode 100644
index 02663300d6..0000000000
--- a/mobile/native/apple/apps/ensu/Ensu/Chat/DownloadToastView.swift
+++ /dev/null
@@ -1,173 +0,0 @@
-import SwiftUI
-
-struct DownloadToastView: View {
- let state: DownloadToastState
- let onDismiss: () -> Void
- let onRetry: () -> Void
- let onCancel: () -> Void
-
- private var isComplete: Bool {
- state.phase == .complete
- }
-
- private var hasError: Bool {
- state.phase == .errorDownload || state.phase == .errorLoad
- }
-
- private var title: String {
- switch state.phase {
- case .downloading:
- return "Downloading model"
- case .loading:
- return "Loading model"
- case .complete:
- return "Model ready"
- case .errorDownload:
- return "Model setup failed"
- case .errorLoad:
- return "Model loading failed"
- }
- }
-
- private var iconName: String {
- switch state.phase {
- case .downloading:
- return "Upload01Icon"
- case .loading:
- return "cpu"
- case .complete:
- return "checkmark.circle.fill"
- case .errorDownload, .errorLoad:
- return "exclamationmark.triangle.fill"
- }
- }
-
- private var iconColor: Color {
- switch state.phase {
- case .complete:
- return EnsuColor.success
- case .errorDownload, .errorLoad:
- return EnsuColor.error
- default:
- return EnsuColor.textPrimary
- }
- }
-
- var body: some View {
- VStack(alignment: .leading, spacing: EnsuSpacing.sm) {
- HStack(spacing: EnsuSpacing.md) {
- if iconName.hasSuffix("Icon") {
- Image(iconName)
- .resizable()
- .scaledToFit()
- .frame(width: 20, height: 20)
- .foregroundStyle(iconColor)
- } else {
- Image(systemName: iconName)
- .font(.system(size: 20, weight: .semibold))
- .foregroundStyle(iconColor)
- }
-
- Text(title)
- .font(EnsuTypography.large)
- .foregroundStyle(EnsuColor.textPrimary)
-
- Spacer()
-
- if !isComplete && !hasError {
- Button(action: {
- hapticWarning()
- onCancel()
- }) {
- Image("Cancel01Icon")
- .resizable()
- .scaledToFit()
- .frame(width: 12, height: 12)
- }
- .buttonStyle(.plain)
- .foregroundStyle(EnsuColor.textMuted)
- }
- }
-
- if !hasError {
- ProgressView(value: Double(state.percent) / 100)
- .progressViewStyle(.linear)
- .tint(isComplete ? EnsuColor.success : EnsuColor.accent)
- .frame(height: 4)
- .background(EnsuColor.border)
- .clipShape(RoundedRectangle(cornerRadius: 2, style: .continuous))
- }
-
- HStack {
- StableDownloadStatusText(
- text: state.status,
- font: EnsuFont.message(size: 12, weight: .regular),
- color: hasError ? EnsuColor.error : EnsuColor.textMuted
- )
-
- Spacer()
-
- if !isComplete {
- Text("\(state.percent)%")
- .font(EnsuTypography.mini)
- .foregroundStyle(EnsuColor.textMuted)
- }
- }
-
- if hasError {
- HStack {
- Spacer()
- Button("Dismiss") {
- hapticTap()
- onDismiss()
- }
- .font(EnsuTypography.small)
- .foregroundStyle(EnsuColor.textMuted)
-
- Button(state.offerRetryDownload ? "Retry download" : "Retry") {
- hapticMedium()
- onRetry()
- }
- .font(EnsuTypography.small)
- .foregroundStyle(EnsuColor.action)
- }
- }
- }
- .padding(EnsuSpacing.lg)
- .background(EnsuColor.fillFaint)
- .overlay(
- RoundedRectangle(cornerRadius: EnsuCornerRadius.toast)
- .stroke(EnsuColor.border, lineWidth: 1)
- )
- .clipShape(RoundedRectangle(cornerRadius: EnsuCornerRadius.toast, style: .continuous))
- .shadow(color: .black.opacity(0.12), radius: 12, x: 0, y: 4)
- .padding(.horizontal, EnsuSpacing.lg)
- .transition(.move(edge: .top).combined(with: .opacity))
- }
-}
-
-struct StableDownloadStatusText: View {
- let text: String
- let font: Font
- let color: Color
-
- private var widestText: String {
- guard text.hasPrefix("Downloading... "), let slashRange = text.range(of: " / ") else {
- return text
- }
- return "Downloading... 999.9 MB / \(text[slashRange.upperBound...])"
- }
-
- var body: some View {
- ZStack(alignment: .leading) {
- Text(widestText)
- .hidden()
- .accessibilityHidden(true)
- Text(text)
- }
- .font(font)
- .monospacedDigit()
- .foregroundStyle(color)
- .lineLimit(1)
- }
-}
diff --git a/mobile/native/apple/apps/ensu/Ensu/Chat/StableDownloadStatusText.swift b/mobile/native/apple/apps/ensu/Ensu/Chat/StableDownloadStatusText.swift
new file mode 100644
index 0000000000..4363fc262f
--- /dev/null
+++ b/mobile/native/apple/apps/ensu/Ensu/Chat/StableDownloadStatusText.swift
@@ -0,0 +1,27 @@
+import SwiftUI
+
+struct StableDownloadStatusText: View {
+ let text: String
+ let font: Font
+ let color: Color
+
+ private var widestText: String {
+ guard text.hasPrefix("Downloading... "), let slashRange = text.range(of: " / ") else {
+ return text
+ }
+ return "Downloading... 999.9 MB / \(text[slashRange.upperBound...])"
+ }
+
+ var body: some View {
+ ZStack(alignment: .leading) {
+ Text(widestText)
+ .hidden()
+ .accessibilityHidden(true)
+ Text(text)
+ }
+ .font(font)
+ .monospacedDigit()
+ .foregroundStyle(color)
+ .lineLimit(1)
+ }
+}
diff --git a/mobile/native/apple/apps/ensu/Ensu/Components/DialogViews.swift b/mobile/native/apple/apps/ensu/Ensu/Components/DialogViews.swift
deleted file mode 100644
index 92597bd51a..0000000000
--- a/mobile/native/apple/apps/ensu/Ensu/Components/DialogViews.swift
+++ /dev/null
@@ -1,138 +0,0 @@
-import SwiftUI
-
-enum ChoiceDialogButtonType {
- case normal
- case critical
- case neutral
-
- var color: Color {
- switch self {
- case .critical:
- return EnsuColor.error
- case .neutral:
- return EnsuColor.textMuted
- case .normal:
- return EnsuColor.action
- }
- }
-}
-
-struct ChoiceDialog: View {
- let title: String
- let bodyText: String
- let firstButtonLabel: String
- let secondButtonLabel: String?
- let firstButtonType: ChoiceDialogButtonType
- let isDismissible: Bool
- let onFirst: () -> Void
- let onSecond: (() -> Void)?
-
- @Environment(\.dismiss) private var dismiss
-
- init(
- title: String,
- body: String,
- firstButtonLabel: String,
- secondButtonLabel: String? = nil,
- firstButtonType: ChoiceDialogButtonType = .normal,
- isDismissible: Bool = true,
- onFirst: @escaping () -> Void,
- onSecond: (() -> Void)? = nil
- ) {
- self.title = title
- self.bodyText = body
- self.firstButtonLabel = firstButtonLabel
- self.secondButtonLabel = secondButtonLabel
- self.firstButtonType = firstButtonType
- self.isDismissible = isDismissible
- self.onFirst = onFirst
- self.onSecond = onSecond
- }
-
- var body: some View {
- VStack(alignment: .leading, spacing: EnsuSpacing.md) {
- Text(title)
- .font(EnsuTypography.h3)
- .foregroundStyle(EnsuColor.textPrimary)
-
- Text(bodyText)
- .font(EnsuTypography.body)
- .foregroundStyle(EnsuColor.textPrimary)
-
- HStack {
- if let secondButtonLabel {
- Button(secondButtonLabel) {
- onSecond?()
- dismissIfNeeded()
- }
- .font(EnsuTypography.body)
- .foregroundStyle(EnsuColor.textMuted)
- }
-
- Spacer()
-
- Button(firstButtonLabel) {
- onFirst()
- dismissIfNeeded()
- }
- .font(EnsuTypography.body)
- .foregroundStyle(firstButtonType.color)
- }
- }
- .padding(EnsuSpacing.lg)
- .background(EnsuColor.backgroundBase)
- .clipShape(RoundedRectangle(cornerRadius: EnsuCornerRadius.card, style: .continuous))
- }
-
- private func dismissIfNeeded() {
- if isDismissible {
- dismiss()
- }
- }
-}
-
-struct MissingAttachmentsSheet: View {
- let missingCount: Int
- let allowDownload: Bool
- let onDownload: () -> Void
- let onRunWithout: () -> Void
- let onCancel: () -> Void
-
- var body: some View {
- VStack(alignment: .leading, spacing: EnsuSpacing.md) {
- Text("Attachments missing")
- .font(EnsuTypography.large)
- .foregroundStyle(EnsuColor.textPrimary)
-
- Text("\(missingCount) attachment(s) are missing and need to be downloaded")
- .font(EnsuTypography.body)
- .foregroundStyle(EnsuColor.textPrimary)
-
- if allowDownload {
- PrimaryButton(text: "Download attachments") {
- onDownload()
- }
- }
-
- Button("Run without") {
- onRunWithout()
- }
- .font(EnsuTypography.body)
- .foregroundStyle(EnsuColor.textPrimary)
- .frame(maxWidth: .infinity)
- .padding(.vertical, EnsuSpacing.sm)
- .overlay(
- RoundedRectangle(cornerRadius: EnsuCornerRadius.button)
- .stroke(EnsuColor.border, lineWidth: 1)
- )
-
- Button("Cancel") {
- onCancel()
- }
- .font(EnsuTypography.body)
- .foregroundStyle(EnsuColor.textMuted)
- }
- .padding(EnsuSpacing.lg)
- .presentationDetents([.medium])
- }
-}
diff --git a/mobile/native/apple/apps/ensu/Ensu/Components/EnsuBrandIllustration.swift b/mobile/native/apple/apps/ensu/Ensu/Components/EnsuBrandIllustration.swift
deleted file mode 100644
index b18a23f258..0000000000
--- a/mobile/native/apple/apps/ensu/Ensu/Components/EnsuBrandIllustration.swift
+++ /dev/null
@@ -1,241 +0,0 @@
-import SwiftUI
-
-enum EnsuBrandIllustrationAlignment {
- case centerLeft
- case center
-}
-
-#if canImport(RiveRuntime)
-import RiveRuntime
-
-struct EnsuBrandIllustration: View {
- var width: CGFloat = 92
- var height: CGFloat = 42
- var animated: Bool = true
- var outroTrigger: Bool = false
- var outroInputName: String = "outro"
- var clipsContent: Bool = true
- var riveAlignment: EnsuBrandIllustrationAlignment = .centerLeft
-
- @StateObject private var riveViewModel: RiveViewModel
- @State private var lastOutroTrigger = false
- @State private var resolvedOutroInputName: String?
- @State private var primaryStateMachineName: String?
- @State private var primaryAnimationName: String?
-
- init(
- width: CGFloat = 92,
- height: CGFloat = 42,
- animated: Bool = true,
- outroTrigger: Bool = false,
- outroInputName: String = "outro",
- clipsContent: Bool = true,
- riveAlignment: EnsuBrandIllustrationAlignment = .centerLeft
- ) {
- self.width = width
- self.height = height
- self.animated = animated
- self.outroTrigger = outroTrigger
- self.outroInputName = outroInputName
- self.clipsContent = clipsContent
- self.riveAlignment = riveAlignment
-
- let riveViewModel: RiveViewModel
- switch riveAlignment {
- case .centerLeft:
- riveViewModel = RiveViewModel(
- fileName: "ensu",
- fit: .contain,
- alignment: .centerLeft,
- autoPlay: true
- )
- case .center:
- riveViewModel = RiveViewModel(
- fileName: "ensu",
- fit: .contain,
- alignment: .center,
- autoPlay: true
- )
- }
-
- _riveViewModel = StateObject(wrappedValue: riveViewModel)
- }
-
- @ViewBuilder
- private var riveContent: some View {
- if clipsContent {
- riveViewModel
- .view()
- .frame(width: width, height: height, alignment: .topLeading)
- .clipped()
- .mask(
- Rectangle()
- .frame(width: width, height: height, alignment: .topLeading)
- )
- } else {
- riveViewModel
- .view()
- .frame(width: width, height: height, alignment: .topLeading)
- }
- }
-
- var body: some View {
- riveContent
- .onAppear {
- discoverPlaybackTargets()
-
- if animated {
- restorePrimaryPlayback()
- } else {
- riveViewModel.pause()
- }
-
- if outroTrigger {
- fireOutro()
- lastOutroTrigger = true
- } else {
- lastOutroTrigger = false
- }
- }
- .onChange(of: animated) { value in
- if value {
- restorePrimaryPlayback()
- if outroTrigger {
- fireOutro()
- }
- } else {
- riveViewModel.pause()
- }
- }
- .onChange(of: outroTrigger) { value in
- if value && !lastOutroTrigger {
- fireOutro()
- } else if !value {
- restorePrimaryPlayback()
- }
- lastOutroTrigger = value
- }
- .accessibilityLabel("Ensu")
- }
-
- private func discoverPlaybackTargets() {
- let stateMachines = riveViewModel.riveModel?.artboard?.stateMachineNames() ?? []
- let animations = riveViewModel.riveModel?.artboard?.animationNames() ?? []
-
- if riveViewModel.riveModel?.stateMachine == nil,
- let fallbackStateMachineName = stateMachines.first {
- try? riveViewModel.configureModel(stateMachineName: fallbackStateMachineName)
- }
-
- if primaryStateMachineName == nil {
- primaryStateMachineName = riveViewModel.riveModel?.stateMachine?.name() ?? stateMachines.first
- }
- if primaryAnimationName == nil {
- primaryAnimationName = riveViewModel.riveModel?.animation?.name() ?? animations.first
- }
-
- if let discoveredOutro = riveViewModel.riveModel?.stateMachine?.inputNames().first(where: {
- $0.lowercased().contains("outro")
- }) {
- resolvedOutroInputName = discoveredOutro
- } else if resolvedOutroInputName == nil {
- resolvedOutroInputName = outroInputName
- }
- }
-
- private func restorePrimaryPlayback() {
- if let stateMachine = primaryStateMachineName {
- try? riveViewModel.configureModel(stateMachineName: stateMachine)
- } else if let animation = primaryAnimationName {
- try? riveViewModel.configureModel(animationName: animation)
- }
- resetOutroInputValue()
- if animated {
- riveViewModel.play()
- }
- }
-
- private func fireOutro() {
- discoverPlaybackTargets()
-
- let inputName: String = {
- let availableInputs = riveViewModel.riveModel?.stateMachine?.inputNames() ?? []
- if let resolvedOutroInputName,
- availableInputs.contains(resolvedOutroInputName) {
- return resolvedOutroInputName
- }
- if let match = availableInputs.first(where: { $0.lowercased() == outroInputName.lowercased() }) {
- return match
- }
- if let match = availableInputs.first(where: { $0.lowercased().contains("outro") }) {
- return match
- }
- return resolvedOutroInputName ?? outroInputName
- }()
-
- if let boolInput = riveViewModel.boolInput(named: inputName) {
- boolInput.setValue(true)
- riveViewModel.play()
- return
- }
-
- if let numberInput = riveViewModel.numberInput(named: inputName) {
- numberInput.setValue(1)
- riveViewModel.play()
- return
- }
-
- riveViewModel.triggerInput(inputName)
- riveViewModel.play()
- }
-
- private func resetOutroInputValue() {
- let inputName = resolvedOutroInputName ?? outroInputName
- if let boolInput = riveViewModel.boolInput(named: inputName) {
- boolInput.setValue(false)
- return
- }
- if let numberInput = riveViewModel.numberInput(named: inputName) {
- numberInput.setValue(0)
- }
- }
-}
-
-#else
-
-struct EnsuBrandIllustration: View {
- var width: CGFloat = 92
- var height: CGFloat = 42
- var animated: Bool = true
- var outroTrigger: Bool = false
- var outroInputName: String = "outro"
- var clipsContent: Bool = true
- var riveAlignment: EnsuBrandIllustrationAlignment = .centerLeft
-
- @State private var isAnimating = false
-
- var body: some View {
- let activePhase = animated ? isAnimating : true
-
- Image("EnsuLogoForeground")
- .resizable()
- .scaledToFit()
- .frame(width: width, height: height, alignment: .leading)
- .scaleEffect(activePhase ? 1 : 0.94)
- .opacity(activePhase ? 1 : 0.84)
- .animation(
- animated ? .easeInOut(duration: 0.9).repeatForever(autoreverses: true) : nil,
- value: isAnimating
- )
- .onAppear {
- guard animated else { return }
- isAnimating = true
- }
- .onDisappear {
- isAnimating = false
- }
- .accessibilityLabel("Ensu")
- }
-}
-
-#endif
diff --git a/mobile/native/apple/apps/ensu/Ensu/Components/EnsuComponents.swift b/mobile/native/apple/apps/ensu/Ensu/Components/EnsuComponents.swift
index 5ac00120ed..cf3446049e 100644
--- a/mobile/native/apple/apps/ensu/Ensu/Components/EnsuComponents.swift
+++ b/mobile/native/apple/apps/ensu/Ensu/Components/EnsuComponents.swift
@@ -64,24 +64,6 @@ struct StyledTextField: View {
}
}
-struct TextLink: View {
- let text: String
- let action: () -> Void
-
- var body: some View {
- Button(action: {
- hapticTap()
- action()
- }) {
- Text(text)
- .font(EnsuFont.ui(size: 14, weight: .semibold))
- .underline()
- }
- .buttonStyle(.plain)
- .foregroundStyle(EnsuColor.action)
- }
-}
-
struct ActionButton: View {
let icon: String
var isSystemSymbol: Bool = false
diff --git a/mobile/native/apple/apps/ensu/Ensu/ensu.riv b/mobile/native/apple/apps/ensu/Ensu/ensu.riv
deleted file mode 100644
index 9eb57731ca..0000000000
Binary files a/mobile/native/apple/apps/ensu/Ensu/ensu.riv and /dev/null differ
diff --git a/rust/apps/ensu/src-tauri/src/commands.rs b/rust/apps/ensu/src-tauri/src/commands.rs
index be382bbc52..79bda355ab 100644
--- a/rust/apps/ensu/src-tauri/src/commands.rs
+++ b/rust/apps/ensu/src-tauri/src/commands.rs
@@ -1,6 +1,6 @@
use std::collections::HashMap;
use std::fs;
-use std::io::{Read, Write};
+use std::io::Read;
use std::panic::{AssertUnwindSafe, catch_unwind};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
@@ -1431,25 +1431,6 @@ pub async fn fs_read_head(path: String, length: usize) -> Result<Vec<u8>, ApiErr
.map_err(|_| fs_thread_error())?
}
-#[tauri::command]
-pub async fn fs_append_bytes(path: String, bytes: Vec<u8>) -> Result<(), ApiError> {
- async_runtime::spawn_blocking(move || {
- if bytes.is_empty() {
- return Ok(());
- }
- let mut file = fs::OpenOptions::new()
- .create(true)
- .append(true)
- .open(&path)
- .map_err(|err| ApiError::new("io", err.to_string()))?;
- file.write_all(&bytes)
- .map_err(|err| ApiError::new("io", err.to_string()))?;
- Ok(())
- })
- .await
- .map_err(|_| fs_thread_error())?
-}
-
fn normalize_sender(sender: &str) -> Result<&'static str, ApiError> {
match sender {
"self" => Ok("self"),
@@ -1465,16 +1446,6 @@ fn parse_uuid(value: &str) -> Result<Uuid, ApiError> {
Uuid::parse_str(value).map_err(|err| ApiError::new("uuid", err.to_string()))
}
-#[tauri::command]
-pub async fn chat_db_compress_attachment_image(data: Vec<u8>) -> Result<Vec<u8>, ApiError> {
- async_runtime::spawn_blocking(move || {
- ensu_db::compress_attachment_image(&data)
- .map_err(|err| ApiError::new("image", err.to_string()))
- })
- .await
- .map_err(|_| image_thread_error())?
-}
-
#[tauri::command]
pub async fn chat_db_compress_attachment_image_file(path: String) -> Result<Vec<u8>, ApiError> {
async_runtime::spawn_blocking(move || {
diff --git a/rust/apps/ensu/src-tauri/src/main.rs b/rust/apps/ensu/src-tauri/src/main.rs
index c8c0c0cc3a..dc41cd7124 100644
--- a/rust/apps/ensu/src-tauri/src/main.rs
+++ b/rust/apps/ensu/src-tauri/src/main.rs
@@ -52,7 +52,6 @@ fn main() {
commands::chat_db_update_message_text,
commands::chat_db_upsert_session,
commands::chat_db_insert_message_with_uuid,
- commands::chat_db_compress_attachment_image,
commands::chat_db_compress_attachment_image_file,
commands::chat_db_reset,
commands::chat_db_migrate_legacy,
@@ -70,7 +69,6 @@ fn main() {
commands::llm_cancel_model_download,
commands::fs_file_size,
commands::fs_read_head,
- commands::fs_append_bytes,
])
.build(tauri::generate_context!())
.unwrap_or_else(|err| {