Skip to content

Commit

Permalink
Merge pull request #198 from hellokitty-coding-club/release/v1.1.2
Browse files Browse the repository at this point in the history
[RELEASE] v1.1.2
  • Loading branch information
KxxHyoRim authored Nov 15, 2023
2 parents d3375b9 + 7b462b8 commit 640ce09
Show file tree
Hide file tree
Showing 33 changed files with 561 additions and 133 deletions.
7 changes: 7 additions & 0 deletions app/src/main/java/com/lgtm/android/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package com.lgtm.android.di

import com.lgtm.android.data.repository.AuthRepositoryImpl
import com.lgtm.android.data.repository.IntroRepositoryImpl
import com.lgtm.android.data.repository.LoggingRepositoryImpl
import com.lgtm.android.data.repository.MissionRepositoryImpl
import com.lgtm.android.data.repository.NotificationRepositoryImpl
import com.lgtm.android.data.repository.ProfileRepositoryImpl
import com.lgtm.domain.repository.AuthRepository
import com.lgtm.domain.repository.IntroRepository
import com.lgtm.domain.repository.LoggingRepository
import com.lgtm.domain.repository.MissionRepository
import com.lgtm.domain.repository.NotificationRepository
import com.lgtm.domain.repository.ProfileRepository
Expand Down Expand Up @@ -44,4 +46,9 @@ interface RepositoryModule {
notificationRepositoryImpl: NotificationRepositoryImpl
): NotificationRepository

@Binds
fun bindsLoggingRepository(
loggingRepositoryImpl: LoggingRepositoryImpl
): LoggingRepository

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import com.lgtm.android.common_ui.util.setOnThrottleClickListener

class ParticipantAdapter(
private val onProcessStateClickListener: (Int) -> Unit,
private val onCodeReviewClickListener: (String) -> Unit
private val onCodeReviewClickListener: (String) -> Unit,
private val onParticipantClickListener: (Int) -> Unit,
) : ListAdapter<MemberMissionStatusUI, ParticipantViewHolder>(
ItemDiffCallback<MemberMissionStatusUI>(onContentsTheSame = { old, new -> old == new },
onItemsTheSame = { old, new -> old.memberId == new.memberId })
Expand All @@ -21,7 +22,12 @@ class ParticipantAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ParticipantViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val binding = ItemDashboardParticipantBinding.inflate(layoutInflater, parent, false)
return ParticipantViewHolder(binding, onProcessStateClickListener, onCodeReviewClickListener)
return ParticipantViewHolder(
binding,
onProcessStateClickListener,
onCodeReviewClickListener,
onParticipantClickListener
)
}

override fun onBindViewHolder(holder: ParticipantViewHolder, position: Int) {
Expand All @@ -32,11 +38,13 @@ class ParticipantAdapter(
class ParticipantViewHolder(
private val binding: ItemDashboardParticipantBinding,
private val onProcessStateClickListener: (Int) -> Unit,
private val onCodeReviewClickListener: (String) -> Unit
private val onCodeReviewClickListener: (String) -> Unit,
private val onParticipantClickListener: (Int) -> Unit,
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(item: MemberMissionStatusUI) {
binding.data = item
binding.clProgress.setOnThrottleClickListener { onProcessStateClickListener(item.memberId) }
binding.btnReviewMission.setOnThrottleClickListener { onCodeReviewClickListener(item.githubPrUrl) }
binding.clProfile.setOnThrottleClickListener { onParticipantClickListener(item.memberId) }
}
}
156 changes: 83 additions & 73 deletions common-ui/src/main/res/layout/item_dashboard_participant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,84 +17,94 @@
android:layout_marginTop="5dp"
android:background="@drawable/rectangle_white_stroke_gray_2_radius_20">

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_profile_image"
setCircleProfileImageUrl="@{data.profileImageUrl}"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="20dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:theme="@style/ShapeAppearanceOverlay.App.CircleImage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/img_profile_empty" />

<TextView
android:id="@+id/tv_nickname_label"
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/nickname"
android:textAppearance="@style/Body3R"
app:layout_constraintBottom_toTopOf="@id/tv_github_label"
app:layout_constraintStart_toEndOf="@id/iv_profile_image"
app:layout_constraintTop_toTopOf="@id/iv_profile_image"
app:layout_constraintVertical_chainStyle="packed" />
app:layout_constraintTop_toTopOf="parent">


<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_profile_image"
setCircleProfileImageUrl="@{data.profileImageUrl}"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="20dp"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:theme="@style/ShapeAppearanceOverlay.App.CircleImage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/img_profile_empty" />

<View
android:id="@+id/div_nickname"
android:layout_width="1dp"
android:layout_height="13dp"
android:layout_marginStart="7dp"
android:background="@color/gray_3"
app:layout_constraintBottom_toBottomOf="@id/tv_nickname_label"
app:layout_constraintStart_toEndOf="@id/tv_nickname_label"
app:layout_constraintTop_toTopOf="@id/tv_nickname_label" />
<TextView
android:id="@+id/tv_nickname_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="@string/nickname"
android:textAppearance="@style/Body3R"
app:layout_constraintBottom_toTopOf="@id/tv_github_label"
app:layout_constraintStart_toEndOf="@id/iv_profile_image"
app:layout_constraintTop_toTopOf="@id/iv_profile_image"
app:layout_constraintVertical_chainStyle="packed" />

<View
android:id="@+id/div_nickname"
android:layout_width="1dp"
android:layout_height="13dp"
android:layout_marginStart="7dp"
android:background="@color/gray_3"
app:layout_constraintBottom_toBottomOf="@id/tv_nickname_label"
app:layout_constraintStart_toEndOf="@id/tv_nickname_label"
app:layout_constraintTop_toTopOf="@id/tv_nickname_label" />

<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:text="@{data.nickname}"
android:textAppearance="@style/Body3M"
app:layout_constraintBottom_toBottomOf="@id/div_nickname"
app:layout_constraintStart_toEndOf="@id/div_nickname"
app:layout_constraintTop_toTopOf="@id/div_nickname"
tools:text="nickname" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:text="@{data.nickname}"
android:textAppearance="@style/Body3M"
app:layout_constraintBottom_toBottomOf="@id/div_nickname"
app:layout_constraintStart_toEndOf="@id/div_nickname"
app:layout_constraintTop_toTopOf="@id/div_nickname"
tools:text="nickname" />

<TextView
android:id="@+id/tv_github_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/github_kr"
android:textAppearance="@style/Body3R"
app:layout_constraintBottom_toBottomOf="@+id/iv_profile_image"
app:layout_constraintStart_toStartOf="@id/tv_nickname_label"
app:layout_constraintTop_toBottomOf="@id/tv_nickname_label" />
<TextView
android:id="@+id/tv_github_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/github_kr"
android:textAppearance="@style/Body3R"
app:layout_constraintBottom_toBottomOf="@+id/iv_profile_image"
app:layout_constraintStart_toStartOf="@id/tv_nickname_label"
app:layout_constraintTop_toBottomOf="@id/tv_nickname_label" />

<View
android:id="@+id/div_github"
android:layout_width="1dp"
android:layout_height="13dp"
android:layout_marginStart="7dp"
android:background="@color/gray_3"
app:layout_constraintBottom_toBottomOf="@id/tv_github_label"
app:layout_constraintStart_toEndOf="@id/tv_github_label"
app:layout_constraintTop_toTopOf="@id/tv_github_label" />

<View
android:id="@+id/div_github"
android:layout_width="1dp"
android:layout_height="13dp"
android:layout_marginStart="7dp"
android:background="@color/gray_3"
app:layout_constraintBottom_toBottomOf="@id/tv_github_label"
app:layout_constraintStart_toEndOf="@id/tv_github_label"
app:layout_constraintTop_toTopOf="@id/tv_github_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:text="@{`@` + data.githubId}"
android:textAppearance="@style/Body3M"
app:layout_constraintBottom_toBottomOf="@id/div_github"
app:layout_constraintStart_toEndOf="@id/div_github"
app:layout_constraintTop_toTopOf="@id/div_github"
tools:text="\@github_id" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:text="@{`@` + data.githubId}"
android:textAppearance="@style/Body3M"
app:layout_constraintBottom_toBottomOf="@id/div_github"
app:layout_constraintStart_toEndOf="@id/div_github"
app:layout_constraintTop_toTopOf="@id/div_github"
tools:text="\@github_id" />

</androidx.constraintlayout.widget.ConstraintLayout>

<View
android:id="@+id/div_horizontal_line"
Expand All @@ -103,7 +113,7 @@
android:layout_marginHorizontal="20dp"
android:layout_marginTop="12dp"
android:background="@color/gray_2"
app:layout_constraintTop_toBottomOf="@id/iv_profile_image" />
app:layout_constraintTop_toBottomOf="@id/cl_profile" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_progress"
Expand Down
2 changes: 1 addition & 1 deletion common-ui/src/main/res/menu/menu_edit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/edit_profile"
<item android:id="@+id/edit"
android:title="@string/edit"/>
</menu>
2 changes: 1 addition & 1 deletion common-ui/src/main/res/menu/menu_edit_delete.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/edit_profile"
<item android:id="@+id/edit"
android:title="@string/edit"/>
<item android:id="@+id/delete_mission"
android:title="@string/delete" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.lgtm.android.data.repository

import com.lgtm.domain.repository.LoggingRepository
import com.swm.logging.android.SWMLogging
import com.swm.logging.android.logging_scheme.SWMLoggingScheme
import javax.inject.Inject

class LoggingRepositoryImpl @Inject constructor() : LoggingRepository {
override fun shotSwmLogging(scheme: SWMLoggingScheme) {
SWMLogging.logEvent(scheme)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.lgtm.domain.logging

import com.swm.logging.android.logging_scheme.SWMLoggingScheme
import java.lang.reflect.Type

class SwmCommonLoggingScheme(
eventLogName: String,
screenName: String,
logVersion: String,
logData: Map<String, Any>,
) : SWMLoggingScheme() {

init {
setLoggingScheme(
eventLogName = eventLogName,
screenName = screenName,
logVersion = logVersion,
logData = logData.toMutableMap()
)
}

class Builder {
private lateinit var eventLogName: String
private lateinit var screenName: String
private var logVersion: String = "1"
private var map = mapOf<String, Any>()

fun setEventLogName(eventLogName: String): Builder {
this.eventLogName = eventLogName
return this
}

fun setScreenName(screenName: String): Builder {
this.screenName = screenName
return this
}

fun setScreenName(type: Type): Builder {
check(type is Class<*>)
this.screenName = type.simpleName
return this
}


fun setLogData(map: Map<String, Any>): Builder {
this.map = map
return this
}

fun setLogVersion(logVersion: Int): Builder {
this.logVersion = logVersion.toString()
return this
}

fun build(): SwmCommonLoggingScheme {
check(::eventLogName.isInitialized) { "eventLogName is not initialized" }
check(::screenName.isInitialized) { "screenName is not initialized" }

return SwmCommonLoggingScheme(
eventLogName,
screenName,
logVersion,
map
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.lgtm.domain.repository

import com.swm.logging.android.logging_scheme.SWMLoggingScheme

interface LoggingRepository {
fun shotSwmLogging(scheme: SWMLoggingScheme)
}
12 changes: 12 additions & 0 deletions domain/src/main/java/com/lgtm/domain/usecase/ProfileUseCase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@ class ProfileUseCase @Inject constructor(
) {

private lateinit var role: Role
private lateinit var nickname: String
private lateinit var github: String
private lateinit var introduction: String


suspend fun fetchProfileInfo(userId: Int? = null): Result<List<Profile>> {
return try {
val response = profileRepository.getProfileInfo(userId).getOrNull()
?: return Result.failure(Exception("response is null"))

role = response.memberType ?: throw IllegalStateException("memberType is null")
nickname = response.nickname
github = response.githubId
introduction = response.introduction

val profileList = when (response.memberType) {
Role.REVIEWEE -> getRevieweeProfile(response)
Expand All @@ -38,6 +45,10 @@ class ProfileUseCase @Inject constructor(
}
}

fun getNickname() = nickname
fun getGithub() = github
fun getIntroduction() = introduction

private fun commonProfileList(response: ProfileVO) = listOf(
ProfileImage(response.profileImageUrl, response.isMyProfile),
ProfileGlance(
Expand Down Expand Up @@ -66,6 +77,7 @@ class ProfileUseCase @Inject constructor(
*response.memberMissionHistory?.toTypedArray() ?: addEmptyView(),
)
}

private fun getReviewerProfile(response: ProfileVO): List<Profile> {
return commonProfileList(response) + listOf(
ProfileTitleText(ProfileTitleTextType.CAREER),
Expand Down
Loading

0 comments on commit 640ce09

Please sign in to comment.