parent
4180736065
commit
273ddb8b97
|
@ -5,16 +5,21 @@ import android.graphics.Rect
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.media3.common.util.UnstableApi
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kr.co.vividnext.sodalive.R
|
||||||
import kr.co.vividnext.sodalive.audition.detail.AuditionDetailActivity
|
import kr.co.vividnext.sodalive.audition.detail.AuditionDetailActivity
|
||||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||||
import kr.co.vividnext.sodalive.common.Constants
|
import kr.co.vividnext.sodalive.common.Constants
|
||||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||||
|
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||||
import kr.co.vividnext.sodalive.databinding.FragmentAuditionBinding
|
import kr.co.vividnext.sodalive.databinding.FragmentAuditionBinding
|
||||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
|
import kr.co.vividnext.sodalive.main.MainActivity
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
|
||||||
|
@UnstableApi
|
||||||
class AuditionFragment : BaseFragment<FragmentAuditionBinding>(
|
class AuditionFragment : BaseFragment<FragmentAuditionBinding>(
|
||||||
FragmentAuditionBinding::inflate
|
FragmentAuditionBinding::inflate
|
||||||
) {
|
) {
|
||||||
|
@ -32,6 +37,12 @@ class AuditionFragment : BaseFragment<FragmentAuditionBinding>(
|
||||||
viewModel.getAuditionList()
|
viewModel.getAuditionList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
|
||||||
|
setAuditionNotification(SharedPreferenceManager.isAuditionNotification)
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupView() {
|
private fun setupView() {
|
||||||
loadingDialog = LoadingDialog(requireActivity(), layoutInflater)
|
loadingDialog = LoadingDialog(requireActivity(), layoutInflater)
|
||||||
|
|
||||||
|
@ -79,6 +90,12 @@ class AuditionFragment : BaseFragment<FragmentAuditionBinding>(
|
||||||
})
|
})
|
||||||
|
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
|
|
||||||
|
binding.ivNotification.setOnClickListener {
|
||||||
|
viewModel.updateNotificationSettings {
|
||||||
|
setAuditionNotification(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindData() {
|
private fun bindData() {
|
||||||
|
@ -98,4 +115,14 @@ class AuditionFragment : BaseFragment<FragmentAuditionBinding>(
|
||||||
adapter.addGroupedList(it)
|
adapter.addGroupedList(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setAuditionNotification(isAuditionNotification: Boolean) {
|
||||||
|
binding.ivNotification.setImageResource(
|
||||||
|
if (isAuditionNotification) {
|
||||||
|
R.drawable.btn_audition_notification_selected
|
||||||
|
} else {
|
||||||
|
R.drawable.btn_audition_notification_normal
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,13 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||||
|
import kr.co.vividnext.sodalive.settings.notification.UpdateNotificationSettingRequest
|
||||||
|
import kr.co.vividnext.sodalive.user.UserRepository
|
||||||
|
|
||||||
class AuditionViewModel(private val repository: AuditionRepository) : BaseViewModel() {
|
class AuditionViewModel(
|
||||||
|
private val repository: AuditionRepository,
|
||||||
|
private val userRepository: UserRepository
|
||||||
|
) : BaseViewModel() {
|
||||||
private val _toastLiveData = MutableLiveData<String?>()
|
private val _toastLiveData = MutableLiveData<String?>()
|
||||||
val toastLiveData: LiveData<String?>
|
val toastLiveData: LiveData<String?>
|
||||||
get() = _toastLiveData
|
get() = _toastLiveData
|
||||||
|
@ -65,4 +70,30 @@ class AuditionViewModel(private val repository: AuditionRepository) : BaseViewMo
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateNotificationSettings(onSuccess: (Boolean) -> Unit) {
|
||||||
|
val isActiveNotification = !SharedPreferenceManager.isAuditionNotification
|
||||||
|
|
||||||
|
compositeDisposable.add(
|
||||||
|
userRepository.updateNotificationSettings(
|
||||||
|
request = UpdateNotificationSettingRequest(
|
||||||
|
audition = isActiveNotification
|
||||||
|
),
|
||||||
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
|
)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
if (it.success) {
|
||||||
|
SharedPreferenceManager.isAuditionNotification = isActiveNotification
|
||||||
|
onSuccess(isActiveNotification)
|
||||||
|
} else {
|
||||||
|
onSuccess(!isActiveNotification)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ object Constants {
|
||||||
const val PREF_PROFILE_IMAGE = "pref_profile_image"
|
const val PREF_PROFILE_IMAGE = "pref_profile_image"
|
||||||
const val PREF_CONTENT_PREFERENCE = "pref_content_preference"
|
const val PREF_CONTENT_PREFERENCE = "pref_content_preference"
|
||||||
const val PREF_IS_CONTENT_PLAY_LOOP = "pref_is_content_play_loop"
|
const val PREF_IS_CONTENT_PLAY_LOOP = "pref_is_content_play_loop"
|
||||||
|
const val PREF_IS_AUDITION_NOTIFICATION = "pref_is_audition_notification"
|
||||||
const val PREF_IS_ADULT_CONTENT_VISIBLE = "pref_is_adult_content_visible"
|
const val PREF_IS_ADULT_CONTENT_VISIBLE = "pref_is_adult_content_visible"
|
||||||
const val PREF_IS_FOLLOWED_CREATOR_LIVE = "pref_is_followed_creator_live"
|
const val PREF_IS_FOLLOWED_CREATOR_LIVE = "pref_is_followed_creator_live"
|
||||||
const val PREF_IS_PLAYER_SERVICE_RUNNING = "pref_is_player_service_running"
|
const val PREF_IS_PLAYER_SERVICE_RUNNING = "pref_is_player_service_running"
|
||||||
|
|
|
@ -107,6 +107,12 @@ object SharedPreferenceManager {
|
||||||
sharedPreferences[Constants.PREF_IS_ADULT] = value
|
sharedPreferences[Constants.PREF_IS_ADULT] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isAuditionNotification: Boolean
|
||||||
|
get() = sharedPreferences[Constants.PREF_IS_AUDITION_NOTIFICATION, false]
|
||||||
|
set(value) {
|
||||||
|
sharedPreferences[Constants.PREF_IS_AUDITION_NOTIFICATION] = value
|
||||||
|
}
|
||||||
|
|
||||||
var isAdultContentVisible: Boolean
|
var isAdultContentVisible: Boolean
|
||||||
get() = sharedPreferences[Constants.PREF_IS_ADULT_CONTENT_VISIBLE, true]
|
get() = sharedPreferences[Constants.PREF_IS_ADULT_CONTENT_VISIBLE, true]
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
|
@ -286,7 +286,7 @@ class AppDI(private val context: Context, isDebugMode: Boolean) {
|
||||||
viewModel { AudioContentPlaylistCreateViewModel(get()) }
|
viewModel { AudioContentPlaylistCreateViewModel(get()) }
|
||||||
viewModel { AudioContentPlaylistModifyViewModel(get()) }
|
viewModel { AudioContentPlaylistModifyViewModel(get()) }
|
||||||
viewModel { AudioContentPlayerViewModel() }
|
viewModel { AudioContentPlayerViewModel() }
|
||||||
viewModel { AuditionViewModel(get()) }
|
viewModel { AuditionViewModel(get(), get()) }
|
||||||
viewModel { AuditionDetailViewModel(get()) }
|
viewModel { AuditionDetailViewModel(get()) }
|
||||||
viewModel { AuditionRoleDetailViewModel(get()) }
|
viewModel { AuditionRoleDetailViewModel(get()) }
|
||||||
viewModel { AudioContentMainCreatorRankingViewModel(get()) }
|
viewModel { AudioContentMainCreatorRankingViewModel(get()) }
|
||||||
|
|
|
@ -98,6 +98,7 @@ class MainViewModel(
|
||||||
SharedPreferenceManager.can = data.can
|
SharedPreferenceManager.can = data.can
|
||||||
SharedPreferenceManager.role = data.role.name
|
SharedPreferenceManager.role = data.role.name
|
||||||
SharedPreferenceManager.isAuth = data.isAuth
|
SharedPreferenceManager.isAuth = data.isAuth
|
||||||
|
SharedPreferenceManager.isAuditionNotification = data.auditionNotice ?: false
|
||||||
if (
|
if (
|
||||||
data.followingChannelUploadContentNotice == null &&
|
data.followingChannelUploadContentNotice == null &&
|
||||||
data.followingChannelLiveNotice == null &&
|
data.followingChannelLiveNotice == null &&
|
||||||
|
|
|
@ -12,7 +12,9 @@ data class GetMemberInfoResponse(
|
||||||
@SerializedName("followingChannelLiveNotice")
|
@SerializedName("followingChannelLiveNotice")
|
||||||
val followingChannelLiveNotice: Boolean?,
|
val followingChannelLiveNotice: Boolean?,
|
||||||
@SerializedName("followingChannelUploadContentNotice")
|
@SerializedName("followingChannelUploadContentNotice")
|
||||||
val followingChannelUploadContentNotice: Boolean?
|
val followingChannelUploadContentNotice: Boolean?,
|
||||||
|
@SerializedName("auditionNotice")
|
||||||
|
val auditionNotice: Boolean?
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class MemberRole {
|
enum class MemberRole {
|
||||||
|
|
|
@ -7,5 +7,6 @@ import com.google.gson.annotations.SerializedName
|
||||||
data class UpdateNotificationSettingRequest(
|
data class UpdateNotificationSettingRequest(
|
||||||
@SerializedName("live") var live: Boolean? = null,
|
@SerializedName("live") var live: Boolean? = null,
|
||||||
@SerializedName("uploadContent") var uploadContent: Boolean? = null,
|
@SerializedName("uploadContent") var uploadContent: Boolean? = null,
|
||||||
@SerializedName("message") var message: Boolean? = null
|
@SerializedName("message") var message: Boolean? = null,
|
||||||
|
@SerializedName("audition") var audition: Boolean? = null
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
|
@ -8,7 +8,6 @@
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_marginStart="13.3dp"
|
android:layout_marginStart="13.3dp"
|
||||||
android:layout_marginTop="13.3dp"
|
android:layout_marginTop="13.3dp"
|
||||||
android:fontFamily="@font/gmarket_sans_bold"
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
@ -18,6 +17,18 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_notification"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="13.3dp"
|
||||||
|
android:layout_marginEnd="13.3dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/btn_audition_notification_normal"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_audition"
|
android:id="@+id/rv_audition"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
Loading…
Reference in New Issue