Commit cd3e24a2 authored by shigemi miura's avatar shigemi miura

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

parent 65b05c9e
...@@ -61,23 +61,6 @@ struct ChatInputView: View { ...@@ -61,23 +61,6 @@ struct ChatInputView: View {
.padding(5) .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: - テキスト入力 //MARK: - テキスト入力
TextEditor(text: $viewModel.inputText) TextEditor(text: $viewModel.inputText)
.focused($isKeyboardFocused) .focused($isKeyboardFocused)
......
...@@ -43,7 +43,7 @@ struct ChatView: View { ...@@ -43,7 +43,7 @@ struct ChatView: View {
.padding(.bottom, 24) .padding(.bottom, 24)
} }
} else { } else {
AlertChatMessage(message: msg) AlertChatMessage(message: msg, onMediaLoaded: {handleMediaLoaded(proxy: proxy)})
.padding(.bottom, 24) .padding(.bottom, 24)
} }
} }
...@@ -54,9 +54,8 @@ struct ChatView: View { ...@@ -54,9 +54,8 @@ struct ChatView: View {
let id = message.messages.last?.messageId else { return } let id = message.messages.last?.messageId else { return }
totalMediaCount = message.messages.reduce(0) { count, msg in 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) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
proxy.scrollTo(id, anchor: .bottom) proxy.scrollTo(id, anchor: .bottom)
} }
...@@ -194,6 +193,7 @@ struct UpLoadingView: View { ...@@ -194,6 +193,7 @@ struct UpLoadingView: View {
struct AlertChatMessage: View { struct AlertChatMessage: View {
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
var message : ChatMessage var message : ChatMessage
var onMediaLoaded: (() -> Void)? = nil
var body: some View { var body: some View {
switch message.mode { switch message.mode {
...@@ -208,6 +208,9 @@ struct AlertChatMessage: View { ...@@ -208,6 +208,9 @@ struct AlertChatMessage: View {
Rectangle() Rectangle()
.fill(ColorSet.ChatDate.color) .fill(ColorSet.ChatDate.color)
.frame(width: 20, height: 1) .frame(width: 20, height: 1)
.onAppear {
onMediaLoaded?()
}
} }
case ChatMode.normal.rawValue: case ChatMode.normal.rawValue:
HStack() { HStack() {
...@@ -220,9 +223,15 @@ struct AlertChatMessage: View { ...@@ -220,9 +223,15 @@ struct AlertChatMessage: View {
Rectangle() Rectangle()
.fill(ColorSet.ChatDate.color) .fill(ColorSet.ChatDate.color)
.frame(width: 20, height: 1) .frame(width: 20, height: 1)
.onAppear {
onMediaLoaded?()
}
} }
default: default:
EmptyView() EmptyView()
.onAppear {
onMediaLoaded?()
}
} }
} }
} }
......
...@@ -41,6 +41,9 @@ struct MyChatContentView: View { ...@@ -41,6 +41,9 @@ struct MyChatContentView: View {
bottomTrailingRadius: 10, bottomTrailingRadius: 10,
topTrailingRadius: 10 topTrailingRadius: 10
)) ))
.onAppear {
onMediaLoaded?()
}
} }
} }
} }
......
...@@ -46,6 +46,9 @@ struct OtherChatContentView: View { ...@@ -46,6 +46,9 @@ struct OtherChatContentView: View {
bottomTrailingRadius: 0, bottomTrailingRadius: 0,
topTrailingRadius: 10 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