Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ interface ChatComponent {
val appPreferences: AppPreferences
val stickerRepository: StickerRepository
val state: StateFlow<State>
val chatUiState: StateFlow<ChatUiState>
val selectionState: StateFlow<MessageSelectionState>
val searchState: StateFlow<SearchState>
val appearanceState: StateFlow<AppearanceState>
val messagesState: StateFlow<MessagesState>
val inputState: StateFlow<InputState>
val pinnedState: StateFlow<PinnedState>
val mediaViewerState: StateFlow<MediaViewerState>
val repositoryMessage: MessageRepository
val downloadUtils: IDownloadUtils

Expand Down Expand Up @@ -337,4 +345,155 @@ interface ChatComponent {
val scheduledMessages: List<MessageModel> = emptyList(),
val lastReadInboxMessageId: Long = 0L,
)

@Stable
data class MessagesState(
val chatId: Long = 0L,
val messages: List<MessageModel> = emptyList(),
val isLoading: Boolean = false,
val isLoadingOlder: Boolean = false,
val isLoadingNewer: Boolean = false,
val scrollToMessageId: Long? = null,
val pendingScrollCommand: ChatScrollCommand? = null,
val highlightedMessageId: Long? = null,
val isAtBottom: Boolean = true,
val currentScrollMessageId: Long = 0L,
val lastScrollPosition: Long = 0L,
val lastSavedViewport: ChatViewportCacheEntry? = null,
val isLatestLoaded: Boolean = true,
val isOldestLoaded: Boolean = false,
val lastReadInboxMessageId: Long = 0L
)

@Stable
data class ChatUiState(
val chatId: Long = 0L,
val chatTitle: String = "Chat",
val chatAvatar: String? = null,
val chatPersonalAvatar: String? = null,
val chatEmojiStatus: String? = null,
val isGroup: Boolean = false,
val isChannel: Boolean = false,
val isSecretChat: Boolean = false,
val isOnline: Boolean = false,
val isVerified: Boolean = false,
val isSponsor: Boolean = false,
val canWrite: Boolean = false,
val isAdmin: Boolean = false,
val permissions: ChatPermissionsModel = ChatPermissionsModel(),
val slowModeDelay: Int = 0,
val slowModeDelayExpiresIn: Double = 0.0,
val isCurrentUserRestricted: Boolean = false,
val restrictedUntilDate: Int = 0,
val memberCount: Int = 0,
val onlineCount: Int = 0,
val unreadCount: Int = 0,
val unreadMentionCount: Int = 0,
val unreadReactionCount: Int = 0,
val userStatus: String? = null,
val typingAction: String? = null,
val pollVoters: List<UserModel> = emptyList(),
val showPollVoters: Boolean = false,
val isPollVotersLoading: Boolean = false,
val viewAsTopics: Boolean = false,
val topics: List<TopicModel> = emptyList(),
val currentTopicId: Long? = null,
val rootMessage: MessageModel? = null,
val isLoadingTopics: Boolean = false,
val isWhitelistedInAdBlock: Boolean = false,
val isMuted: Boolean = false,
val showReportDialog: Boolean = false,
val showBotCommands: Boolean = false,
val currentUser: UserModel? = null,
val otherUser: UserModel? = null,
val isMember: Boolean = true,
val restrictUserId: Long? = null,
val isInstalledFromGooglePlay: Boolean = true
)

@Stable
data class MessageSelectionState(
val selectedMessageIds: Set<Long> = emptySet()
)

@Stable
data class SearchState(
val isSearchActive: Boolean = false,
val searchQuery: String = ""
)

@Stable
data class AppearanceState(
val fontSize: Float = 16f,
val letterSpacing: Float = 0f,
val bubbleRadius: Float = 18f,
val stickerSize: Float = 200f,
val wallpaper: String? = null,
val wallpaperModel: WallpaperModel? = null,
val isWallpaperBlurred: Boolean = false,
val wallpaperBlurIntensity: Int = 20,
val isWallpaperMoving: Boolean = false,
val wallpaperDimming: Int = 0,
val isWallpaperGrayscale: Boolean = false,
val autoDownloadMobile: Boolean = true,
val autoDownloadWifi: Boolean = true,
val autoDownloadRoaming: Boolean = false,
val autoDownloadFiles: Boolean = false,
val autoplayGifs: Boolean = true,
val autoplayVideos: Boolean = true,
val showLinkPreviews: Boolean = true,
val isChatAnimationsEnabled: Boolean = true
)

@Stable
data class InputState(
val chatId: Long = 0L,
val replyMessage: MessageModel? = null,
val editingMessage: MessageModel? = null,
val draftText: String = "",
val selectedStickerSet: StickerSetModel? = null,
val isBot: Boolean = false,
val botCommands: List<BotCommandModel> = emptyList(),
val botMenuButton: BotMenuButtonModel = BotMenuButtonModel.Default,
val mentionSuggestions: List<UserModel> = emptyList(),
val inlineBotResults: InlineBotResultsModel? = null,
val currentInlineBotUsername: String? = null,
val currentInlineQuery: String? = null,
val isInlineBotLoading: Boolean = false,
val attachMenuBots: List<AttachMenuBotModel> = emptyList(),
val scheduledMessages: List<MessageModel> = emptyList()
)

@Stable
data class PinnedState(
val pinnedMessage: MessageModel? = null,
val allPinnedMessages: List<MessageModel> = emptyList(),
val showPinnedMessagesList: Boolean = false,
val isLoadingPinnedMessages: Boolean = false,
val pinnedMessageCount: Int = 0,
val pinnedMessageIndex: Int = 0
)

@Stable
data class MediaViewerState(
val instantViewUrl: String? = null,
val youtubeUrl: String? = null,
val miniAppUrl: String? = null,
val miniAppName: String? = null,
val miniAppBotUserId: Long = 0L,
val showMiniAppTOS: Boolean = false,
val miniAppTOSBotUserId: Long = 0L,
val miniAppTOSUrl: String? = null,
val miniAppTOSName: String? = null,
val webViewUrl: String? = null,
val fullScreenImages: List<String>? = null,
val fullScreenImageMessageIds: List<Long> = emptyList(),
val fullScreenCaptions: List<String?> = emptyList(),
val fullScreenStartIndex: Int = 0,
val fullScreenVideoMessageId: Long? = null,
val fullScreenVideoPath: String? = null,
val fullScreenVideoCaption: String? = null,
val invoiceSlug: String? = null,
val invoiceMessageId: Long? = null
)
}
Loading