Add send/recv/render support for text stories.

This commit is contained in:
Alex Hart
2022-03-09 13:11:56 -04:00
committed by Cody Henthorne
parent 3a2e8b9b19
commit ff8d7fa6c2
40 changed files with 963 additions and 93 deletions

View File

@@ -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
}
}
}