-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from aengzu/feature/record
[Feat] 녹음 기능 구현
- Loading branch information
Showing
29 changed files
with
877 additions
and
187 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
core/domain/src/main/java/com/iguana/domain/model/record/PageTurnEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package com.iguana.domain.model.record | ||
|
||
data class PageTurnEvent ( | ||
data class PageTurnEvent( | ||
val documentId: Long, | ||
val pageNumber: Int, | ||
val timestamp: Long | ||
val prevPage : Int, | ||
val nextPage : Int, | ||
val timestamp: Double | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
core/domain/src/main/java/com/iguana/domain/usecase/DeletePageTurnEventsUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.iguana.domain.usecase | ||
|
||
import com.iguana.domain.repository.RecordRepository | ||
import javax.inject.Inject | ||
|
||
class DeletePageTurnEventsUseCase @Inject constructor( | ||
private val recordRepository: RecordRepository | ||
) { | ||
suspend operator fun invoke(documentId: Long) { | ||
recordRepository.deletePageTurnEvents(documentId) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
core/domain/src/main/java/com/iguana/domain/usecase/DeleteRecordingUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.iguana.domain.usecase | ||
|
||
import com.iguana.domain.repository.RecordRepository | ||
import javax.inject.Inject | ||
|
||
class DeleteRecordingUseCase @Inject constructor( | ||
private val recordRepository: RecordRepository | ||
) { | ||
suspend operator fun invoke(filePath: String) { | ||
recordRepository.deleteRecordingFile(filePath) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
core/domain/src/main/java/com/iguana/domain/usecase/SavePageTurnEventUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.iguana.domain.usecase | ||
import com.iguana.domain.model.record.PageTurnEvent | ||
import com.iguana.domain.repository.RecordRepository | ||
import javax.inject.Inject | ||
|
||
class SavePageTurnEventUseCase @Inject constructor( | ||
private val recordRepository: RecordRepository | ||
) { | ||
suspend operator fun invoke(documentId: Long, prevPage: Int?, currentPage: Int, startTimeMillis: Long) { | ||
// 현재 시간과 녹음 시작 시간을 바탕으로 초 단위 타임스탬프 계산 | ||
val timestamp = (System.currentTimeMillis() - startTimeMillis) / 1000.0 | ||
|
||
// PageTurnEvent 생성 | ||
val event = PageTurnEvent( | ||
documentId = documentId, | ||
prevPage = prevPage ?: currentPage, | ||
nextPage = currentPage, | ||
timestamp = timestamp | ||
) | ||
|
||
// Repository를 통해 이벤트 저장 | ||
recordRepository.savePageTurnEvents(documentId, event) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
core/domain/src/main/java/com/iguana/domain/usecase/UploadPageTurnEventsUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.iguana.domain.usecase | ||
|
||
import com.iguana.domain.model.record.PageTurnEvent | ||
import com.iguana.domain.repository.RecordRepository | ||
import javax.inject.Inject | ||
|
||
class UploadPageTurnEventsUseCase @Inject constructor( | ||
private val recordRepository: RecordRepository | ||
) { | ||
suspend operator fun invoke(documentId: Long, recordingId: Long) { | ||
val events = recordRepository.loadPageTurnEvents(documentId) | ||
recordRepository.uploadPageTurnEvents(recordingId, events) | ||
} | ||
} |
Oops, something went wrong.