Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions iosApp/flare/UI/Component/AgentChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import KotlinSharedUI

struct AgentChatView: View {
let messages: [AgentChatHistoryMessage]
let input: String
let isRunning: Bool
let canSend: Bool
let errorMessage: String?
Expand All @@ -23,7 +22,6 @@ struct AgentChatView: View {

init(
messages: [AgentChatHistoryMessage],
input: String,
isRunning: Bool,
canSend: Bool,
errorMessage: String?,
Expand All @@ -37,7 +35,6 @@ struct AgentChatView: View {
leadingContent: @escaping () -> AnyView = { AnyView(EmptyView()) }
) {
self.messages = messages
self.input = input
self.isRunning = isRunning
self.canSend = canSend
self.errorMessage = errorMessage
Expand Down Expand Up @@ -96,14 +93,6 @@ struct AgentChatView: View {
.onPreferenceChange(AgentChatInputBarHeightPreferenceKey.self) { height in
inputBarHeight = height
}
.onAppear {
draft = input
}
.onChange(of: input) { _, value in
if draft != value {
draft = value
}
}
.onChange(of: draft) { _, value in
onInputChange(value)
}
Comment on lines 96 to 98

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the draft synced with presenter input

When the presenter changes input without a local TextField edit, the iOS draft now stays stale because this is the only remaining binding path. AgentChatPresenterController.selectInputRequestOption can programmatically set input for non-submitting options and clears it for submitting options, so tapping an agent-provided option can leave the visible field different from the presenter state: users may see old text while Send is disabled, or send hidden prefilled text that never appeared in the field. Please preserve a presenter-to-draft sync path while avoiding the original reset issue.

Useful? React with 👍 / 👎.

Expand Down
12 changes: 11 additions & 1 deletion iosApp/flare/UI/Component/CollectionViewTimeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ final class CollectionViewTimelineController: UIViewController, UICollectionView
private var lastRenderHashMap: [String: Int32] = [:]
private var lastLoadedTimelineItemIDs: Set<String> = []
private let autoplayPlayerView = VideoPlayerView()
private var autoplayPlayerObservation: NSKeyValueObservation?
private var autoplaySelectionTask: Task<Void, Never>?
private var autoplayCountdownTask: Task<Void, Never>?
private var postRefreshPoolCleanupTask: Task<Void, Never>?
Expand Down Expand Up @@ -321,6 +322,7 @@ final class CollectionViewTimelineController: UIViewController, UICollectionView
autoplayCountdownTask?.cancel()
postRefreshPoolCleanupTask?.cancel()
deferredPoolCleanupTask?.cancel()
autoplayPlayerObservation?.invalidate()
NotificationCenter.default.removeObserver(self)
}

Expand Down Expand Up @@ -554,6 +556,10 @@ final class CollectionViewTimelineController: UIViewController, UICollectionView
self?.handleAutoplayPlayerStateChanged(state)
}
}
autoplayPlayerObservation =
autoplayPlayerView.playerLayer.observe(\.player, options: [.initial, .new]) { [weak self] _, _ in
self?.configureTimelineAutoplayPlayer()
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleTimelineVideoAutoplayNeedsUpdate),
Expand Down Expand Up @@ -1371,12 +1377,16 @@ final class CollectionViewTimelineController: UIViewController, UICollectionView
currentAutoplayID = candidate.id
currentAutoplayHostView = candidate.hostView
autoplayPlayerView.play(for: candidate.url)
autoplayPlayerView.player?.preventsDisplaySleepDuringVideoPlayback = false
configureTimelineAutoplayPlayer()
autoplayPlayerView.isMuted = true
autoplayPlayerView.isAutoReplay = true
startAutoplayCountdownUpdates()
}

private func configureTimelineAutoplayPlayer() {
autoplayPlayerView.player?.preventsDisplaySleepDuringVideoPlayback = false
}

private func handleAutoplayPlayerStateChanged(_ state: VideoPlayerView.State) {
guard let host = currentAutoplayHostView as? MediaUIView else { return }
switch state {
Expand Down
1 change: 0 additions & 1 deletion iosApp/flare/UI/Screen/AgentChatScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ struct AgentChatScreen: View {
var body: some View {
AgentChatView(
messages: Array(presenter.state.messages),
input: presenter.state.input,
isRunning: presenter.state.room.isRunning,
canSend: presenter.state.canSend,
errorMessage: presenter.state.room.errorMessage,
Expand Down
1 change: 0 additions & 1 deletion iosApp/flare/UI/Screen/LocalHistoryAgentScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ struct LocalHistoryAgentScreen: View {
var body: some View {
AgentChatView(
messages: Array(presenter.state.messages),
input: presenter.state.input,
isRunning: presenter.state.room.isRunning,
canSend: presenter.state.canSend,
errorMessage: presenter.state.room.errorMessage,
Expand Down
1 change: 0 additions & 1 deletion iosApp/flare/UI/Screen/ProfileInsightSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct ProfileInsightSheet: View {
var body: some View {
AgentChatView(
messages: Array(presenter.state.messages),
input: presenter.state.input,
isRunning: presenter.state.room.isRunning,
canSend: presenter.state.canSend,
errorMessage: presenter.state.room.errorMessage,
Expand Down
1 change: 0 additions & 1 deletion iosApp/flare/UI/Screen/StatusInsightSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct StatusInsightSheet: View {
var body: some View {
AgentChatView(
messages: Array(presenter.state.messages),
input: presenter.state.input,
isRunning: presenter.state.room.isRunning,
canSend: presenter.state.canSend,
errorMessage: presenter.state.room.errorMessage,
Expand Down
Loading