Skip to content

Commit

Permalink
Merge pull request #20 from eshc123/feature/#1-usecase
Browse files Browse the repository at this point in the history
[FEATURE] #1 UseCase 추가 및 Repository, DataSource 인터페이스 수정
  • Loading branch information
eshc123 committed Sep 16, 2022
2 parents 82ed2d4 + 00775ee commit c5d112c
Show file tree
Hide file tree
Showing 20 changed files with 118 additions and 5 deletions.
4 changes: 4 additions & 0 deletions data/src/main/java/com/eshc/data/source/IssueDataSource.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.eshc.data.source

import com.eshc.domain.model.Issue
import io.reactivex.rxjava3.core.Single

interface IssueDataSource {
fun getIssues(state : String) : Single<Result<List<Issue>>>
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package com.eshc.data.source

import com.eshc.domain.model.Notification
import io.reactivex.rxjava3.core.Single

interface NotificationDataSource {
fun getNotifications() : Single<Result<List<Notification>>>

fun updateNotificationAsRead()
}
4 changes: 4 additions & 0 deletions data/src/main/java/com/eshc/data/source/RepoDataSource.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.eshc.data.source

import com.eshc.domain.model.Repo
import io.reactivex.rxjava3.core.Single

interface RepoDataSource {
fun getRepos() : Single<Result<List<Repo>>>
}
4 changes: 4 additions & 0 deletions data/src/main/java/com/eshc/data/source/UserDataSource.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.eshc.data.source

import com.eshc.domain.model.User
import io.reactivex.rxjava3.core.Single

interface UserDataSource {
fun getUser() : Single<Result<User>>
}
9 changes: 9 additions & 0 deletions domain/src/main/java/com/eshc/domain/model/Issue.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.eshc.domain.model

data class Issue(
val id : Int,
val repo : Repo,
val state : String,
val title : String,
val updatedAt : String
)
10 changes: 10 additions & 0 deletions domain/src/main/java/com/eshc/domain/model/Notification.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.eshc.domain.model

data class Notification(
val id : Int,
val repo : Repo,
val updatedAt : String,
val unread : Boolean,
val comments: Int,
val issueNum : Int
)
10 changes: 10 additions & 0 deletions domain/src/main/java/com/eshc/domain/model/Repo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.eshc.domain.model

data class Repo(
val id : Int,
val name : String,
val description : String,
val stargazersCount : Int,
val language : String,
val fullName : String
)
14 changes: 14 additions & 0 deletions domain/src/main/java/com/eshc/domain/model/User.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.eshc.domain.model

data class User(
val id : Int,
val avatarUrl : String,
val name : String,
val blog : String,
val location : String,
val email : String,
val bio : String,
val publicRepos : Int,
val followers : Int,
val following : Int
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.eshc.domain.repository

import com.eshc.domain.model.Issue
import io.reactivex.rxjava3.core.Single

interface IssueRepository {
fun getIssues(state : String) : Single<Result<List<Issue>>>
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package com.eshc.domain.repository

import com.eshc.domain.model.Notification
import io.reactivex.rxjava3.core.Single

interface NotificationRepository {
fun getNotifications() : Single<Result<List<Notification>>>

fun updateNotificationAsRead()
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.eshc.domain.repository

import com.eshc.domain.model.Repo
import io.reactivex.rxjava3.core.Single

interface RepoRepository {
fun getRepos() : Single<Result<List<Repo>>>
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.eshc.domain.repository

import com.eshc.domain.model.User
import io.reactivex.rxjava3.core.Single

interface UserRepository {
fun getUser() : Single<Result<User>>
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.eshc.domain.usecase
package com.eshc.domain.usecase.auth

import com.eshc.domain.repository.AuthRepository
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.schedulers.Schedulers
import javax.inject.Inject

class GetAccessTokenUseCase @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.eshc.domain.usecase.issue

class GetIssuesUseCase() {
operator fun invoke() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.eshc.domain.usecase.notification

class GetNotificationsUseCase() {
operator fun invoke() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.eshc.domain.usecase.notification

class UpdateNotificationAsReadUseCase() {
operator fun invoke() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.eshc.domain.usecase.repo

class GetReposUseCase() {
operator fun invoke() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.eshc.domain.usecase.user

class GetUserProfileUseCase() {
operator fun invoke() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package com.eshc.feature.login

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.net.toUri
import androidx.databinding.DataBindingUtil
import com.eshc.feature.home.HomeActivity
import com.eshc.feature.login.common.GITHUB_AUTH
import com.eshc.feature.login.databinding.ActivityLoginBinding
import dagger.hilt.android.AndroidEntryPoint
Expand Down Expand Up @@ -51,6 +51,7 @@ class LoginActivity : AppCompatActivity() {
private fun initObserver(){
viewModel.uiState.observe(this){ loginUiState ->
if(loginUiState.hasAccessToken) {
startActivity(Intent(this, HomeActivity::class.java))
finish()
}
if(loginUiState.error.isNotEmpty()){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.eshc.feature.login

import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.eshc.domain.usecase.GetAccessTokenUseCase
import com.eshc.domain.usecase.auth.GetAccessTokenUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
Expand Down

0 comments on commit c5d112c

Please sign in to comment.