From 4c26d698a687914ad21f5851de1a29c17a4fe5eb Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 3 May 2024 01:44:00 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=EC=9D=B8=ED=84=B0=EB=84=B7=20?= =?UTF-8?q?=EA=B6=8C=ED=95=9C=20=EC=B6=94=EA=B0=80,=20gradle=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95,=20DTO=20+=20ApiService=20=EA=B8=B0=EB=B3=B8=20?= =?UTF-8?q?=ED=88=B4=20=EA=B5=AC=EC=B6=95=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 21 ++++++++++++++-- app/src/main/AndroidManifest.xml | 1 + .../com/sopt/now/data/{ => model}/ItemData.kt | 2 +- .../sopt/now/data/model/RequestSignUpDto.kt | 16 ++++++++++++ .../sopt/now/data/model/ResponseSignUpDto.kt | 12 +++++++++ .../com/sopt/now/data/module/ApiFactory.kt | 25 +++++++++++++++++++ .../com/sopt/now/data/network/AuthService.kt | 14 +++++++++++ .../com/sopt/now/ui/adapter/ItemAdapter.kt | 2 +- .../java/com/sopt/now/ui/home/HomFragment.kt | 2 +- .../now/ui/home/viewModel/HomeViewModel.kt | 2 +- build.gradle | 1 + 11 files changed, 92 insertions(+), 6 deletions(-) rename app/src/main/java/com/sopt/now/data/{ => model}/ItemData.kt (92%) create mode 100644 app/src/main/java/com/sopt/now/data/model/RequestSignUpDto.kt create mode 100644 app/src/main/java/com/sopt/now/data/model/ResponseSignUpDto.kt create mode 100644 app/src/main/java/com/sopt/now/data/module/ApiFactory.kt create mode 100644 app/src/main/java/com/sopt/now/data/network/AuthService.kt diff --git a/app/build.gradle b/app/build.gradle index 3a2689d..8d4a567 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,9 @@ plugins { id 'org.jetbrains.kotlin.android' } +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) + android { namespace 'com.sopt.now' compileSdk 34 @@ -15,6 +18,7 @@ android { versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + buildConfigField "String", "AUTH_BASE_URL", properties["base.url"] } buildTypes { @@ -32,12 +36,13 @@ android { } buildFeatures { viewBinding true + buildConfig true } } dependencies { - implementation 'androidx.core:core-ktx:1.12.0' + implementation 'androidx.core:core-ktx:1.13.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.11.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' @@ -45,8 +50,20 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + // Lifecycle Viewmodel implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0' + // Fragment && Activity implementation 'androidx.fragment:fragment-ktx:1.6.2' - implementation 'androidx.activity:activity-ktx:1.8.2' + implementation 'androidx.activity:activity-ktx:1.9.0' + + // Retrofit + implementation 'com.squareup.retrofit2:retrofit:2.9.0' + implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1' + implementation 'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0' + + // OKHttp + implementation platform('com.squareup.okhttp3:okhttp-bom:4.10.0') + implementation 'com.squareup.okhttp3:okhttp' + implementation 'com.squareup.okhttp3:logging-interceptor' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ec5264f..620246a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,7 @@ + create(): T = retrofit.create(T::class.java) +} + +object ServicePool { + val authService = ApiFactory.create() +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/data/network/AuthService.kt b/app/src/main/java/com/sopt/now/data/network/AuthService.kt new file mode 100644 index 0000000..d5b42b0 --- /dev/null +++ b/app/src/main/java/com/sopt/now/data/network/AuthService.kt @@ -0,0 +1,14 @@ +package com.sopt.now.data.network + +import com.sopt.now.data.model.RequestSignUpDto +import com.sopt.now.data.model.ResponseSignUpDto +import retrofit2.Call +import retrofit2.http.Body +import retrofit2.http.POST + +interface AuthService { + @POST("member/join") + fun signUp( + @Body request: RequestSignUpDto, + ): Call +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/ui/adapter/ItemAdapter.kt b/app/src/main/java/com/sopt/now/ui/adapter/ItemAdapter.kt index b1dc9a6..3ed2e7a 100644 --- a/app/src/main/java/com/sopt/now/ui/adapter/ItemAdapter.kt +++ b/app/src/main/java/com/sopt/now/ui/adapter/ItemAdapter.kt @@ -5,7 +5,7 @@ import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.ViewHolder -import com.sopt.now.data.ItemData +import com.sopt.now.data.model.ItemData import com.sopt.now.databinding.ItemFriendBinding import com.sopt.now.databinding.ItemMyProfileBinding diff --git a/app/src/main/java/com/sopt/now/ui/home/HomFragment.kt b/app/src/main/java/com/sopt/now/ui/home/HomFragment.kt index 9318151..a91d428 100644 --- a/app/src/main/java/com/sopt/now/ui/home/HomFragment.kt +++ b/app/src/main/java/com/sopt/now/ui/home/HomFragment.kt @@ -6,7 +6,7 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels -import com.sopt.now.data.ItemData +import com.sopt.now.data.model.ItemData import com.sopt.now.databinding.FragmentHomeBinding import com.sopt.now.ui.adapter.ItemAdapter import com.sopt.now.ui.home.viewModel.HomeViewModel diff --git a/app/src/main/java/com/sopt/now/ui/home/viewModel/HomeViewModel.kt b/app/src/main/java/com/sopt/now/ui/home/viewModel/HomeViewModel.kt index f390781..67d4b9a 100644 --- a/app/src/main/java/com/sopt/now/ui/home/viewModel/HomeViewModel.kt +++ b/app/src/main/java/com/sopt/now/ui/home/viewModel/HomeViewModel.kt @@ -2,7 +2,7 @@ package com.sopt.now.ui.home.viewModel import androidx.lifecycle.ViewModel import com.sopt.now.R -import com.sopt.now.data.ItemData +import com.sopt.now.data.model.ItemData class HomeViewModel : ViewModel() { val friendList = mutableListOf( diff --git a/build.gradle b/build.gradle index be6601c..4c76592 100644 --- a/build.gradle +++ b/build.gradle @@ -3,4 +3,5 @@ plugins { id 'com.android.application' version '8.3.1' apply false id 'com.android.library' version '8.3.1' apply false id 'org.jetbrains.kotlin.android' version '1.9.0' apply false + id("org.jetbrains.kotlin.plugin.serialization") version "1.9.20" apply false } \ No newline at end of file