π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
ensu ios: mirror web outro timing and collapse behavior
Prateek Sunal33ee9df92504
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swiftindex 7871db073d..6b6a1e653c 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swift@@ -220,6 +220,7 @@ private enum StreamingCursor {struct StreamingBubbleView: View {let text: Stringlet isGenerating: Bool+ let isOutroPhase: Bool@State private var storageId = UUID().uuidString@@ -231,9 +232,11 @@ struct StreamingBubbleView: View {EnsuBrandIllustration(width: 115,height: 52.5,- outroTrigger: !isGenerating,+ outroTrigger: isOutroPhase,outroInputName: "outro")+ .frame(width: 115, height: 52.5, alignment: .leading)+ .clipped()if hasText {TimelineView(.periodic(from: .now, by: 0.55)) { context indiff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swiftindex 7cf55cdaf9..731a08f093 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift@@ -26,8 +26,9 @@ struct MessageListView: View {@State private var lastScrollChange = ScrollChange()@State private var didInitialScroll = false@State private var suppressAutoScrollAfterGeneration = false- @State private var keepStreamingVisible = false- @State private var outroHideWorkItem: DispatchWorkItem?+ @State private var showStreamingBubble = false+ @State private var streamingWasGenerating = false+ @State private var streamingHideWorkItem: DispatchWorkItem?var body: some View {GeometryReader { proxy in@@ -81,32 +82,38 @@ struct MessageListView: View {.onAppear {lastScrollChange = currentScrollChangedidInitialScroll = false+ showStreamingBubble = isGenerating+ streamingWasGenerating = isGeneratingscheduleInitialScroll(scrollProxy)}.onChange(of: isGenerating) { generating inif generating {- outroHideWorkItem?.cancel()- outroHideWorkItem = nil- keepStreamingVisible = true+ streamingHideWorkItem?.cancel()+ streamingHideWorkItem = nil+ showStreamingBubble = truesuppressAutoScrollAfterGeneration = false} else {suppressAutoScrollAfterGeneration = true- let workItem = DispatchWorkItem {- withAnimation(.easeOut(duration: 0.22)) {- keepStreamingVisible = false+ if streamingWasGenerating {+ let workItem = DispatchWorkItem {+ withAnimation(.easeInOut(duration: 0.30)) {+ showStreamingBubble = false+ }+ suppressAutoScrollAfterGeneration = false+ streamingHideWorkItem = nil}- suppressAutoScrollAfterGeneration = false- outroHideWorkItem = nil+ streamingHideWorkItem?.cancel()+ streamingHideWorkItem = workItem+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.52, execute: workItem)}- outroHideWorkItem?.cancel()- outroHideWorkItem = workItem- DispatchQueue.main.asyncAfter(deadline: .now() + 1.2, execute: workItem)}+ streamingWasGenerating = generating}.onChange(of: sessionId) { _ in- outroHideWorkItem?.cancel()- outroHideWorkItem = nil- keepStreamingVisible = isGenerating+ streamingHideWorkItem?.cancel()+ streamingHideWorkItem = nil+ showStreamingBubble = isGenerating+ streamingWasGenerating = isGenerating}}}@@ -228,17 +235,21 @@ struct MessageListView: View {}- if isGenerating || keepStreamingVisible {- StreamingBubbleView(text: streamingResponse, isGenerating: isGenerating)- .id("streaming")- .transition(streamingTransition)+ if isGenerating || showStreamingBubble {+ StreamingBubbleView(+ text: streamingResponse,+ isGenerating: isGenerating,+ isOutroPhase: !isGenerating && showStreamingBubble+ )+ .id("streaming")+ .transition(streamingTransition)}}.padding(.horizontal, EnsuSpacing.pageHorizontal).padding(.top, EnsuSpacing.lg).padding(.bottom, EnsuSpacing.lg).animation(isGenerating ? .spring(response: 0.35, dampingFraction: 0.86) : nil, value: messages.count)- .animation(.easeOut(duration: 0.22), value: keepStreamingVisible)+ .animation(.easeInOut(duration: 0.30), value: showStreamingBubble)Color.clear.frame(height: contentBottomPadding)diff --git a/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swift b/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swiftindex 4ede33b1ea..4481a09782 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swift@@ -17,20 +17,36 @@ struct EnsuBrandIllustration: View {autoPlay: true)@State private var lastOutroTrigger = false+ @State private var resolvedOutroInputName: String?var body: some View {riveViewModel.view().frame(width: width, height: height, alignment: .leading).onAppear {+ if riveViewModel.riveModel?.stateMachine == nil,+ let fallbackStateMachineName = riveViewModel.riveModel?.artboard?.stateMachineNames().first {+ try? riveViewModel.configureModel(stateMachineName: fallbackStateMachineName)+ }++ if let discoveredOutro = riveViewModel.riveModel?.stateMachine?.inputNames().first(where: {+ $0.lowercased().contains("outro")+ }) {+ resolvedOutroInputName = discoveredOutro+ } else if resolvedOutroInputName == nil {+ resolvedOutroInputName = outroInputName+ }+if animated {riveViewModel.play()} else {riveViewModel.pause()}+ resetOutroInputValue()+if outroTrigger {- riveViewModel.triggerInput(outroInputName)+ fireOutro()lastOutroTrigger = true} else {lastOutroTrigger = false@@ -39,18 +55,47 @@ struct EnsuBrandIllustration: View {.onChange(of: animated) { value inif value {riveViewModel.play()+ resetOutroInputValue()} else {riveViewModel.pause()}}.onChange(of: outroTrigger) { value inif value && !lastOutroTrigger {- riveViewModel.triggerInput(outroInputName)+ fireOutro()+ } else if !value {+ resetOutroInputValue()}lastOutroTrigger = value}.accessibilityLabel("Ensu")}++ private func fireOutro() {+ let inputName = 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)+ }++ 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