generated from DO-SOPT-ANDROID/do-sopt-android-repo-template
-
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.
Merge pull request #10 from DO-SOPT-ANDROID/appjam-refactor
Appjam refactor
- Loading branch information
Showing
53 changed files
with
532 additions
and
249 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.sopt.dosopttemplate | ||
|
||
import android.app.Application | ||
import androidx.appcompat.app.AppCompatDelegate | ||
import dagger.hilt.android.HiltAndroidApp | ||
|
||
@HiltAndroidApp | ||
class App : Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/org/sopt/dosopttemplate/data/datasource/FollowerDataSource.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 org.sopt.dosopttemplate.data.datasource | ||
|
||
import org.sopt.dosopttemplate.data.entity.response.ResponseFollowerDto | ||
import org.sopt.dosopttemplate.data.entity.service.FollowerService | ||
import javax.inject.Inject | ||
|
||
class FollowerDataSource @Inject constructor( | ||
private val followerService: FollowerService | ||
) { | ||
suspend fun follower(): ResponseFollowerDto = | ||
followerService.follower() | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/sopt/dosopttemplate/data/datasource/LoginDataSource.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 org.sopt.dosopttemplate.data.datasource | ||
|
||
import org.sopt.dosopttemplate.data.entity.request.RequestLoginDto | ||
import org.sopt.dosopttemplate.data.entity.response.ResponseLoginDto | ||
import org.sopt.dosopttemplate.data.entity.service.LoginService | ||
import javax.inject.Inject | ||
|
||
class LoginDataSource @Inject constructor( | ||
private val loginService: LoginService | ||
) { | ||
suspend fun login(request: RequestLoginDto): ResponseLoginDto = | ||
loginService.login(request) | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/org/sopt/dosopttemplate/data/datasource/SignUpDataSource.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,11 @@ | ||
package org.sopt.dosopttemplate.data.datasource | ||
|
||
import org.sopt.dosopttemplate.data.entity.request.RequestSignUpDto | ||
import org.sopt.dosopttemplate.data.entity.service.SignUpService | ||
import javax.inject.Inject | ||
|
||
class SignUpDataSource @Inject constructor( | ||
private val signUpService: SignUpService | ||
) { | ||
suspend fun signUp(request: RequestSignUpDto) = signUpService.signUp(request) | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/sopt/dosopttemplate/data/entity/LoginState.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,9 @@ | ||
package org.sopt.dosopttemplate.data.entity | ||
|
||
import org.sopt.dosopttemplate.data.entity.response.ResponseLoginDto | ||
|
||
sealed class LoginState { | ||
object Loading : LoginState() | ||
data class Success(val data: ResponseLoginDto.UserInfo) : LoginState() | ||
object Error : LoginState() | ||
} |
2 changes: 1 addition & 1 deletion
2
...ate/data/model/request/RequestLoginDto.kt → ...te/data/entity/request/RequestLoginDto.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
2 changes: 1 addition & 1 deletion
2
...te/data/model/request/RequestSignUpDto.kt → ...e/data/entity/request/RequestSignUpDto.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
25 changes: 25 additions & 0 deletions
25
app/src/main/java/org/sopt/dosopttemplate/data/entity/response/ResponseLoginDto.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 org.sopt.dosopttemplate.data.entity.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponseLoginDto( | ||
@SerialName("status") | ||
val status: Int, | ||
@SerialName("message") | ||
val message: String, | ||
@SerialName("data") | ||
val data: UserInfo, | ||
) { | ||
@Serializable | ||
data class UserInfo( | ||
@SerialName("id") | ||
val id: Int, | ||
@SerialName("username") | ||
val username: String, | ||
@SerialName("nickname") | ||
val nickname: String | ||
) | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
.../data/model/response/ResponseSignUpDto.kt → ...data/entity/response/ResponseSignUpDto.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
12 changes: 12 additions & 0 deletions
12
app/src/main/java/org/sopt/dosopttemplate/data/entity/service/FollowerService.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 org.sopt.dosopttemplate.data.entity.service | ||
|
||
import org.sopt.dosopttemplate.data.entity.response.ResponseFollowerDto | ||
import retrofit2.http.GET | ||
import retrofit2.http.Query | ||
|
||
interface FollowerService { | ||
@GET("api/users") | ||
suspend fun follower( | ||
@Query("page") num: Int = 2 | ||
): ResponseFollowerDto | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/sopt/dosopttemplate/data/entity/service/LoginService.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 org.sopt.dosopttemplate.data.entity.service | ||
|
||
import org.sopt.dosopttemplate.data.entity.request.RequestLoginDto | ||
import org.sopt.dosopttemplate.data.entity.response.ResponseLoginDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface LoginService { | ||
@POST("api/v1/members/sign-in") | ||
suspend fun login( | ||
@Body request: RequestLoginDto, | ||
): ResponseLoginDto | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/org/sopt/dosopttemplate/data/entity/service/SignUpService.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 org.sopt.dosopttemplate.data.entity.service | ||
|
||
import org.sopt.dosopttemplate.data.entity.request.RequestSignUpDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface SignUpService { | ||
@POST("api/v1/members") | ||
suspend fun signUp( | ||
@Body signUpReq: RequestSignUpDto, | ||
) | ||
} |
9 changes: 0 additions & 9 deletions
9
app/src/main/java/org/sopt/dosopttemplate/data/model/LoginState.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
app/src/main/java/org/sopt/dosopttemplate/data/model/response/ResponseLoginDto.kt
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
app/src/main/java/org/sopt/dosopttemplate/data/model/service/AuthService.kt
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
app/src/main/java/org/sopt/dosopttemplate/data/model/service/FollowerService.kt
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/sopt/dosopttemplate/data/repositoryimpl/FollowerRepositoryImpl.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,16 @@ | ||
package org.sopt.dosopttemplate.data.repositoryimpl | ||
|
||
import org.sopt.dosopttemplate.data.datasource.FollowerDataSource | ||
import org.sopt.dosopttemplate.domain.model.Follower | ||
import org.sopt.dosopttemplate.domain.repository.FollowerRepository | ||
import javax.inject.Inject | ||
|
||
class FollowerRepositoryImpl @Inject constructor(private val followerDataSource: FollowerDataSource) : | ||
FollowerRepository { | ||
override suspend fun loadFollowerData(): Result<List<Follower>> = | ||
runCatching { | ||
followerDataSource.follower().toFollower() | ||
} | ||
} | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
app/src/main/java/org/sopt/dosopttemplate/data/repositoryimpl/LoginRepositoryImpl.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,18 @@ | ||
package org.sopt.dosopttemplate.data.repositoryimpl | ||
|
||
import org.sopt.dosopttemplate.data.datasource.LoginDataSource | ||
import org.sopt.dosopttemplate.data.entity.request.RequestLoginDto | ||
import org.sopt.dosopttemplate.data.entity.response.ResponseLoginDto | ||
import org.sopt.dosopttemplate.domain.repository.LoginRepository | ||
import javax.inject.Inject | ||
|
||
class LoginRepositoryImpl @Inject constructor(private val loginDataSource: LoginDataSource) : | ||
LoginRepository { | ||
override suspend fun login( | ||
username: String, | ||
password: String | ||
): Result<ResponseLoginDto.UserInfo> = | ||
runCatching { | ||
loginDataSource.login(RequestLoginDto(username, password)).data | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/sopt/dosopttemplate/data/repositoryimpl/SignUpRepositoryImpl.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,14 @@ | ||
package org.sopt.dosopttemplate.data.repositoryimpl | ||
|
||
import org.sopt.dosopttemplate.data.datasource.SignUpDataSource | ||
import org.sopt.dosopttemplate.data.entity.request.RequestSignUpDto | ||
import org.sopt.dosopttemplate.domain.repository.SignUpRepository | ||
import javax.inject.Inject | ||
|
||
class SignUpRepositoryImpl @Inject constructor(private val signUpDataSource: SignUpDataSource) : | ||
SignUpRepository { | ||
override suspend fun signUp(id: String, password: String, nickname: String): Result<Unit> = | ||
runCatching { | ||
signUpDataSource.signUp(RequestSignUpDto(id, password, nickname)) | ||
} | ||
} |
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.