Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#91 사용되지 않는 로직 정리 #153

Merged
merged 1 commit into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions app/src/main/java/com/android/mediproject/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>(ActivityMa
}
}

override fun onRestart() {
super.onRestart()

}


override fun setSplash() {
installSplashScreen()
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/com/android/mediproject/MediApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ import dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
class MediApplication : Application() {

override fun onCreate() {
super.onCreate()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,15 @@ private fun toBaseUri(deepLinkUrl: String, parameter: Map<String, Any?>): Uri =
* @param parameter DeepLink에 들어갈 파라미터
*/
fun NavController.navigateByDeepLink(
deepLinkUrl: String, parameter: BaseNavArgs, navOptions: NavOptions? = null) {
deepLinkUrl: String, parameter: BaseNavArgs, navOptions: NavOptions? = null
) {
val parameterMap = parameter.toMap()
toQueryUri(deepLinkUrl, parameterMap).also { finalUri ->
graph.matchDeepLink(NavDeepLinkRequest(finalUri, null, null))?.also { deepLinkMatch ->
parameterMap.takeIf {
it.isNotEmpty()
}?.forEach { (key, value) ->

value ?: return@forEach

val navType: NavType<out Any?> = when (value) {
is String -> NavType.StringType
is Int -> NavType.IntType
Expand All @@ -100,7 +99,8 @@ fun NavController.navigateByDeepLink(


fun NavController.deepNavigate(
deepLinkUrl: String, parameter: BaseNavArgs, navOptions: NavOptions? = null) {
deepLinkUrl: String, parameter: BaseNavArgs, navOptions: NavOptions? = null
) {
val parameterMap = parameter.toMap()

// "medilenz://main?name={name}&age={age}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import kotlinx.coroutines.flow.flowOf
import javax.inject.Inject

class GranuleIdentificationRepositoryImpl @Inject constructor(
private val dataSource: GranuleIdentificationDataSource) : GranuleIdentificationRepository {
private val dataSource: GranuleIdentificationDataSource
) : GranuleIdentificationRepository {


override fun getGranuleIdentificationInfo(
itemName: String?, entpName: String?, itemSeq: String?) =
itemName: String?, entpName: String?, itemSeq: String?
) =
dataSource.getGranuleIdentificationInfo(itemName = itemName, entpName = entpName, itemSeq = itemSeq).flatMapLatest { result ->
result.fold(onSuccess = { response ->
flowOf(Result.success(response.body!!.items!!.first()))
flowOf(Result.success(response.body.items.first()))
}, onFailure = {
flowOf(Result.failure(it))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class TokenDataSourceImpl @Inject constructor(
refreshToken = newTokensFromAws.refreshToken,
accessToken = newTokensFromAws.accessToken,
accessTokenExpiresIn = newTokensFromAws.accessTokenExpireDateTime,
refreshTokenExpiresIn = (savedToken as EndpointTokenState.SavedToken).token.refreshTokenExpiresIn,
refreshTokenExpiresIn = savedToken.token.refreshTokenExpiresIn,
))

updateTokenState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
abstract class DataGoKrBaseResponse(
) {
abstract class DataGoKrBaseResponse {
@SerialName("header") val header: Header? = null

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import kotlinx.serialization.Serializable


@Serializable
open class BaseAwsQueryResponse() {
open class BaseAwsQueryResponse {
@SerialName("message") val message: String = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
open class BaseAwsSignResponse() {
open class BaseAwsSignResponse {
@SerialName("access_token") val accessToken: String? = null
@SerialName("refresh_token") val refreshToken: String? = null
@SerialName("message") val message: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ class InternetNetworkListener @Inject constructor(@ApplicationContext private va
networkStateCallback?.onChangedState(false)
}

override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities) {
super.onCapabilitiesChanged(network, networkCapabilities)
}

override fun onLinkPropertiesChanged(network: Network, linkProperties: LinkProperties) {
super.onLinkPropertiesChanged(network, linkProperties)
}
}

fun interface NetworkStateCallback {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CommentsListDataSourceImpl(
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, CommentListResponse.Comment> {
return try {
commentsDataSource.getCommentsForAMedicine(medicineId).fold(onSuccess = {
PagingSource.LoadResult.Page(
LoadResult.Page(
data = it.commentList.asReversed(),
prevKey = null,
nextKey = if (it.commentList.size > 100000) 1 else null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RecallSuspensionListDataSourceImpl @Inject constructor(
}
}

override suspend fun load(params: LoadParams<Int>): PagingSource.LoadResult<Int, Item> {
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, Item> {
val currentPage = params.key ?: 1

return try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class HeaderForElementsView constructor(

// title
titleView = TextView(context).apply {
layoutParams = ConstraintLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply {
layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply {
topToTop = LayoutParams.PARENT_ID
bottomToBottom = LayoutParams.PARENT_ID
leftToLeft = LayoutParams.PARENT_ID
Expand All @@ -119,7 +119,7 @@ class HeaderForElementsView constructor(

layoutParams =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20f, resources.displayMetrics).toInt().let { size ->
ConstraintLayout.LayoutParams(size, size).apply {
LayoutParams(size, size).apply {
topToTop = LayoutParams.PARENT_ID
bottomToBottom = LayoutParams.PARENT_ID
leftToRight = titleView.id
Expand All @@ -137,7 +137,7 @@ class HeaderForElementsView constructor(

CircularProgressIndicator(context).apply {
layoutParams =
ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply {
LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply {
topToTop = LayoutParams.PARENT_ID
bottomToBottom = LayoutParams.PARENT_ID
leftToRight = expandBtnView.id
Expand All @@ -154,7 +154,7 @@ class HeaderForElementsView constructor(

// 더 보기 버튼
moreBtnView = TextView(context).apply {
layoutParams = ConstraintLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply {
layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply {
topToTop = LayoutParams.PARENT_ID
bottomToBottom = LayoutParams.PARENT_ID
rightToRight = LayoutParams.PARENT_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class MediSearchbar constructor(

layoutParams =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 28f, resources.displayMetrics).toInt().let { size ->
ConstraintLayout.LayoutParams(size, size).apply {
LayoutParams(size, size).apply {
topToTop = LayoutParams.PARENT_ID
bottomToBottom = LayoutParams.PARENT_ID
rightToRight = LayoutParams.PARENT_ID
Expand All @@ -81,7 +81,7 @@ class MediSearchbar constructor(
searchAiBtnView = TextView(context).apply {
layoutParams =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 28f, resources.displayMetrics).toInt().let { height ->
ConstraintLayout.LayoutParams(LayoutParams.WRAP_CONTENT, height).apply {
LayoutParams(LayoutParams.WRAP_CONTENT, height).apply {
topToTop = LayoutParams.PARENT_ID
bottomToBottom = LayoutParams.PARENT_ID
rightToLeft = searchManualBtnView.id
Expand Down Expand Up @@ -124,7 +124,7 @@ class MediSearchbar constructor(

// edittext
searchEditView = EditText(context).apply {
layoutParams = ConstraintLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT).apply {
layoutParams = LayoutParams(0, LayoutParams.WRAP_CONTENT).apply {
topToTop = LayoutParams.PARENT_ID
bottomToBottom = LayoutParams.PARENT_ID
rightToLeft = searchAiBtnView.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ class ConfirmDialogFragment : DialogFragment() {
viewModel.cameraController.resume()
}

override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ class MedicineCommentsViewModel @Inject constructor(
result.onSuccess {
// 댓글 등록 성공
commentsUseCase.scrollChannel.send(Unit)
_action.emit(CommentActionState.COMPLETED_APPLY_COMMENT_REPLY(Result.success(Unit)))
_action.emit(COMPLETED_APPLY_COMMENT_REPLY(Result.success(Unit)))
}.onFailure {
_action.emit(CommentActionState.COMPLETED_APPLY_COMMENT_REPLY(Result.failure(it)))
_action.emit(COMPLETED_APPLY_COMMENT_REPLY(Result.failure(it)))
}
}
}
Expand All @@ -133,9 +133,9 @@ class MedicineCommentsViewModel @Inject constructor(
result.onSuccess {
// 댓글 등록 성공
commentsUseCase.scrollChannel.send(Unit)
_action.emit(CommentActionState.COMPLETED_APPLY_COMMENT_REPLY(Result.success(Unit)))
_action.emit(COMPLETED_APPLY_COMMENT_REPLY(Result.success(Unit)))
}.onFailure {
_action.emit(CommentActionState.COMPLETED_APPLY_COMMENT_REPLY(Result.failure(it)))
_action.emit(COMPLETED_APPLY_COMMENT_REPLY(Result.failure(it)))
}
}
}
Expand All @@ -153,9 +153,9 @@ class MedicineCommentsViewModel @Inject constructor(
medicineId = medicineBasicInfo.replayCache.last().medicineIdInAws)).collectLatest { result ->
result.onSuccess {
// 댓글 수정 성공
_action.emit(CommentActionState.COMPLETED_APPLY_EDITED_COMMENT(Result.success(Unit)))
_action.emit(COMPLETED_APPLY_EDITED_COMMENT(Result.success(Unit)))
}.onFailure {
_action.emit(CommentActionState.COMPLETED_APPLY_EDITED_COMMENT(Result.failure(it)))
_action.emit(COMPLETED_APPLY_EDITED_COMMENT(Result.failure(it)))
}
}
}
Expand All @@ -172,7 +172,7 @@ class MedicineCommentsViewModel @Inject constructor(
private fun onClickedReply(comment: String, commentId: Long) {
viewModelScope.launch {
replyId.emit(commentId)
_action.emit(CommentActionState.CLICKED_REPLY(comment))
_action.emit(CLICKED_REPLY(comment))
}
}

Expand All @@ -184,7 +184,7 @@ class MedicineCommentsViewModel @Inject constructor(
*/
private fun onClickedDelete(commentId: Long) {
viewModelScope.launch {
_action.tryEmit(CommentActionState.CLICKED_DELETE_MY_COMMENT(commentId))
_action.tryEmit(CLICKED_DELETE_MY_COMMENT(commentId))
}
}

Expand All @@ -198,9 +198,9 @@ class MedicineCommentsViewModel @Inject constructor(
result.onSuccess {
// 댓글 삭제 성공
commentsUseCase.scrollChannel.send(Unit)
_action.emit(CommentActionState.COMPLETED_DELETE_COMMENT(Result.success(Unit)))
_action.emit(COMPLETED_DELETE_COMMENT(Result.success(Unit)))
}.onFailure {
_action.emit(CommentActionState.COMPLETED_DELETE_COMMENT(Result.failure(it)))
_action.emit(COMPLETED_DELETE_COMMENT(Result.failure(it)))
}
}
}
Expand All @@ -218,9 +218,9 @@ class MedicineCommentsViewModel @Inject constructor(
.collectLatest { result ->
result.onSuccess {
// like 처리 완료
_action.emit(CommentActionState.COMPLETED_LIKE(Result.success(Unit)))
_action.emit(COMPLETED_LIKE(Result.success(Unit)))
}.onFailure {
_action.emit(CommentActionState.COMPLETED_LIKE(Result.failure(it)))
_action.emit(COMPLETED_LIKE(Result.failure(it)))
}
}
}
Expand All @@ -237,7 +237,7 @@ class MedicineCommentsViewModel @Inject constructor(
viewModelScope.launch {
// 수정 상태 변경
item.isEditing = !item.isEditing
_action.tryEmit(CommentActionState.CLICKED_EDIT_COMMENT(position))
_action.tryEmit(CLICKED_EDIT_COMMENT(position))
}
}

Expand All @@ -250,7 +250,7 @@ class MedicineCommentsViewModel @Inject constructor(
*/
override fun onClickedSendButton(text: CharSequence) {
viewModelScope.launch {
if (text.isEmpty()) _action.tryEmit(CommentActionState.COMPLETED_APPLY_COMMENT_REPLY(Result.failure(IllegalArgumentException("댓글 내용이 없습니다."))))
if (text.isEmpty()) _action.tryEmit(COMPLETED_APPLY_COMMENT_REPLY(Result.failure(IllegalArgumentException("댓글 내용이 없습니다."))))
else {
if (replyId.value == -1L) {
applyNewComment(text.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class MyCommentsListViewModel @Inject constructor(): BaseViewModel() {
class MyCommentsListViewModel @Inject constructor() : BaseViewModel() {
private val _eventFlow = MutableEventFlow<MyCommentsListEvent>()
val eventFlow = _eventFlow.asEventFlow()

fun event(event : MyCommentsListEvent) = viewModelScope.launch{ _eventFlow.emit(event)}
fun event(event: MyCommentsListEvent) = viewModelScope.launch { _eventFlow.emit(event) }

sealed class MyCommentsListEvent{

}
sealed class MyCommentsListEvent
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class RecentCommentListViewModel @Inject constructor() : BaseViewModel() {
}
class RecentCommentListViewModel @Inject constructor() : BaseViewModel()
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ class HomeViewModel @Inject constructor(
}
}

sealed class HomeEvent {

}
sealed class HomeEvent
}
Loading