Skip to content
Snippets Groups Projects
Commit 16f56377 authored by Taras's avatar Taras
Browse files

Remove unused

parent 5c1ac77f
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ import org.futo.circles.core.extensions.observeResponse ...@@ -19,6 +19,7 @@ import org.futo.circles.core.extensions.observeResponse
import org.futo.circles.core.extensions.showNoInternetConnection import org.futo.circles.core.extensions.showNoInternetConnection
import org.futo.circles.core.extensions.showSuccess import org.futo.circles.core.extensions.showSuccess
import org.futo.circles.core.extensions.withConfirmation import org.futo.circles.core.extensions.withConfirmation
import org.futo.circles.core.feature.share.ShareProvider
import org.futo.circles.core.model.PostContent import org.futo.circles.core.model.PostContent
import org.futo.circles.feature.timeline.TimelineDialogFragmentArgs import org.futo.circles.feature.timeline.TimelineDialogFragmentArgs
import org.futo.circles.feature.timeline.list.PostOptionsListener import org.futo.circles.feature.timeline.list.PostOptionsListener
...@@ -35,12 +36,9 @@ class DMTimelineDialogFragment : ...@@ -35,12 +36,9 @@ class DMTimelineDialogFragment :
BaseFullscreenDialogFragment<DialogFragmentDmTimelineBinding>(DialogFragmentDmTimelineBinding::inflate), BaseFullscreenDialogFragment<DialogFragmentDmTimelineBinding>(DialogFragmentDmTimelineBinding::inflate),
PostOptionsListener, PostMenuListener, EmojiPickerListener, PostSentListener { PostOptionsListener, PostMenuListener, EmojiPickerListener, PostSentListener {
private val args: TimelineDialogFragmentArgs by navArgs() private val args: DMTimelineDialogFragmentArgs by navArgs()
private val viewModel by viewModels<DMTimelineViewModel>() private val viewModel by viewModels<DMTimelineViewModel>()
private val isGroupMode by lazy { args.timelineId == null }
private val isThread by lazy { args.threadEventId != null }
private val videoPlayer by lazy { private val videoPlayer by lazy {
ExoPlayer.Builder(requireContext()).build().apply { ExoPlayer.Builder(requireContext()).build().apply {
repeatMode = Player.REPEAT_MODE_ONE repeatMode = Player.REPEAT_MODE_ONE
...@@ -48,7 +46,7 @@ class DMTimelineDialogFragment : ...@@ -48,7 +46,7 @@ class DMTimelineDialogFragment :
} }
private val listAdapter by lazy { private val listAdapter by lazy {
TimelineAdapter(this, isThread, videoPlayer).apply { TimelineAdapter(this, false, videoPlayer).apply {
setHasStableIds(true) setHasStableIds(true)
} }
} }
...@@ -90,22 +88,23 @@ class DMTimelineDialogFragment : ...@@ -90,22 +88,23 @@ class DMTimelineDialogFragment :
private fun setupObservers() { private fun setupObservers() {
viewModel.titleLiveData.observeData(this) { roomName -> viewModel.titleLiveData.observeData(this) { roomName ->
val title = if (isThread) getString(R.string.thread_format, roomName) else roomName binding.toolbar.apply {
binding.toolbar.title = title title = roomName
setOnClickListener { }
}
} }
viewModel.timelineEventsLiveData.observeData(this) { viewModel.timelineEventsLiveData.observeData(this) {
listAdapter.submitList(it) listAdapter.submitList(it)
viewModel.markTimelineAsRead(args.roomId, isGroupMode) viewModel.markTimelineAsRead(args.roomId, true)
}
viewModel.shareLiveData.observeData(this) { content ->
context?.let { ShareProvider.share(it, content) }
} }
viewModel.saveToDeviceLiveData.observeData(this) { viewModel.saveToDeviceLiveData.observeData(this) {
context?.let { showSuccess(it.getString(R.string.saved)) } context?.let { showSuccess(it.getString(R.string.saved)) }
} }
viewModel.unSendReactionLiveData.observeResponse(this) viewModel.unSendReactionLiveData.observeResponse(this)
viewModel.profileLiveData?.observeData(this) { user ->
//user.getOrNull()?.let { binding.lCreatePost.setUserInfo(it) }
}
} }
override fun onPostSent() { override fun onPostSent() {
...@@ -133,8 +132,6 @@ class DMTimelineDialogFragment : ...@@ -133,8 +132,6 @@ class DMTimelineDialogFragment :
} }
override fun onReply(roomId: String, eventId: String) { override fun onReply(roomId: String, eventId: String) {
if (isThread) return
//navigator.navigateToThread(roomId, eventId)
} }
override fun onShare(content: PostContent, view: View) { override fun onShare(content: PostContent, view: View) {
...@@ -146,7 +143,6 @@ class DMTimelineDialogFragment : ...@@ -146,7 +143,6 @@ class DMTimelineDialogFragment :
} }
override fun onIgnore(senderId: String) { override fun onIgnore(senderId: String) {
//withConfirmation(IgnoreSender()) { viewModel.ignoreSender(senderId) }
} }
override fun onSaveToDevice(content: PostContent) { override fun onSaveToDevice(content: PostContent) {
......
...@@ -33,15 +33,13 @@ class DMTimelineViewModel @Inject constructor( ...@@ -33,15 +33,13 @@ class DMTimelineViewModel @Inject constructor(
) : BaseTimelineViewModel( ) : BaseTimelineViewModel(
savedStateHandle, savedStateHandle,
context, context,
timelineDataSourceFactory.create(savedStateHandle.get<String>("timelineId") != null), timelineDataSourceFactory.create(false),
circleFilterAccountDataManager circleFilterAccountDataManager
) { ) {
val session = MatrixSessionProvider.currentSession val session = MatrixSessionProvider.currentSession
val profileLiveData = session?.userService()?.getUserLive(session.myUserId)
val shareLiveData = SingleEventLiveData<ShareableContent>() val shareLiveData = SingleEventLiveData<ShareableContent>()
val saveToDeviceLiveData = SingleEventLiveData<Unit>() val saveToDeviceLiveData = SingleEventLiveData<Unit>()
val ignoreUserLiveData = SingleEventLiveData<Response<Unit?>>()
val unSendReactionLiveData = SingleEventLiveData<Response<Cancelable?>>() val unSendReactionLiveData = SingleEventLiveData<Response<Cancelable?>>()
fun sharePostContent(content: PostContent, view: View) { fun sharePostContent(content: PostContent, view: View) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment