From e87210b01564a7be80d3f9742e8cebb6267a1e09 Mon Sep 17 00:00:00 2001 From: hhj Date: Sun, 11 Jun 2023 02:12:44 +0900 Subject: [PATCH] =?UTF-8?q?[DEL]=20api=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/nbit/Idear/MainActivity.kt | 6 +- .../java/com/nbit/Idear/home/ApiService.kt | 105 ------------------ .../com/nbit/Idear/home/RetrofitInterface.kt | 35 ------ 3 files changed, 1 insertion(+), 145 deletions(-) delete mode 100644 app/src/main/java/com/nbit/Idear/home/ApiService.kt delete mode 100644 app/src/main/java/com/nbit/Idear/home/RetrofitInterface.kt diff --git a/app/src/main/java/com/nbit/Idear/MainActivity.kt b/app/src/main/java/com/nbit/Idear/MainActivity.kt index 7cd30ad..41c0e4b 100644 --- a/app/src/main/java/com/nbit/Idear/MainActivity.kt +++ b/app/src/main/java/com/nbit/Idear/MainActivity.kt @@ -5,8 +5,6 @@ import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.core.view.GravityCompat import androidx.recyclerview.widget.LinearLayoutManager -import com.footstep.dangbal.kotlin.src.main.map.ApiService -import com.footstep.dangbal.kotlin.src.main.map.RetrofitInterface import com.nbit.Idear.databinding.ActivityMainBinding import com.nbit.Idear.databinding.MainIncludeDrawerBinding import com.nbit.Idear.home.ProxyWriteAdapter @@ -14,8 +12,6 @@ import com.nbit.Idear.home.ProxyWriteData import com.nbit.Idear.home.WriteSubData import com.nbit.Idear.mypage.MyPageActivity import com.nbit.Idear.write.WriteActivity -import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory // 메인 페이지 class MainActivity : AppCompatActivity() { @@ -118,7 +114,7 @@ class MainActivity : AppCompatActivity() { // .build() // val apiService = retrofit.create(RetrofitInterface::class.java) - val apiService = RetrofitInterface.create() + // val apiService = RetrofitInterface.create() } diff --git a/app/src/main/java/com/nbit/Idear/home/ApiService.kt b/app/src/main/java/com/nbit/Idear/home/ApiService.kt deleted file mode 100644 index 5c95e36..0000000 --- a/app/src/main/java/com/nbit/Idear/home/ApiService.kt +++ /dev/null @@ -1,105 +0,0 @@ -package com.footstep.dangbal.kotlin.src.main.map - -import android.util.Log -import com.naver.maps.map.overlay.Marker -import com.footstep.dangbal.kotlin.config.ApplicationClass -import com.footstep.dangbal.kotlin.src.main.map.model.AllResponse -import com.footstep.dangbal.kotlin.src.main.map.model.CityResponse -import com.footstep.dangbal.kotlin.src.main.map.model.PopupResponse -import com.footstep.dangbal.kotlin.src.main.map.model.SpecificFstResponse - -class ApiService(val mapFragmentInterface: MapFragment) { -//val accessToken="Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImZvb3RzdGVwQG5hdmVyLmNvbSIsImlhdCI6MTY3NDkxNDc2NiwiZXhwIjoxNjc1MjE3MTY2fQ.KxwX1Q0o-omU1rRIiUJBd9gLPbTRVciP_9g_sklW1Bk" - suspend fun tryGetMapFootStepList(){ - var return_map=HashMap() -// ApplicationClass.sSharedPreferences.edit().putString(X_ACCESS_TOKEN, accessToken).apply() - - val mapRetrofitInterface=ApplicationClass.sRetrofit.create(RetrofitInterface::class.java) - - try{ - val response=mapRetrofitInterface.getMapFootStepList() - Log.d("FootStepList", "tryGetMapFootStepList 되긴하니?") - - if(response!=null) - mapFragmentInterface.onGetMapFootStepListSuccess(response as AllResponse) - else - Log.d("FootStepList", "맵 서비스 List에서의 결과 : ${response.toString()}") - } - catch (e: Exception) { - Log.d("FootStepList", "onGetMapFootStepListFailure "+e.message.toString()) - - mapFragmentInterface.onGetMapFootStepListFailure(e.message ?: "통신 오류") - } - } - - suspend fun tryGetMapFootStepPopup(place_id:Int){ - // Log.d("FootStepList", "tryGetMapFootStepPopup 진입") - - // ApplicationClass.sSharedPreferences.edit().putString(X_ACCESS_TOKEN, accessToken).apply() - - val mapRetrofitInterface=ApplicationClass.sRetrofit.create(RetrofitInterface::class.java) - Log.d("FootStepList", "tryGetMapFootStepPopup 안쪽직전진입") - - try{ - val response=mapRetrofitInterface.getMapFootStepPopup(place_id) - Log.d("FootStepList", "tryGetMapFootStepPopup 되긴하니?") - - if(response!=null) { - mapFragmentInterface.onGetMapFootStepPopupSuccess( - response as PopupResponse, - place_id - ) - } - else - Log.d("FootStepList", "맵 서비스 Popup에서의 결과 : ${response.toString()}") - } - catch (e: Exception) { - Log.d("FootStepList", "onGetMapFootStepPopupFailure api"+e.message.toString()) - - mapFragmentInterface.onGetMapFootStepPopupFailure(e.message ?: "통신 오류") - } - } - - suspend fun tryGetMapFootStepSpecific(start_date :String,ene_date:String){ - val mapRetrofitInterface=ApplicationClass.sRetrofit.create(RetrofitInterface::class.java) - Log.d("FootStepList2", "tryGetMapFootStepSpecific 안쪽직전진입") - - try{ - val response=mapRetrofitInterface.getMapFootStepSpecific(start_date,ene_date) - Log.d("FootStepList", "tryGetMapFootStepPopup 되긴하니?") - - if(response!=null) { - mapFragmentInterface.onGetMapFootStepSpecificSuccess(response as SpecificFstResponse) - } - else - Log.d("FootStepList", "맵 서비스 Specific에서의 결과 : ${response.toString()}") - } - catch (e: Exception) { - Log.d("FootStepList", "onGetMapFootStepSpecificFailure"+e.message.toString()) - - mapFragmentInterface.onGetMapFootStepSpecificFailure(e.message ?: "통신 오류") - } - } - - suspend fun tryGetMapFootStepCity(city :String){ -// ApplicationClass.sSharedPreferences.edit().putString(X_ACCESS_TOKEN, accessToken).apply() - - val mapRetrofitInterface=ApplicationClass.sRetrofit.create(RetrofitInterface::class.java) - - try{ - val response=mapRetrofitInterface.getMapFootStepCity(city) - Log.d("FootStepList", "tryGetMapFootStepCity 되긴하니?") - - if(response!=null) - mapFragmentInterface.onGetMapFootStepCitySuccess(response as CityResponse) - else - Log.d("FootStepList", "맵 서비스 City에서의 결과 : ${response.toString()}") - } - catch (e: Exception) { - Log.d("FootStepList", "tryGetMapFootStepCity onGetMapFootStepListFailure "+e.message.toString()) - - mapFragmentInterface.onGetMapFootStepCityFailure(e.message ?: "통신 오류") - } - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/nbit/Idear/home/RetrofitInterface.kt b/app/src/main/java/com/nbit/Idear/home/RetrofitInterface.kt deleted file mode 100644 index 93319be..0000000 --- a/app/src/main/java/com/nbit/Idear/home/RetrofitInterface.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.footstep.dangbal.kotlin.src.main.map - -import com.footstep.dangbal.kotlin.src.main.map.model.* -import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory -import retrofit2.http.* - -interface RetrofitInterface { - - @GET("/footstep/all") - suspend fun getMapFootStepList() : AllResponse - - @GET("/footstep/{place-id}") - suspend fun getMapFootStepPopup(@Path("place-id") place_id : Int) : PopupResponse - - @GET("/footstep/specific/{start-date}/{end-date}") - suspend fun getMapFootStepSpecific(@Path("start-date") start_date : String, @Path("end-date") end_date:String) : SpecificFstResponse - - @GET("/footstep/city/{city-name}") - suspend fun getMapFootStepCity(@Path("city-name")city: String) : CityResponse - - @GET("users/{user}") - fun getUser(@Path("user") username: String): Call - - companion object { - fun create(): ApiService { - val retrofit = Retrofit.Builder() - .baseUrl("https://api.example.com/") - .addConverterFactory(GsonConverterFactory.create()) - .build() - - return retrofit.create(ApiService::class.java) - } - } -}