-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [FEATURE] #36 링크 삭제, 링크 수정, 검색 링크 목록, 링크 상세 조회 API, Datasource, UseCase 구현 * [FEATURE] #36 검색화면 검색 API 연동 * [FEATURE] #36 검색화면 bottomSheet 내 포킷 목록 조회 API 연결 * [FEATURE] #36 검색화면의 link상세 bottomSheet 구현 및 기존 bottomSheet에 공유 제외 클릭 이벤트 연결 * [BASE] #36 data 모듈에 room, sharedPreferences 관련 세팅 및 데이터베이스 구성 * [FEATURE] #36 최근 검색어 관련 기능 구현 * [FEATURE] #36 즐겨찾기 등록/취소 API, datasource, useCase 구현 * [FEATURE] #36 검색 화면에 즐겨찾기 등록/취소 API 연결 * [FIX] #36 페이징 클래스에서 아이템 수정이 반영되지 않는 문제 수정 * [FEATURE] #36 링크 추가, open graph 링크 메타 정보 조회 api, datasource, repository, usecase 구현 * [FEATURE] #36 링크 추가 화면에 링크 추가, 링크 수정, 링크 메타 정보 조회 useCase 연결 * [FIX] #36 링크 추가 화면에서 링크 입력 도중 1초 이상 시간 소요시 키보드를 강제 종료시키는 문제 수정 * [CHORE] #36 ktlint 적용 * [FEATURE] #36 미분류 카테고리 컨텐츠 조회 API, datasource, api 구현 * [FIX] #36 rootNavHost에 링크 추가/삭제 화면 인자 변경 반영
- Loading branch information
Showing
74 changed files
with
2,288 additions
and
289 deletions.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
data/src/main/java/pokitmons/pokit/data/datasource/local/search/LocalSearchWordDataSource.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,54 @@ | ||
package pokitmons.pokit.data.datasource.local.search | ||
|
||
import android.content.SharedPreferences | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.update | ||
import pokitmons.pokit.data.room.dao.SearchWordDao | ||
import pokitmons.pokit.data.room.entity.SearchWord | ||
import java.util.Calendar | ||
import javax.inject.Inject | ||
|
||
class LocalSearchWordDataSource @Inject constructor( | ||
private val searchWordDao: SearchWordDao, | ||
private val sharedPreferences: SharedPreferences, | ||
) : SearchDataSource { | ||
companion object { | ||
const val USE_RECENT_WORD_SP_KEY = "use_recent_word" | ||
} | ||
|
||
private val useRecentSearchWords = MutableStateFlow( | ||
sharedPreferences.getBoolean(USE_RECENT_WORD_SP_KEY, false) | ||
) | ||
|
||
override fun getSearchWord(): Flow<List<String>> { | ||
return searchWordDao.getRecentSearchWords() | ||
} | ||
|
||
override suspend fun addSearchWord(searchWord: String) { | ||
val currentDateString = Calendar.getInstance() | ||
val searchWordEntity = SearchWord( | ||
word = searchWord, | ||
searchedAt = currentDateString.timeInMillis.toString() | ||
) | ||
searchWordDao.addSearchWord(searchWord = searchWordEntity) | ||
} | ||
|
||
override suspend fun removeSearchWord(searchWord: String) { | ||
searchWordDao.removeSearchWord(searchWord) | ||
} | ||
|
||
override suspend fun removeAllSearchWords() { | ||
searchWordDao.removeAllSearchWords() | ||
} | ||
|
||
override suspend fun setUseRecentSearchWord(use: Boolean): Boolean { | ||
sharedPreferences.edit().putBoolean(USE_RECENT_WORD_SP_KEY, use).apply() | ||
useRecentSearchWords.update { use } | ||
return use | ||
} | ||
|
||
override fun getUseRecentSearchWord(): Flow<Boolean> { | ||
return useRecentSearchWords | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
data/src/main/java/pokitmons/pokit/data/datasource/local/search/SearchDataSource.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 pokitmons.pokit.data.datasource.local.search | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface SearchDataSource { | ||
fun getSearchWord(): Flow<List<String>> | ||
suspend fun addSearchWord(searchWord: String) | ||
suspend fun removeSearchWord(searchWord: String) | ||
suspend fun removeAllSearchWords() | ||
suspend fun setUseRecentSearchWord(use: Boolean): Boolean | ||
fun getUseRecentSearchWord(): Flow<Boolean> | ||
} |
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
25 changes: 25 additions & 0 deletions
25
data/src/main/java/pokitmons/pokit/data/di/core/room/RoomModule.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,25 @@ | ||
package pokitmons.pokit.data.di.core.room | ||
|
||
import android.content.Context | ||
import androidx.room.Room | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import pokitmons.pokit.data.room.database.AppDatabase | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object RoomModule { | ||
@Provides | ||
@Singleton | ||
fun provideDatabase(@ApplicationContext context: Context): AppDatabase { | ||
return Room.databaseBuilder(context, AppDatabase::class.java, "pokitDatabase.db").build() | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
fun providerSearchWordDao(database: AppDatabase) = database.searchWordDao() | ||
} |
23 changes: 23 additions & 0 deletions
23
data/src/main/java/pokitmons/pokit/data/di/core/sharedpreferences/SharedPreferencesModule.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,23 @@ | ||
package pokitmons.pokit.data.di.core.sharedpreferences | ||
|
||
import android.content.Context | ||
import android.content.Context.MODE_PRIVATE | ||
import android.content.SharedPreferences | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object SharedPreferencesModule { | ||
@Provides | ||
@Singleton | ||
fun provideSharedPreferences( | ||
@ApplicationContext context: Context, | ||
): SharedPreferences { | ||
return context.getSharedPreferences("pokit_shared_preferences", MODE_PRIVATE) | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
data/src/main/java/pokitmons/pokit/data/di/search/SearchModule.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,23 @@ | ||
package pokitmons.pokit.data.di.search | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import pokitmons.pokit.data.datasource.local.search.LocalSearchWordDataSource | ||
import pokitmons.pokit.data.datasource.local.search.SearchDataSource | ||
import pokitmons.pokit.data.repository.search.SearchRepositoryImpl | ||
import pokitmons.pokit.domain.repository.search.SearchRepository | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class SearchModule { | ||
@Binds | ||
@Singleton | ||
abstract fun bindSearchRepository(searchRepositoryImpl: SearchRepositoryImpl): SearchRepository | ||
|
||
@Binds | ||
@Singleton | ||
abstract fun bindSearchDataSource(searchDataSourceImpl: LocalSearchWordDataSource): SearchDataSource | ||
} |
Oops, something went wrong.