-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [feat/signup_network] : 회원가입 서버 연결 * [feat/signup] : 스플래시 아이콘 변경 * [feat/signup] : 네이밍 변경 * [feat/signup] : viewmodel observer 필요 없는 부분 삭제
- Loading branch information
1 parent
4f674bf
commit 6eb3ab4
Showing
11 changed files
with
166 additions
and
47 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
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/teampophory/pophory/feature/signup/SignUpApiFactory.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,37 @@ | ||
package com.teampophory.pophory.feature.signup | ||
|
||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory | ||
import com.teampophory.pophory.BuildConfig | ||
import com.teampophory.pophory.config.di.NetModule | ||
import com.teampophory.pophory.data.network.interceptor.AuthInterceptor | ||
import com.teampophory.pophory.network.retrofit.signup.RetrofitSignUpNetwork | ||
import kotlinx.serialization.json.Json | ||
import okhttp3.MediaType.Companion.toMediaType | ||
import okhttp3.OkHttpClient | ||
import okhttp3.logging.HttpLoggingInterceptor | ||
import retrofit2.Retrofit | ||
|
||
object SignUpApiFactory { | ||
|
||
private const val POPHORY_BASE_URL = BuildConfig.POPHORY_BASE_URL | ||
|
||
private val client by lazy { | ||
OkHttpClient.Builder() | ||
.addInterceptor(HttpLoggingInterceptor().apply { | ||
level = | ||
if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE | ||
}).build() | ||
} | ||
|
||
val retrofitForSignUp: Retrofit by lazy { | ||
Retrofit.Builder().baseUrl(POPHORY_BASE_URL) | ||
.addConverterFactory(Json.asConverterFactory("application/json".toMediaType())) | ||
.client(client).build() | ||
} | ||
|
||
inline fun <reified T> createSignUpService(): T = retrofitForSignUp.create<T>(T::class.java) | ||
} | ||
|
||
object ServicePool { | ||
val signUpService = SignUpApiFactory.createSignUpService<RetrofitSignUpNetwork>() | ||
} |
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
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
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/teampophory/pophory/network/model/SignUpRequest.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,20 @@ | ||
package com.teampophory.pophory.network.model | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SignUpRequest( | ||
@SerialName("realName") | ||
val realName: String, | ||
@SerialName("nickName") | ||
val nickName: String, | ||
@SerialName("albumCover") | ||
val albumCover: Int | ||
) | ||
|
||
@Serializable | ||
data class SignUpResponse( | ||
@SerialName("status") | ||
val status: Int | ||
) |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/teampophory/pophory/network/retrofit/signup/RetrofitSignUpNetwork.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,15 @@ | ||
package com.teampophory.pophory.network.retrofit.signup | ||
|
||
import com.teampophory.pophory.network.model.SignUpRequest | ||
import com.teampophory.pophory.network.model.SignUpResponse | ||
import retrofit2.Call | ||
import retrofit2.http.Body | ||
import retrofit2.http.PATCH | ||
|
||
interface RetrofitSignUpNetwork { | ||
|
||
@PATCH("api/v1/member") | ||
fun signUp( | ||
@Body request : SignUpRequest | ||
): Call<SignUpResponse> | ||
} |
Oops, something went wrong.