Skip to content

Commit

Permalink
Merge pull request #112 from Team-Wable/feature/#106-ban-etc
Browse files Browse the repository at this point in the history
[Feature/#106] : Ban 기능 구현 + etc
  • Loading branch information
sohyun127 authored Nov 24, 2024
2 parents 1905715 + 67f947f commit bfb19d9
Show file tree
Hide file tree
Showing 62 changed files with 601 additions and 93 deletions.
11 changes: 11 additions & 0 deletions core/common/src/main/res/drawable/ic_home_detail_child_comment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="21dp"
android:viewportWidth="20"
android:viewportHeight="21">
<path
android:pathData="M3.125,10.5C3.125,6.703 6.203,3.625 10,3.625C13.797,3.625 16.875,6.703 16.875,10.5V17.375H10C6.203,17.375 3.125,14.297 3.125,10.5Z"
android:strokeWidth="1.25"
android:fillColor="#00000000"
android:strokeColor="#8D8D8D"/>
</vector>
44 changes: 44 additions & 0 deletions core/common/src/main/res/drawable/ic_profile_level.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="18dp"
android:height="19dp"
android:viewportWidth="18"
android:viewportHeight="19">
<path
android:pathData="M9.713,2.568C9.4,2.012 8.6,2.012 8.287,2.568L6.139,6.38L1.849,7.245C1.225,7.371 0.977,8.132 1.409,8.601L4.37,11.822L3.868,16.169C3.795,16.802 4.442,17.272 5.021,17.007L9,15.186L12.979,17.007C13.559,17.272 14.206,16.802 14.132,16.169L13.63,11.822L16.591,8.601C17.023,8.132 16.776,7.371 16.151,7.245L11.862,6.38L9.713,2.568Z"
android:strokeWidth="0.818182">
<aapt:attr name="android:fillColor">
<gradient
android:startX="9"
android:startY="2.136"
android:endX="9"
android:endY="18.5"
android:type="linear">
<item android:offset="0" android:color="#FFBD4BFF"/>
<item android:offset="1" android:color="#FF0FE5D0"/>
</gradient>
</aapt:attr>
<aapt:attr name="android:strokeColor">
<gradient
android:startX="9"
android:startY="2.136"
android:endX="9"
android:endY="18.5"
android:type="linear">
<item android:offset="0" android:color="#FFAD60FE"/>
<item android:offset="1" android:color="#FF27D0E6"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M8.992,2.561V10.318L1.637,7.866C1.689,7.759 1.789,7.674 1.923,7.646L6.212,6.781C6.329,6.757 6.429,6.684 6.488,6.581L8.636,2.769C8.715,2.63 8.853,2.561 8.992,2.561Z"
android:strokeAlpha="0.2"
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:pathData="M8.644,6.041C8.8,5.764 9.2,5.764 9.356,6.041L10.466,8.011C10.524,8.114 10.625,8.187 10.742,8.211L12.957,8.658C13.27,8.721 13.393,9.101 13.177,9.336L11.648,11C11.567,11.087 11.529,11.205 11.543,11.323L11.802,13.569C11.839,13.885 11.515,14.12 11.225,13.988L9.17,13.047C9.062,12.998 8.938,12.998 8.83,13.047L6.774,13.988C6.485,14.12 6.161,13.885 6.198,13.569L6.457,11.323C6.471,11.205 6.432,11.087 6.352,11L4.822,9.336C4.607,9.101 4.73,8.721 5.043,8.658L7.258,8.211C7.375,8.187 7.475,8.114 7.534,8.011L8.644,6.041Z"
android:strokeAlpha="0.4"
android:fillColor="#ffffff"
android:fillAlpha="0.4"/>
</vector>
50 changes: 0 additions & 50 deletions core/common/src/main/res/drawable/ic_profile_tag_level_1.xml

This file was deleted.

10 changes: 10 additions & 0 deletions core/common/src/main/res/drawable/ic_share_blind.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="67dp"
android:height="72dp"
android:viewportWidth="67"
android:viewportHeight="72">
<path
android:pathData="M58.034,22.877C58.398,23.555 59.094,24 59.864,24H64.623C66.004,24 66.966,22.634 66.405,21.373C60.798,8.78 48.174,0 33.5,0C18.826,0 6.202,8.78 0.595,21.373C0.034,22.634 0.996,24 2.377,24H7.136C7.906,24 8.602,23.555 8.966,22.876C13.654,14.13 22.882,8.182 33.5,8.182C39.44,8.182 44.945,10.044 49.464,13.215C50.429,13.893 50.491,15.269 49.657,16.103L45.174,20.586C43.914,21.846 44.807,24 46.589,24H52.502C53.033,24 53.542,23.789 53.917,23.414L54.966,22.365C55.859,21.472 57.352,21.62 57.955,22.73C57.982,22.779 58.008,22.828 58.034,22.877ZM66.405,50.627C66.966,49.366 66.004,48 64.623,48H59.864C59.094,48 58.398,48.445 58.034,49.124C53.346,57.87 44.118,63.818 33.5,63.818C28.695,63.818 24.174,62.6 20.23,60.455C19.12,59.852 18.972,58.359 19.865,57.466L25.917,51.414C27.177,50.154 26.284,48 24.503,48H18.589C18.058,48 17.549,48.211 17.174,48.586L13.603,52.157C12.769,52.991 11.393,52.929 10.715,51.964C10.078,51.055 9.493,50.107 8.966,49.123C8.602,48.445 7.906,48 7.136,48H2.377C0.996,48 0.034,49.366 0.595,50.627C6.202,63.22 18.826,72 33.5,72C48.174,72 60.798,63.22 66.405,50.627Z"
android:fillColor="#CCCCCC"
android:fillType="evenOdd"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.teamwable.data.mapper.toData

import com.teamwable.network.dto.request.RequestBanDto

internal fun Triple<Long, String, Long>.toBanDto(): RequestBanDto =
RequestBanDto(first, second, third)
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ internal fun ResponseSocialLoginDto.toUserModel(): UserModel =
isPushAlarmAllowed = isPushAlarmAllowed,
memberFanTeam = memberFanTeam,
memberLckYears = memberLckYears,
memberLevel = memberLevel
memberLevel = memberLevel,
isAdmin = isAdmin,
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ internal fun ResponseCommentDto.toComment(): Comment =
this.time,
this.memberFanTeam,
this.contentId,
this.isBlind ?: false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ internal fun ResponseFeedDto.toFeed(): Feed =
this.commentNumber.toString(),
this.contentImageUrl,
this.memberFanTeam,
isBlind = this.isBlind,
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ interface ProfileRepository {
suspend fun getNickNameDoubleCheck(nickname: String): Result<Unit>

suspend fun postReport(nickname: String, relateText: String): Result<Unit>

suspend fun postBan(banInfo: Triple<Long, String, Long>): Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface UserInfoRepository {

fun getIsPushAlarmAllowed(): Flow<Boolean>

fun getIsAdmin(): Flow<Boolean>

suspend fun saveAccessToken(accessToken: String)

suspend fun saveRefreshToken(refreshToken: String)
Expand All @@ -31,6 +33,8 @@ interface UserInfoRepository {

suspend fun saveIsPushAlarmAllowed(isPushAlarmAllowed: Boolean)

suspend fun saveIsAdmin(isAdmin: Boolean)

suspend fun clearAll()

suspend fun clearForRefreshToken()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.teamwable.data.repositoryimpl

import android.content.ContentResolver
import com.teamwable.data.mapper.toData.toBanDto
import com.teamwable.data.mapper.toData.toReportDto
import com.teamwable.data.mapper.toModel.toMemberDataModel
import com.teamwable.data.mapper.toModel.toProfile
Expand Down Expand Up @@ -76,6 +77,13 @@ internal class DefaultProfileRepository @Inject constructor(
return it.handleThrowable()
}

override suspend fun postBan(banInfo: Triple<Long, String, Long>): Result<Unit> = runCatching {
apiService.postBan(banInfo.toBanDto())
Unit
}.onFailure {
return it.handleThrowable()
}

companion object {
private const val FILE_NAME = "file"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ internal class DefaultUserInfoRepository @Inject constructor(
override fun getIsPushAlarmAllowed(): Flow<Boolean> =
wablePreferencesDataSource.isPushAlarmAllowed

override fun getIsAdmin(): Flow<Boolean> =
wablePreferencesDataSource.isAdmin

override suspend fun saveAccessToken(accessToken: String) {
wablePreferencesDataSource.updateAccessToken(accessToken)
}
Expand Down Expand Up @@ -57,6 +60,10 @@ internal class DefaultUserInfoRepository @Inject constructor(
wablePreferencesDataSource.updateIsPushAlarmAllowed(isPushAlarmAllowed)
}

override suspend fun saveIsAdmin(isAdmin: Boolean) {
wablePreferencesDataSource.updateIsAdmin(isAdmin)
}

override suspend fun clearAll() {
wablePreferencesDataSource.clear()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class DefaultWablePreferenceDatasource @Inject constructor(
val MemberId = intPreferencesKey("memberId")
val MemberProfileUrl = stringPreferencesKey("memberProfileUrl")
val IsPushAlarmAllowed = booleanPreferencesKey("isPushAlarmAllowed")
val IsAdmin = booleanPreferencesKey("isAdmin")
}

override val accessToken: Flow<String> = dataStore.data
Expand Down Expand Up @@ -69,6 +70,12 @@ class DefaultWablePreferenceDatasource @Inject constructor(
preferences[PreferencesKeys.IsPushAlarmAllowed] ?: false
}

override var isAdmin: Flow<Boolean> = dataStore.data
.catch { handleError(it) }
.map { preferences ->
preferences[PreferencesKeys.IsAdmin] ?: false
}

override suspend fun updateAccessToken(accessToken: String) {
dataStore.edit { preferences ->
preferences[PreferencesKeys.AccessToken] = accessToken
Expand Down Expand Up @@ -111,6 +118,12 @@ class DefaultWablePreferenceDatasource @Inject constructor(
}
}

override suspend fun updateIsAdmin(isAdmin: Boolean) {
dataStore.edit { preferences ->
preferences[PreferencesKeys.IsAdmin] = isAdmin
}
}

override suspend fun clear() {
dataStore.edit { preferences ->
preferences.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface WablePreferencesDataSource {
val memberId: Flow<Int>
val memberProfileUrl: Flow<String>
val isPushAlarmAllowed: Flow<Boolean>
val isAdmin: Flow<Boolean>

suspend fun updateAccessToken(accessToken: String)

Expand All @@ -25,6 +26,8 @@ interface WablePreferencesDataSource {

suspend fun updateIsPushAlarmAllowed(isPushAlarmAllowed: Boolean)

suspend fun updateIsAdmin(isAdmin: Boolean)

suspend fun clear()

suspend fun clearForRefreshToken()
Expand Down
1 change: 1 addition & 0 deletions core/model/src/main/java/com/teamwable/model/Comment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ data class Comment(
val uploadTime: String,
val postAuthorTeamTag: String,
val feedId: Long?,
val isBlind: Boolean,
val ghostColor: String = GhostColor.DEFAULT_0,
val isAuth: Boolean = false,
)
1 change: 1 addition & 0 deletions core/model/src/main/java/com/teamwable/model/Feed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data class Feed(
val postAuthorTeamTag: String = "",
val ghostColor: String = GhostColor.DEFAULT_0,
val isAuth: Boolean = false,
val isBlind: Boolean = false,
) : Parcelable

object GhostColor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ data class UserModel(
val memberFanTeam: String,
val memberLckYears: Int,
val memberLevel: Int,
val isAdmin: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import retrofit2.http.Header
import retrofit2.http.POST

interface AuthService {
@POST("api/v1/auth")
@POST("api/v2/auth")
suspend fun postLogin(
@Body requestSocialLogin: RequestSocialLoginDto,
@Header("Authorization") kakaoToken: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface CommentService {
@Query(value = "cursor") cursor: Long = -1,
): BaseResponse<List<ResponseCommentDto>>

@GET("api/v2/member/{memberId}/comments")
@GET("api/v3/member/{memberId}/comments")
suspend fun getProfileComments(
@Path(value = "memberId") contentId: Long,
@Query(value = "cursor") cursor: Long = -1,
Expand Down
Loading

0 comments on commit bfb19d9

Please sign in to comment.