-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat/setting #30
Merged
Merged
Feat/setting #30
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dd657e0
✏️ update : ic_profile 통일
eunjjungg 3709eb4
✨ feature : SettingUserInfo base code 구현
eunjjungg 08a70e6
✨ feature : user setting info ui 구현
eunjjungg 3d77f11
➕ add : lateinit listener null check
eunjjungg 34689f5
✨ feature : Setting User Info API module 구현
eunjjungg f5f0b25
✨ feature : enum util 구현
eunjjungg 16dc4b3
✨ feature : Setting User Info module 추가 구현
eunjjungg 80fe50c
✨ feature : Setting User Info 구현
eunjjungg 67d6f57
✏️ update : 시작 화면 변경
eunjjungg aa53bfb
➕ add : 프로필 사진 변경 리소스 추가
eunjjungg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/shootit/greme/model/SettingServerModel.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,32 @@ | ||
package com.shootit.greme.model | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class UserCurrentInfo( | ||
@SerializedName("username") | ||
val username: String, | ||
@SerializedName("imageUrl") | ||
val imageUrl: String, | ||
@SerializedName("interestType") | ||
val interestType: List<Int>, | ||
@SerializedName("genderType") | ||
val genderType: Int, | ||
@SerializedName("area") | ||
val area: String, | ||
@SerializedName("purpose") | ||
val purpose: String, | ||
) | ||
|
||
data class UserInterestAndGenderInfo( | ||
@SerializedName("interestType") | ||
val interestType: List<Int>, | ||
@SerializedName("genderType") | ||
val genderType: Int | ||
) | ||
|
||
data class UserAreaAndPurposeInfo( | ||
@SerializedName("area") | ||
val area: String, | ||
@SerializedName("purpose") | ||
val purpose: String | ||
) |
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
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/shootit/greme/network/SettingInterface.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,24 @@ | ||
package com.shootit.greme.network | ||
|
||
import com.shootit.greme.model.UserAreaAndPurposeInfo | ||
import com.shootit.greme.model.UserCurrentInfo | ||
import com.shootit.greme.model.UserInterestAndGenderInfo | ||
import retrofit2.Response | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.PATCH | ||
|
||
interface SettingInterface { | ||
|
||
// get current profile | ||
@GET("/user/profile") | ||
suspend fun getCurrentProfile() : Response<UserCurrentInfo> | ||
|
||
// set interest, gender | ||
@PATCH("/user/profile1") | ||
suspend fun setUserInterestAndGender(@Body data: UserInterestAndGenderInfo) : Response<Void> | ||
|
||
// set area, purpose | ||
@PATCH("/user/profile2") | ||
suspend fun setUserAreaAndPurpose(@Body data: UserAreaAndPurposeInfo) : Response<Void> | ||
} |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/shootit/greme/repository/SettingRepository.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,43 @@ | ||
package com.shootit.greme.repository | ||
|
||
import android.util.Log | ||
import com.shootit.greme.model.ChallengeActivityModel | ||
import com.shootit.greme.model.UserAreaAndPurposeInfo | ||
import com.shootit.greme.model.UserCurrentInfo | ||
import com.shootit.greme.model.UserInterestAndGenderInfo | ||
import com.shootit.greme.network.ConnectionObject | ||
|
||
class SettingRepository { | ||
|
||
companion object { | ||
private var instance: SettingRepository? = null | ||
|
||
fun getInstance(): SettingRepository? { | ||
if(instance == null) instance = SettingRepository() | ||
return instance | ||
} | ||
} | ||
|
||
suspend fun getCurrentProfile(): UserCurrentInfo? { | ||
val response = ConnectionObject | ||
.getSettingRetrofitService.getCurrentProfile() | ||
return if (response.isSuccessful) { | ||
response.body() as UserCurrentInfo | ||
} else { | ||
Log.d("challenge server err", response.errorBody()?.string().toString()) | ||
null | ||
} | ||
} | ||
|
||
suspend fun setUserInterestAndGender(userInterestAndGenderInfo: UserInterestAndGenderInfo): Boolean { | ||
val response = ConnectionObject | ||
.getSettingRetrofitService.setUserInterestAndGender(userInterestAndGenderInfo) | ||
return response.isSuccessful | ||
} | ||
|
||
suspend fun setUserAreaAndPurpose(userAreaAndPurposeInfo: UserAreaAndPurposeInfo): Boolean { | ||
val response = ConnectionObject | ||
.getSettingRetrofitService.setUserAreaAndPurpose(userAreaAndPurposeInfo) | ||
return response.isSuccessful | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lateinit인 경우 null check