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

7주차 과제 제출 #12

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".presentaion.navi.WavveActivity"
android:name=".presentation.navi.WavveActivity"
android:exported="true"
android:label="MainActivity"
android:theme="@style/Theme.ANDANDROID">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sopt.and.data.repository

import android.util.Log
import org.sopt.and.data.api.ApiService
import org.sopt.and.data.dto.ApiResponse
import org.sopt.and.data.dto.HobbyDto
Expand All @@ -12,18 +13,22 @@ import retrofit2.Call
class AuthRepositoryImpl(
private val apiService: ApiService
) : AuthRepository {
companion object {
private const val TAG = "AuthRepositoryImpl"
}

Comment on lines +16 to +19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

companion object는 가장 하단에 작성해주시는 것이 컨벤션입니다.

override fun login(request: LoginRequestDto): Call<LoginResponseDto> {
println("AuthRepositoryImpl - 요청 데이터: username=${request.username}, password=${request.password}")
Log.d(TAG, "Login request: username=${request.username}, password=${request.password}")
return apiService.loginUser(request)
}

override fun register(request: SignUpRequestDto): Call<SignUpResponseDto> {
println("SignUpRequestDto: username=${request.username}, password=${request.password}, hobby=${request.hobby}")
Log.d(TAG, "SignUp request: username=${request.username}, password=${request.password}, hobby=${request.hobby}")
return apiService.registerUser(request)
}


override fun getMyHobby(token: String): Call<ApiResponse<HobbyDto>> {
Log.d(TAG, "Fetching hobby with token: $token")
return apiService.getMyHobby(token)
}
}
28 changes: 28 additions & 0 deletions app/src/main/java/org/sopt/and/data/repository/ViewModelFactory.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.sopt.and.data.repository

import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import org.sopt.and.presentation.auth.viewmodel.SignInViewModel
import org.sopt.and.presentation.auth.viewmodel.SignUpViewModel
import org.sopt.and.presentation.main.viewmodel.MypageViewModel

class ViewModelFactory(
private val authRepository: AuthRepository,
private val context: Context // Context 추가
) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return when {
modelClass.isAssignableFrom(SignInViewModel::class.java) -> {
SignInViewModel(authRepository, context) as T
}
modelClass.isAssignableFrom(SignUpViewModel::class.java) -> {
SignUpViewModel(authRepository, context) as T
}
modelClass.isAssignableFrom(MypageViewModel::class.java) -> {
MypageViewModel(authRepository, context) as T
}
else -> throw IllegalArgumentException("Unknown ViewModel class")
}
}
}
137 changes: 0 additions & 137 deletions app/src/main/java/org/sopt/and/presentaion/auth/screen/SignInScreen.kt

This file was deleted.

This file was deleted.

This file was deleted.

Loading