|
@ -67,8 +67,8 @@ class SeriesDetailViewModel(
|
|||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
userRepository.creatorFollow(
|
||||
creatorId,
|
||||
"Bearer ${SharedPreferenceManager.token}"
|
||||
creatorId = creatorId,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package kr.co.vividnext.sodalive.explorer.profile
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kr.co.vividnext.sodalive.R
|
||||
|
||||
class CreatorFollowNotifyFragment(
|
||||
private val onClickNotifyAll: () -> Unit,
|
||||
private val onClickNotifyNone: () -> Unit,
|
||||
private val onClickUnFollow: () -> Unit,
|
||||
) : BottomSheetDialogFragment() {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View = inflater.inflate(
|
||||
R.layout.fragment_creator_follow_notify,
|
||||
container,
|
||||
false
|
||||
)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
view.findViewById<LinearLayout>(R.id.ll_notify_all).setOnClickListener {
|
||||
onClickNotifyAll()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
|
||||
view.findViewById<LinearLayout>(R.id.ll_notify_none).setOnClickListener {
|
||||
onClickNotifyNone()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
|
||||
view.findViewById<LinearLayout>(R.id.ll_unfollow).setOnClickListener {
|
||||
onClickUnFollow()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,6 +41,8 @@ data class CreatorResponse(
|
|||
@SerializedName("websiteUrl") val websiteUrl: String? = null,
|
||||
@SerializedName("blogUrl") val blogUrl: String? = null,
|
||||
@SerializedName("isAvailableChat") val isAvailableChat: Boolean = true,
|
||||
@SerializedName("isFollow") val isFollow: Boolean,
|
||||
@SerializedName("isNotify") val isNotify: Boolean,
|
||||
@SerializedName("isNotification") val isNotification: Boolean,
|
||||
@SerializedName("notificationRecipientCount") val notificationRecipientCount: Int
|
||||
)
|
||||
|
|
|
@ -83,6 +83,8 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
|||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var userId: Long = 0
|
||||
|
||||
private var notifyFragment: CreatorFollowNotifyFragment? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
userId = intent.getLongExtra(Constants.EXTRA_USER_ID, 0)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -703,10 +705,32 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
|||
}
|
||||
}
|
||||
|
||||
if (creator.isNotification) {
|
||||
layoutUserProfile.ivNotification.setImageResource(R.drawable.btn_following_big)
|
||||
if (creator.isFollow) {
|
||||
layoutUserProfile.ivNotification.setImageResource(
|
||||
if (creator.isNotify) {
|
||||
R.drawable.btn_following_big
|
||||
} else {
|
||||
R.drawable.btn_following_no_alarm_big
|
||||
}
|
||||
)
|
||||
|
||||
layoutUserProfile.ivNotification.setOnClickListener {
|
||||
viewModel.unFollow(creator.creatorId)
|
||||
if (notifyFragment == null) {
|
||||
notifyFragment = CreatorFollowNotifyFragment(
|
||||
onClickNotifyAll = {
|
||||
viewModel.follow(creator.creatorId, follow = true, notify = true)
|
||||
},
|
||||
onClickNotifyNone = {
|
||||
viewModel.follow(creator.creatorId, follow = true, notify = false)
|
||||
},
|
||||
onClickUnFollow = {
|
||||
viewModel.follow(creator.creatorId, follow = false, notify = false)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (notifyFragment!!.isAdded) return@setOnClickListener
|
||||
notifyFragment!!.show(supportFragmentManager, notifyFragment!!.tag)
|
||||
}
|
||||
} else {
|
||||
layoutUserProfile.ivNotification.setImageResource(R.drawable.btn_follow_big)
|
||||
|
|
|
@ -16,7 +16,6 @@ import kr.co.vividnext.sodalive.base.BaseViewModel
|
|||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.explorer.ExplorerRepository
|
||||
import kr.co.vividnext.sodalive.explorer.profile.cheers.PutModifyCheersRequest
|
||||
import kr.co.vividnext.sodalive.explorer.profile.creator_community.GetCommunityPostListResponse
|
||||
import kr.co.vividnext.sodalive.report.ReportRepository
|
||||
import kr.co.vividnext.sodalive.report.ReportRequest
|
||||
import kr.co.vividnext.sodalive.report.ReportType
|
||||
|
@ -147,12 +146,14 @@ class UserProfileViewModel(
|
|||
)
|
||||
}
|
||||
|
||||
fun follow(creatorId: Long) {
|
||||
fun follow(creatorId: Long, follow: Boolean = true, notify: Boolean = true) {
|
||||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
userRepository.creatorFollow(
|
||||
creatorId,
|
||||
"Bearer ${SharedPreferenceManager.token}"
|
||||
follow = follow,
|
||||
notify = notify,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
|
@ -88,8 +88,8 @@ class UserFollowerListViewModel(
|
|||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
userRepository.creatorFollow(
|
||||
creatorId,
|
||||
"Bearer ${SharedPreferenceManager.token}"
|
||||
creatorId = creatorId,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
|
@ -4,4 +4,8 @@ import androidx.annotation.Keep
|
|||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
@Keep
|
||||
data class CreatorFollowRequestRequest(@SerializedName("creatorId") val creatorId: Long)
|
||||
data class CreatorFollowRequestRequest(
|
||||
@SerializedName("creatorId") val creatorId: Long,
|
||||
@SerializedName("isNotify") val isNotify: Boolean = true,
|
||||
@SerializedName("isActive") val isActive: Boolean = true
|
||||
)
|
||||
|
|
|
@ -54,9 +54,15 @@ class UserRepository(private val userApi: UserApi) {
|
|||
|
||||
fun creatorFollow(
|
||||
creatorId: Long,
|
||||
follow: Boolean = true,
|
||||
notify: Boolean = true,
|
||||
token: String
|
||||
) = userApi.creatorFollow(
|
||||
request = CreatorFollowRequestRequest(creatorId = creatorId),
|
||||
request = CreatorFollowRequestRequest(
|
||||
creatorId = creatorId,
|
||||
isActive = follow,
|
||||
isNotify = notify
|
||||
),
|
||||
authHeader = token
|
||||
)
|
||||
|
||||
|
|
After Width: | Height: | Size: 502 B |
After Width: | Height: | Size: 793 B |
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_top_round_corner_10_222222"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
android:text="알림"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="18.3sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_notify_all"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_notify_all" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:text="전체"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="13.3sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_notify_none"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_notify_none" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:text="없음"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="13.3sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_unfollow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_avatar_unfollow" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:text="팔로우 취소"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="13.3sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|