parent
181ac26cae
commit
588f107300
5 changed files with 22 additions and 1 deletions
|
@ -152,6 +152,7 @@ object StoryContextMenu {
|
|||
anchorView: View,
|
||||
storyViewerPageState: StoryViewerPageState,
|
||||
onHide: (StoryPost) -> Unit,
|
||||
onUnhide: (StoryPost) -> Unit,
|
||||
onForward: (StoryPost) -> Unit,
|
||||
onShare: (StoryPost) -> Unit,
|
||||
onGoToChat: (StoryPost) -> Unit,
|
||||
|
@ -171,7 +172,7 @@ object StoryContextMenu {
|
|||
canHide = !selectedStory.sender.shouldHideStory,
|
||||
callbacks = object : Callbacks {
|
||||
override fun onHide() = onHide(selectedStory)
|
||||
override fun onUnhide() = throw NotImplementedError()
|
||||
override fun onUnhide() = onUnhide(selectedStory)
|
||||
override fun onForward() = onForward(selectedStory)
|
||||
override fun onShare() = onShare(selectedStory)
|
||||
override fun onGoToChat() = onGoToChat(selectedStory)
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.google.android.material.button.MaterialButton
|
|||
import com.google.android.material.card.MaterialCardView
|
||||
import com.google.android.material.progressindicator.CircularProgressIndicatorSpec
|
||||
import com.google.android.material.progressindicator.IndeterminateDrawable
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import io.reactivex.rxjava3.kotlin.subscribeBy
|
||||
|
@ -1159,6 +1160,13 @@ class StoryViewerPageFragment :
|
|||
}
|
||||
}
|
||||
},
|
||||
onUnhide = {
|
||||
lifecycleDisposable += viewModel.unhideStory().subscribe {
|
||||
Snackbar
|
||||
.make(requireView(), R.string.StoryViewerPageFragment__story_no_longer_hidden, Snackbar.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
},
|
||||
onShare = {
|
||||
StoryContextMenu.share(this, it.conversationMessage.messageRecord as MmsMessageRecord)
|
||||
},
|
||||
|
|
|
@ -171,6 +171,12 @@ open class StoryViewerPageRepository(context: Context, private val storyViewStat
|
|||
}.subscribeOn(Schedulers.io())
|
||||
}
|
||||
|
||||
fun unhideStory(recipientId: RecipientId): Completable {
|
||||
return Completable.fromAction {
|
||||
SignalDatabase.recipients.setHideStory(recipientId, false)
|
||||
}.subscribeOn(Schedulers.io())
|
||||
}
|
||||
|
||||
fun markViewed(storyPost: StoryPost) {
|
||||
if (!storyPost.conversationMessage.messageRecord.isOutgoing) {
|
||||
SignalExecutors.SERIAL.execute {
|
||||
|
|
|
@ -117,6 +117,10 @@ class StoryViewerPageViewModel(
|
|||
return repository.hideStory(args.recipientId)
|
||||
}
|
||||
|
||||
fun unhideStory(): Completable {
|
||||
return repository.unhideStory(args.recipientId).observeOn(AndroidSchedulers.mainThread())
|
||||
}
|
||||
|
||||
fun markViewed(storyPost: StoryPost) {
|
||||
repository.markViewed(storyPost)
|
||||
}
|
||||
|
|
|
@ -5986,6 +5986,8 @@
|
|||
<item quantity="one">%1$d reply</item>
|
||||
<item quantity="other">%1$d replies</item>
|
||||
</plurals>
|
||||
<!-- Toast / Snackbar label when unhiding a story during viewer -->
|
||||
<string name="StoryViewerPageFragment__story_no_longer_hidden">Story no longer hidden</string>
|
||||
<!-- Label on group stories to add a story -->
|
||||
<string name="StoryViewerPageFragment__add">Add</string>
|
||||
<!-- Used when view receipts are disabled -->
|
||||
|
|
Loading…
Add table
Reference in a new issue