mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Add send/recv/render support for text stories.
This commit is contained in:
committed by
Cody Henthorne
parent
3a2e8b9b19
commit
ff8d7fa6c2
@@ -17,11 +17,33 @@ enum class StoryType(val code: Int) {
|
||||
/**
|
||||
* User cannot send replies to this story.
|
||||
*/
|
||||
STORY_WITHOUT_REPLIES(2);
|
||||
STORY_WITHOUT_REPLIES(2),
|
||||
|
||||
val isStory get() = this == STORY_WITH_REPLIES || this == STORY_WITHOUT_REPLIES
|
||||
/**
|
||||
* Text story that allows replies
|
||||
*/
|
||||
TEXT_STORY_WITH_REPLIES(3),
|
||||
|
||||
val isStoryWithReplies get() = this == STORY_WITH_REPLIES
|
||||
/**
|
||||
* Text story that does not allow replies
|
||||
*/
|
||||
TEXT_STORY_WITHOUT_REPLIES(4);
|
||||
|
||||
val isStory get() = this != NONE
|
||||
|
||||
val isStoryWithReplies get() = this == STORY_WITH_REPLIES || this == TEXT_STORY_WITH_REPLIES
|
||||
|
||||
val isTextStory get() = this == TEXT_STORY_WITHOUT_REPLIES || this == TEXT_STORY_WITH_REPLIES
|
||||
|
||||
fun toTextStoryType(): StoryType {
|
||||
return when (this) {
|
||||
NONE -> NONE
|
||||
STORY_WITH_REPLIES -> TEXT_STORY_WITH_REPLIES
|
||||
STORY_WITHOUT_REPLIES -> TEXT_STORY_WITHOUT_REPLIES
|
||||
TEXT_STORY_WITH_REPLIES -> TEXT_STORY_WITH_REPLIES
|
||||
TEXT_STORY_WITHOUT_REPLIES -> TEXT_STORY_WITHOUT_REPLIES
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@@ -29,8 +51,20 @@ enum class StoryType(val code: Int) {
|
||||
return when (code) {
|
||||
1 -> STORY_WITH_REPLIES
|
||||
2 -> STORY_WITHOUT_REPLIES
|
||||
3 -> TEXT_STORY_WITH_REPLIES
|
||||
4 -> TEXT_STORY_WITHOUT_REPLIES
|
||||
else -> NONE
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun withReplies(isTextStory: Boolean): StoryType {
|
||||
return if (isTextStory) TEXT_STORY_WITH_REPLIES else STORY_WITH_REPLIES
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun withoutReplies(isTextStory: Boolean): StoryType {
|
||||
return if (isTextStory) TEXT_STORY_WITHOUT_REPLIES else STORY_WITHOUT_REPLIES
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user