Commit cd3e24a2 authored by shigemi miura's avatar shigemi miura

チャットローディング不具合修正

parent 65b05c9e
......@@ -61,23 +61,6 @@ struct ChatInputView: View {
.padding(5)
}
//MARK: - 音声入力ボタン
Button {
viewModel.isRecording.toggle()
if viewModel.isRecording {
speechRecognizer.transcribedText = ""
speechRecognizer.startRecording()
} else {
speechRecognizer.stopRecording()
viewModel.inputText = speechRecognizer.transcribedText
}
} label: {
Image(systemName: viewModel.isRecording ? "mic.fill" : "mic")
.resizable()
.frame(width: 20, height: 20)
.padding(5)
}
//MARK: - テキスト入力
TextEditor(text: $viewModel.inputText)
.focused($isKeyboardFocused)
......
......@@ -43,7 +43,7 @@ struct ChatView: View {
.padding(.bottom, 24)
}
} else {
AlertChatMessage(message: msg)
AlertChatMessage(message: msg, onMediaLoaded: {handleMediaLoaded(proxy: proxy)})
.padding(.bottom, 24)
}
}
......@@ -54,9 +54,8 @@ struct ChatView: View {
let id = message.messages.last?.messageId else { return }
totalMediaCount = message.messages.reduce(0) { count, msg in
count + (msg.type >= 2 ? 1 : 0)
count + (msg.type >= 0 ? 1 : 0)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
proxy.scrollTo(id, anchor: .bottom)
}
......@@ -194,6 +193,7 @@ struct UpLoadingView: View {
struct AlertChatMessage: View {
@Environment(\.colorScheme) var colorScheme
var message : ChatMessage
var onMediaLoaded: (() -> Void)? = nil
var body: some View {
switch message.mode {
......@@ -208,6 +208,9 @@ struct AlertChatMessage: View {
Rectangle()
.fill(ColorSet.ChatDate.color)
.frame(width: 20, height: 1)
.onAppear {
onMediaLoaded?()
}
}
case ChatMode.normal.rawValue:
HStack() {
......@@ -220,9 +223,15 @@ struct AlertChatMessage: View {
Rectangle()
.fill(ColorSet.ChatDate.color)
.frame(width: 20, height: 1)
.onAppear {
onMediaLoaded?()
}
}
default:
EmptyView()
.onAppear {
onMediaLoaded?()
}
}
}
}
......
......@@ -41,6 +41,9 @@ struct MyChatContentView: View {
bottomTrailingRadius: 10,
topTrailingRadius: 10
))
.onAppear {
onMediaLoaded?()
}
}
}
}
......
......@@ -46,6 +46,9 @@ struct OtherChatContentView: View {
bottomTrailingRadius: 0,
topTrailingRadius: 10
))
.onAppear {
onMediaLoaded?()
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment