음성메시지 보관/삭제/답장 추가
This commit is contained in:
parent
4611524f8f
commit
f08d72745e
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ic_record.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ic_record_pause.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
SodaLive/Resources/Assets.xcassets/ic_record_pause.imageset/ic_record_pause.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/ic_record_pause.imageset/ic_record_pause.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ic_record_play.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
SodaLive/Resources/Assets.xcassets/ic_record_play.imageset/ic_record_play.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/ic_record_play.imageset/ic_record_play.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ic_record_stop.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
SodaLive/Resources/Assets.xcassets/ic_record_stop.imageset/ic_record_stop.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/ic_record_stop.imageset/ic_record_stop.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ic_save.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 443 B |
|
@ -41,11 +41,21 @@ struct VoiceMessageView: View {
|
|||
viewModel.isShowPopup = true
|
||||
return
|
||||
} else {
|
||||
viewModel.keepVoiceMessage()
|
||||
}
|
||||
},
|
||||
onClickReply: {
|
||||
viewModel.selectedMessageId = item.messageId
|
||||
soundManager.stopAudio()
|
||||
AppState.shared.setAppStep(
|
||||
step: .writeVoiceMessage(
|
||||
userId: item.senderId,
|
||||
nickname: item.senderNickname,
|
||||
onRefresh: {
|
||||
viewModel.refresh()
|
||||
}
|
||||
)
|
||||
)
|
||||
},
|
||||
onClickDelete: {
|
||||
viewModel.selectedMessageId = item.messageId
|
||||
|
@ -180,6 +190,7 @@ struct VoiceMessageView: View {
|
|||
.multilineTextAlignment(.leading)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(20)
|
||||
.padding(.top, 66.7)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,6 +116,52 @@ final class VoiceMessageViewModel: ObservableObject {
|
|||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
func keepVoiceMessage() {
|
||||
if selectedMessageId <= 0 {
|
||||
errorMessage = "메시지를 저장하지 못했습니다\n잠시 후 다시 시도해 주세요."
|
||||
isShowPopup = true
|
||||
return
|
||||
}
|
||||
|
||||
isLoading = true
|
||||
repository.keepVoiceMessage(messageId: selectedMessageId)
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
DEBUG_LOG("finish")
|
||||
case .failure(let error):
|
||||
ERROR_LOG(error.localizedDescription)
|
||||
}
|
||||
} receiveValue: { [unowned self] response in
|
||||
self.isLoading = false
|
||||
let responseData = response.data
|
||||
|
||||
do {
|
||||
let jsonDecoder = JSONDecoder()
|
||||
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
||||
|
||||
if decoded.success {
|
||||
self.errorMessage = "보관되었습니다."
|
||||
self.isShowPopup = true
|
||||
self.refresh()
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
self.errorMessage = message
|
||||
self.isShowPopup = true
|
||||
} else {
|
||||
self.errorMessage = "메시지를 보관하지 못했습니다.\n잠시 후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
self.isShowPopup = true
|
||||
}
|
||||
} catch {
|
||||
self.errorMessage = "메시지를 보관하지 못했습니다.\n잠시 후 다시 시도해 주세요."
|
||||
self.isShowPopup = true
|
||||
}
|
||||
}
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
func keepTextMessage() {
|
||||
if selectedMessageId <= 0 {
|
||||
errorMessage = "메시지를 저장하지 못했습니다\n잠시 후 다시 시도해 주세요."
|
||||
|
|
Loading…
Reference in New Issue