-
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 #100 from kakao-tech-campus-2nd-step3/Develop
[Update] Weekly9 과제 제출
- Loading branch information
Showing
83 changed files
with
1,958 additions
and
490 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
5 changes: 3 additions & 2 deletions
5
core/data/src/main/java/com/iguana/data/di/AuthInterceptor.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
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
28 changes: 28 additions & 0 deletions
28
core/data/src/main/java/com/iguana/data/local/dao/AnnotationDao.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,28 @@ | ||
package com.iguana.data.local.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import com.iguana.data.local.entity.AnnotationEntity | ||
|
||
@Dao | ||
interface AnnotationDao { | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
fun insertAnnotation(annotation: AnnotationEntity) | ||
|
||
@Query("SELECT * FROM annotations WHERE documentId = :documentId AND pageNumber = :pageNumber") | ||
fun getAnnotationsByPage(documentId: Long, pageNumber: Int): List<AnnotationEntity> | ||
|
||
@Query("DELETE FROM annotations WHERE id = :id") | ||
fun deleteAnnotation(id: Long) | ||
@Query("UPDATE annotations SET content = :content, xPosition = :xPosition, yPosition = :yPosition WHERE id = :id") | ||
fun updateAnnotation(id: Long, content: String, xPosition: Float, yPosition: Float) | ||
|
||
@Query("DELETE FROM annotations WHERE documentId = :documentId") | ||
fun deleteAnnotationsByDocument(documentId: Long) | ||
|
||
@Query("DELETE FROM annotations") | ||
fun clearAnnotations() | ||
} |
19 changes: 19 additions & 0 deletions
19
core/data/src/main/java/com/iguana/data/local/dao/PageTurnEventDao.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,19 @@ | ||
package com.iguana.data.local.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
import com.iguana.data.local.entity.PageTurnEventEntity | ||
|
||
@Dao | ||
interface PageTurnEventDao { | ||
|
||
@Insert | ||
fun insert(event: PageTurnEventEntity) | ||
|
||
@Query("SELECT * FROM page_turn_events WHERE documentId = :documentId") | ||
fun getEventsByDocumentId(documentId: Long): List<PageTurnEventEntity> | ||
|
||
@Query("DELETE FROM page_turn_events WHERE documentId = :documentId") | ||
fun deleteEventsByDocumentId(documentId: Long) : Int | ||
} |
15 changes: 8 additions & 7 deletions
15
core/data/src/main/java/com/iguana/data/local/db/AppDatabase.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,17 +1,18 @@ | ||
package com.iguana.data.local.db | ||
|
||
import android.content.Context | ||
import androidx.room.Database | ||
import androidx.room.Room | ||
import androidx.room.RoomDatabase | ||
import androidx.sqlite.db.SupportSQLiteDatabase | ||
import com.iguana.data.local.dao.AnnotationDao | ||
import com.iguana.data.local.dao.RecentFileDao | ||
import com.iguana.data.local.dao.PageTurnEventDao | ||
import com.iguana.data.local.entity.AnnotationEntity | ||
import com.iguana.data.local.entity.PageTurnEventEntity | ||
import com.iguana.data.local.entity.RecentFileEntity | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
|
||
@Database(entities = [RecentFileEntity::class], version = 1, exportSchema = false) | ||
@Database(entities = [RecentFileEntity::class, PageTurnEventEntity::class, AnnotationEntity::class], version = 1, exportSchema = false) | ||
abstract class AppDatabase : RoomDatabase() { | ||
abstract fun recentFileDao(): RecentFileDao | ||
abstract fun pageTurnEventDao(): PageTurnEventDao | ||
|
||
abstract fun annotationDao(): AnnotationDao | ||
} |
17 changes: 17 additions & 0 deletions
17
core/data/src/main/java/com/iguana/data/local/entity/AnnotationEntity.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,17 @@ | ||
package com.iguana.data.local.entity | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
|
||
@Entity(tableName = "annotations") | ||
data class AnnotationEntity( | ||
@PrimaryKey(autoGenerate = true) val id: Long = 0, | ||
val documentId: Long, // 외래 키로 사용될 문서 ID | ||
val pageNumber: Int, // 주석이 있는 페이지 번호 | ||
val xPosition: Float, // x 좌표 | ||
val yPosition: Float, // y 좌표 | ||
val content: String, // 주석 텍스트 | ||
val width: Float, // 너비 | ||
val height: Float // 높이 | ||
) |
13 changes: 13 additions & 0 deletions
13
core/data/src/main/java/com/iguana/data/local/entity/PageTurnEventEntity.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,13 @@ | ||
package com.iguana.data.local.entity | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "page_turn_events") | ||
data class PageTurnEventEntity( | ||
@PrimaryKey(autoGenerate = true) val id: Long = 0, | ||
val documentId: 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
Oops, something went wrong.