Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ package com.example.gdg_c.data.model.calendar
data class CalendarDay(
val day: Int?,
val progress: Int?,
val hasTask: Boolean = false
)
var hasTask: Boolean = false
) {
init {
hasTask = progress != 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TaskListResponse : ArrayList<TaskListResponse.TaskListResponseItem>(){
val year: Int
) {
override fun toString(): String {
return "$year-$month-$day"
return "$year-$month-$day, $hour:$minute"
}
}

Expand All @@ -40,7 +40,7 @@ class TaskListResponse : ArrayList<TaskListResponse.TaskListResponseItem>(){
val year: Int
) {
override fun toString(): String {
return "$year-$month-$day"
return "$year-$month-$day, $hour:$minute"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.gdg_c.data.model.repsonse.schedule


import com.google.gson.annotations.SerializedName

class TaskProgressResponse : ArrayList<TaskProgressResponse.TaskProgressResponseItem>(){
data class TaskProgressResponseItem(
val day: Int?,
val progress: Int?
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package com.example.gdg_c.data.network
import com.example.gdg_c.data.remote.MyService
import com.example.gdg_c.data.remote.SurveyService
import com.example.gdg_c.data.remote.TaskService
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit

object RetrofitInstance {
private const val BASE_URL = "https://api.gdgoc-team3.site/"
Expand All @@ -13,9 +15,16 @@ object RetrofitInstance {
Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build()
}

private val okHttpClient: OkHttpClient = OkHttpClient.Builder()
.connectTimeout(1200, TimeUnit.SECONDS) // 연결 타임아웃 (기본값: 10초)
.readTimeout(1200, TimeUnit.SECONDS) // 읽기 타임아웃 (기본값: 10초)
.writeTimeout(1800, TimeUnit.SECONDS) // 쓰기 타임아웃 (기본값: 10초)
.build()

val myService: MyService by lazy {
retrofit.create(MyService::class.java)
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/example/gdg_c/data/remote/MyService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import retrofit2.http.Query
interface MyService {
@GET("user/my/{userIdentity}")
suspend fun getMyInfo(
@Path("userIdentity") userIdentity: String,
@Query("year") year: Int,
@Query("month") month: Int,
@Path("userIdentity")
userIdentity: String,
year: Int,
month: Int
): BaseResponse<MyInfoResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.example.gdg_c.data.remote

import com.example.gdg_c.data.model.repsonse.BaseResponse
import com.example.gdg_c.data.model.repsonse.schedule.TaskListResponse
import com.example.gdg_c.data.model.repsonse.schedule.TaskProgressResponse
import com.example.gdg_c.data.model.repsonse.schedule.TaskResponse
import com.example.gdg_c.data.model.request.TaskPostRequest
import retrofit2.http.Body
Expand All @@ -19,4 +20,11 @@ interface TaskService {
@Query("year") year: Int,
@Query("month") month: Int
): BaseResponse<TaskListResponse>

@GET("schedule/progress")
suspend fun getTaskProgress(
@Query("userIdentity") userIdentity: String,
@Query("year") year: Int,
@Query("month") month: Int
): BaseResponse<TaskProgressResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,20 @@ class TaskRepository {
}

suspend fun getTasks(

userIdentity: String
) = RetrofitInstance.taskService.getTasks(
userIdentity = "dfjnsdfnj34",
userIdentity = userIdentity,
year = 2025,
month = 1
)

suspend fun getTaskProgress(
userIdentity: String
) = RetrofitInstance.taskService.getTaskProgress(
userIdentity = userIdentity,
year = 2025,
month = 1
)


}
6 changes: 5 additions & 1 deletion app/src/main/java/com/example/gdg_c/ui/my/MyFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.example.gdg_c.data.local.PreferenceManager
import com.example.gdg_c.data.model.calendar.CalendarData
import com.example.gdg_c.data.model.calendar.CalendarDay
import com.example.gdg_c.data.model.repsonse.my.MyInfoResponse
Expand Down Expand Up @@ -46,9 +47,12 @@ class MyFragment : Fragment() {
}

private fun getMyInfo() {

viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
val preferenceManager = PreferenceManager(requireContext())
val userIdentity = preferenceManager.getUserIdentity()
kotlin.runCatching {
repository.getMyInfo("dfjnsdfnj34", 2025, 1)
repository.getMyInfo(userIdentity!!, 2025, 1)
}.onSuccess {
// setUpCalendarAdapter(it.data)
withContext(Dispatchers.Main) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.lifecycleScope
import com.example.gdg_c.MainActivity
import com.example.gdg_c.R
import com.example.gdg_c.data.local.PreferenceManager
import com.example.gdg_c.data.repository.UserRepository
import com.example.gdg_c.databinding.ActivitySettingBinding
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -45,11 +46,7 @@ class SettingActivity : AppCompatActivity() {
binding.desiredJob.text = desiredJob


ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}


with(binding) {
postUser(birthDate, nickname, userIdentity, major, desiredJob, targetEmploymentPeriod)
Expand Down Expand Up @@ -84,6 +81,8 @@ class SettingActivity : AppCompatActivity() {
desiredJob,
targetEmploymentPeriod
)
val preferenceManager = PreferenceManager(applicationContext)
preferenceManager.saveUserIdentity(userIdentity)
}.onSuccess {
Log.d("success", "postUser Success")
}.onFailure {
Expand Down
Loading