Skip to content

Commit

Permalink
Rollback: preview.mp4
Browse files Browse the repository at this point in the history
preview.mp4 용량 초과로 롤백
  • Loading branch information
sun5066 committed Jul 9, 2024
1 parent aa69fc9 commit dcddca4
Show file tree
Hide file tree
Showing 42 changed files with 302 additions and 129 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
- 직렬화/역직렬화: Moshi, Kotlinx Serialization
- 생체 인식: Jetpack Biometric
- DataBase
- 타임라인, 태그의 데이터는 Jetpack Room에서
- 화면 잠금 여부, 생체 인식 여부, PIN 번호는 Preferences-DataStore에서 관리하고있어요.
- 타임라인, 태그의 데이터는 Jetpack Room에서
- 화면 잠금 여부, 생체 인식 여부, PIN 번호는 Preferences-DataStore에서 관리하고있어요.

# 미리보기

|타임라인|링크휴지통|링크수정|태그관리|
|---|---|---|---|
|<img src="/preview/home.gif" width="300" height="666"/>|<img src="/preview/link_del.gif" width="300" height="666"/>|<img src="/preview/link_edit.gif" width="300" height="666"/>|<img src="/preview/tag_set.gif" width="300" height="666"/>|
<video width="300" height="666" controls>
<source src="/preview/preview.mp4" type="video/mp4">
</video>

ⓒ 2024 Linky - (강성범, 김예진, 추연학, 김민석)
ⓒ 2024 Linky - (강성범, 김예진, 추연학, 김민석)
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ android {
versionName = VersionConstants.VERSION_NAME

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["runnerBuilder"] = "de.mannodermaus.junit5.AndroidJUnit5Builder"
vectorDrawables.useSupportLibrary = true
}

Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ plugins {
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.androidx.room) apply false
alias(libs.plugins.de.mannodermaus.android.junit5) apply false
}
33 changes: 32 additions & 1 deletion core/data-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,52 @@ plugins {
}

android {
namespace = "com.linky.data_base"
namespace = "com.linky.core.data_base"

room {
schemaDirectory("$projectDir/schemas")
}

packagingOptions.resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
merges += "META-INF/LICENSE.md"
merges += "META-INF/LICENSE-notice.md"
}

defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["runnerBuilder"] = "de.mannodermaus.junit5.AndroidJUnit5Builder"
}
}

dependencies {
implementation(projects.core.model)

implementation(libs.androidx.room)
implementation(libs.moshi)
implementation(libs.androidx.paging.testing.android)
ksp(libs.moshi.codegen)

implementation(libs.androidx.room.runtime)
implementation(libs.androidx.room.paging)
ksp(libs.androidx.room.compiler)

androidTestImplementation(libs.junit)
androidTestImplementation(libs.junit.engine)

androidTestImplementation(libs.mannodermaus.test.core)
androidTestRuntimeOnly(libs.mannodermaus.test.runner)

androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.core.testing)
androidTestImplementation(libs.hilt.android.testing)
androidTestImplementation(libs.androidx.room.testing)
androidTestImplementation(libs.androidx.paging.common)

androidTestImplementation(libs.coroutine.test)
androidTestImplementation(libs.mockk.jvm)
androidTestImplementation(libs.mockk.agent)
androidTestImplementation(libs.mockk.android)
androidTestImplementation(libs.orbit.test)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.linky.core.data_base

import android.content.Context
import androidx.paging.PagingConfig
import androidx.paging.PagingSource
import androidx.paging.testing.TestPager
import androidx.test.core.app.ApplicationProvider
import com.linky.core.data_base.link.dao.LinkDao
import com.linky.core.data_base.link.entity.LinkEntity
import com.linky.model.open_graph.OpenGraphData
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

class LinkDaoTest {

private lateinit var database: LinkyDataBase
private lateinit var linkDao: LinkDao
private val moshi = Moshi.Builder().addLast(KotlinJsonAdapterFactory()).build()

@BeforeEach
fun setup() {
val context = ApplicationProvider.getApplicationContext<Context>()
database = LinkyDataBase.build(context, moshi)
linkDao = database.getLinkDao()
}

@AfterEach
fun closeDb() {
database.close()
}

@Test
fun test_LinkDao_insertLink(): Unit = runBlocking {
val link = LinkEntity(
id = null,
memo = "test_memo",
openGraphData = OpenGraphData(
title = "Site_Title",
description = "Site_Desc",
url = "https://example.com",
image = "https://example.com/asdasdasd.jpg",
siteName = "Site_Name",
type = "website",
),
readCount = 0,
createAt = System.currentTimeMillis(),
isRemove = false
)
val id = withContext(Dispatchers.IO) {
linkDao.insert(link)
}

Assertions.assertTrue(id > 0L)
}

@Test
fun test_LinkDao_selectPage(): Unit = runBlocking {
val pager = TestPager(
config = PagingConfig(
pageSize = 20,
enablePlaceholders = false
),
pagingSource = linkDao.selectPage(),
)

val result = pager.refresh() as PagingSource.LoadResult.Page
val loadedData = result.data

println("loadedData.size: ${loadedData.size}")

Assertions.assertTrue(loadedData.isNotEmpty())
}
}
2 changes: 1 addition & 1 deletion core/data-base/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.linky.data_base">
package="com.linky.core.data_base">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.linky.data_base
package com.linky.core.data_base

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.linky.data_base.backup.LinkTagCrossRefBackupDao
import com.linky.data_base.backup.entity.LinkTagCrossRefBackupEntity
import com.linky.data_base.converter.LongTypeListConverter
import com.linky.data_base.converter.OpenGraphDataConverter
import com.linky.data_base.link.dao.LinkDao
import com.linky.data_base.link.dao.LinkTagCrossRefDao
import com.linky.data_base.link.entity.LinkEntity
import com.linky.data_base.link.entity.LinkTagCrossRef
import com.linky.data_base.tag.dao.TagDao
import com.linky.data_base.tag.entity.TagEntity
import com.linky.core.data_base.backup.LinkTagCrossRefBackupDao
import com.linky.core.data_base.backup.entity.LinkTagCrossRefBackupEntity
import com.linky.core.data_base.converter.LongTypeListConverter
import com.linky.core.data_base.converter.OpenGraphDataConverter
import com.linky.core.data_base.link.dao.LinkDao
import com.linky.core.data_base.link.dao.LinkTagCrossRefDao
import com.linky.core.data_base.link.entity.LinkEntity
import com.linky.core.data_base.link.entity.LinkTagCrossRef
import com.linky.core.data_base.tag.dao.TagDao
import com.linky.core.data_base.tag.entity.TagEntity
import com.squareup.moshi.Moshi

@Database(
Expand All @@ -27,7 +27,7 @@ import com.squareup.moshi.Moshi
version = 1
)
@TypeConverters(value = [LongTypeListConverter::class, OpenGraphDataConverter::class])
abstract class LinkDataBase : RoomDatabase() {
abstract class LinkyDataBase : RoomDatabase() {

abstract fun getTagDao(): TagDao
abstract fun getLinkDao(): LinkDao
Expand All @@ -39,7 +39,7 @@ abstract class LinkDataBase : RoomDatabase() {

fun build(context: Context, moshi: Moshi) = Room.databaseBuilder(
context = context,
klass = LinkDataBase::class.java,
klass = LinkyDataBase::class.java,
name = DATABASE_NAME
)
.addTypeConverter(LongTypeListConverter(moshi))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.linky.data_base.backup
package com.linky.core.data_base.backup

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.linky.data_base.backup.entity.LinkTagCrossRefBackupEntity
import com.linky.core.data_base.backup.entity.LinkTagCrossRefBackupEntity

@Dao
interface LinkTagCrossRefBackupDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linky.data_base.backup.entity
package com.linky.core.data_base.backup.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linky.data_base.converter
package com.linky.core.data_base.converter

import androidx.room.ProvidedTypeConverter
import androidx.room.TypeConverter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linky.data_base.converter
package com.linky.core.data_base.converter

import androidx.room.ProvidedTypeConverter
import androidx.room.TypeConverter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.linky.data_base.link.dao
package com.linky.core.data_base.link.dao

import androidx.paging.PagingSource
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.linky.data_base.link.entity.LinkEntity
import com.linky.data_base.link.entity.LinkWithTags
import com.linky.core.data_base.link.entity.LinkEntity
import com.linky.core.data_base.link.entity.LinkWithTags
import kotlinx.coroutines.flow.Flow

@Dao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.linky.data_base.link.dao
package com.linky.core.data_base.link.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.linky.data_base.link.entity.LinkTagCrossRef
import com.linky.core.data_base.link.entity.LinkTagCrossRef

@Dao
interface LinkTagCrossRefDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.linky.data_base.link.data_source
package com.linky.core.data_base.link.data_source

import androidx.paging.PagingSource
import com.linky.data_base.link.entity.LinkEntity
import com.linky.data_base.link.entity.LinkWithTags
import com.linky.data_base.tag.entity.TagEntity
import com.linky.core.data_base.link.entity.LinkEntity
import com.linky.core.data_base.link.entity.LinkWithTags
import com.linky.core.data_base.tag.entity.TagEntity
import com.linky.model.Link
import kotlinx.coroutines.flow.Flow

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.linky.data_base.link.data_source
package com.linky.core.data_base.link.data_source

import androidx.paging.PagingSource
import androidx.room.Transaction
import com.linky.data_base.backup.LinkTagCrossRefBackupDao
import com.linky.data_base.backup.entity.LinkTagCrossRefBackupEntity
import com.linky.data_base.link.dao.LinkDao
import com.linky.data_base.link.dao.LinkTagCrossRefDao
import com.linky.data_base.link.entity.LinkEntity
import com.linky.data_base.link.entity.LinkEntity.Mapper.toLink
import com.linky.data_base.link.entity.LinkTagCrossRef
import com.linky.data_base.link.entity.LinkWithTags
import com.linky.data_base.tag.entity.TagEntity
import com.linky.core.data_base.backup.LinkTagCrossRefBackupDao
import com.linky.core.data_base.backup.entity.LinkTagCrossRefBackupEntity
import com.linky.core.data_base.link.dao.LinkDao
import com.linky.core.data_base.link.dao.LinkTagCrossRefDao
import com.linky.core.data_base.link.entity.LinkEntity
import com.linky.core.data_base.link.entity.LinkEntity.Mapper.toLink
import com.linky.core.data_base.link.entity.LinkTagCrossRef
import com.linky.core.data_base.link.entity.LinkWithTags
import com.linky.core.data_base.tag.entity.TagEntity
import com.linky.model.Link
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linky.data_base.link.entity
package com.linky.core.data_base.link.entity

import androidx.paging.PagingData
import androidx.paging.map
Expand All @@ -9,9 +9,9 @@ import androidx.room.Index
import androidx.room.Junction
import androidx.room.PrimaryKey
import androidx.room.Relation
import com.linky.data_base.link.entity.LinkEntity.Mapper.toLink
import com.linky.data_base.tag.entity.TagEntity
import com.linky.data_base.tag.entity.TagEntity.Companion.toTag
import com.linky.core.data_base.link.entity.LinkEntity.Mapper.toLink
import com.linky.core.data_base.tag.entity.TagEntity
import com.linky.core.data_base.tag.entity.TagEntity.Companion.toTag
import com.linky.model.Link
import com.linky.model.open_graph.OpenGraphData
import kotlinx.coroutines.flow.Flow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.linky.data_base.tag.dao
package com.linky.core.data_base.tag.dao

import androidx.paging.PagingSource
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.linky.data_base.tag.entity.TagEntity
import com.linky.data_base.tag.entity.TagWithLinkCountEntity
import com.linky.data_base.tag.entity.TagWithUsageEntity
import com.linky.core.data_base.tag.entity.TagEntity
import com.linky.core.data_base.tag.entity.TagWithLinkCountEntity
import com.linky.core.data_base.tag.entity.TagWithUsageEntity
import kotlinx.coroutines.flow.Flow

@Dao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.linky.data_base.tag.data_source
package com.linky.core.data_base.tag.data_source

import androidx.paging.PagingSource
import com.linky.data_base.tag.entity.TagEntity
import com.linky.data_base.tag.entity.TagWithLinkCountEntity
import com.linky.data_base.tag.entity.TagWithUsageEntity
import com.linky.core.data_base.tag.entity.TagEntity
import com.linky.core.data_base.tag.entity.TagWithLinkCountEntity
import com.linky.core.data_base.tag.entity.TagWithUsageEntity
import kotlinx.coroutines.flow.Flow

interface TagDataSource {
Expand Down
Loading

0 comments on commit dcddca4

Please sign in to comment.