ChatRepository class
Implementation of an AbstractChatRepository.
- Inheritance
-
- Object
- GetLifeCycle
- DisposableInterface
- ChatRepository
- Implemented types
Constructors
- ChatRepository(GraphQlProvider _graphQlProvider, ChatDriftProvider _chatLocal, ChatItemDriftProvider _itemsLocal, ChatMemberDriftProvider _membersLocal, AbstractCallRepository _callRepo, DraftDriftProvider _draftLocal, UserRepository _userRepo, VersionDriftProvider _sessionLocal, MonologDriftProvider _monologLocal, {required UserId me})
Properties
-
calls
→ RxObsMap<
ChatId, Rx< OngoingCall> > -
Returns the map of the current OngoingCalls.
no setter
-
chats
→ RxObsMap<
ChatId, RxChatImpl> -
Returns reactive map of all RxChats stored.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNext → RxBool
-
Indicates whether the paginated have next page.
no setteroverride
- initialized → bool
-
Checks whether the controller has already been initialized.
no setterinherited
- isClosed → bool
-
Checks whether the controller has already been closed.
no setterinherited
- isRemote → bool
-
Indicates whether this ChatRepository uses a remote pagination.
no setter
- me → UserId
-
UserId of the currently authenticated MyUser.
final
- monolog ↔ ChatId
-
Returns ChatId of the Chat-monolog of the currently authenticated
MyUser, if any.
getter/setter pairoverride-getter
- nextLoading → RxBool
-
Indicates whether a next page of the paginated is loading.
no setteroverride
-
onDelete
→ InternalFinalCallback<
void> -
Internal callback that starts the cycle of this controller.
finalinherited
-
onMemberRemoved
↔ Future<
void> Function(ChatId id, UserId userId) -
Callback, called when an User identified by the provided
userId
is removed from the specified Chat.latefinal -
onStart
→ InternalFinalCallback<
void> -
Called at the exact moment the widget is allocated in memory.
It uses an internal "callable" type, to avoid any @overrides in subclases.
This method should be internal and is required to define the
lifetime cycle of the subclass.
finalinherited
-
paginated
→ RxObsMap<
ChatId, RxChatImpl> -
Returns reactive map of RxChats in the current pagination view.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
status
→ Rx<
RxStatus> -
Returns the initialization
RxStatus
of this repository.final
Methods
-
$configureLifeCycle(
) → void -
inherited
-
addCall(
ChatCall call) → void - Adds the provided ChatCall to the AbstractCallRepository.
-
addChatMember(
ChatId chatId, UserId userId) → Future< void> -
Adds an User to a Chat-group by the authority of the authenticated
MyUser.
override
-
attachments(
DtoChatItem item) → Future< List< Attachment> > -
Fetches the Attachments of the provided
item
. -
avatar(
ChatId id) → Future< ChatAvatar?> - Fetches the ChatAvatars of the provided RxChat.
-
chatEvent(
ChatEventsVersionedMixin$Events e) → ChatEvent - Constructs a ChatEvent from the ChatEventsVersionedMixin$Events.
-
chatEvents(
ChatId chatId, ChatVersion? ver, FutureOr< ChatVersion?> onVer()) → Stream<ChatEvents> - Subscribes to ChatEvents of the specified Chat.
-
clear(
) → Future< void> -
Clears the stored chats.
override
-
clearChat(
ChatId id, [ChatItemId? untilId]) → Future< void> -
Clears an existing Chat (hides all its ChatItems) for the
authenticated MyUser until the specified ChatItem inclusively.
override
-
createChatDirectLink(
ChatId chatId, ChatDirectLinkSlug slug) → Future< void> -
Creates a new ChatDirectLink with the specified ChatDirectLinkSlug and
deletes the current active ChatDirectLink of the given Chat-group (if
any).
override
-
createGroupChat(
List< UserId> memberIds, {ChatName? name}) → Future<RxChatImpl> -
Creates a group Chat with the provided members and the authenticated
MyUser, optionally
name
d.override -
deleteChatDirectLink(
ChatId groupId) → Future< void> -
Deletes the current ChatDirectLink of the given Chat-group.
override
-
deleteChatForward(
ChatForward forward) → Future< void> -
Deletes the specified ChatForward posted by the authenticated MyUser.
override
-
deleteChatMessage(
ChatMessage message) → Future< void> -
Deletes the specified ChatMessage posted by the authenticated MyUser.
override
-
editChatMessage(
ChatMessage message, {ChatMessageTextInput? text, ChatMessageAttachmentsInput? attachments, ChatMessageRepliesInput? repliesTo}) → Future< void> -
Edits the specified ChatMessage posted by the authenticated MyUser.
override
-
endCall(
ChatId chatId) → void -
Ends an OngoingCall happening in the Chat identified by the provided
chatId
, if any. -
ensureRemoteDialog(
ChatId chatId) → Future< RxChatImpl?> - Ensures the provided Chat is remotely accessible.
-
ensureRemoteMonolog(
{ChatName? name, bool? isHidden}) → Future< RxChatImpl> - Ensures the provided Chat-monolog is remotely accessible.
-
favoriteChat(
ChatId id, ChatFavoritePosition? position) → Future< void> -
Marks the specified Chat as favorited for the authenticated MyUser and
sets its position in the favorites list.
override
-
forwardChatItems(
ChatId from, ChatId to, List< ChatItemQuoteInput> items, {ChatMessageText? text, List<AttachmentId> ? attachments}) → Future<void> -
Forwards ChatItems to the specified Chat by the authenticated
MyUser.
override
-
get(
ChatId id) → FutureOr< RxChatImpl?> -
Returns an RxChat by the provided
id
.override -
getUser(
UserId id) → FutureOr< RxUser?> -
Returns an User by the provided
id
. -
hideChat(
ChatId id) → Future< void> -
Marks the specified Chat as hidden for the authenticated MyUser.
override
-
hideChatItem(
ChatId chatId, ChatItemId id) → Future< void> -
Hides the specified ChatItem for the authenticated MyUser.
override
-
init(
{required Future< void> onMemberRemoved(ChatId, UserId)}) → Future<void> -
Initializes this repository.
override
-
keepTyping(
ChatId chatId) → Stream -
Notifies ChatMembers about the authenticated MyUser typing in the
specified Chat at the moment.
override
-
members(
ChatId id, {int? first, ChatMembersCursor? after, int? last, ChatMembersCursor? before}) → Future< Page< DtoChatMember, ChatMembersCursor> > -
Fetches ChatMembers of the Chat with the provided
id
ordered by their joining time with pagination. -
message(
ChatItemId id) → Future< DtoChatItem?> -
Fetches the DtoChatItem with the provided
id
. -
messages(
ChatId id, {int? first, ChatItemsCursor? after, int? last, ChatItemsCursor? before, bool onlyAttachments = false, ChatMessageText? withText}) → Future< Page< DtoChatItem, ChatItemsCursor> > -
Fetches ChatItems of the Chat with the provided
id
ordered by their posting time with pagination. -
next(
) → Future< void> -
Fetches the next paginated page.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onClose(
) → void -
Called before onDelete method. onClose might be used to
dispose resources used by the controller. Like closing events,
or streams before the controller is destroyed.
Or dispose objects that can potentially create some memory leaks,
like TextEditingControllers, AnimationControllers.
Might be useful as well to persist some data on disk.
override
-
onInit(
) → void -
Called immediately after the widget is allocated in memory.
You might use this to initialize something for the controller.
inherited
-
onReady(
) → void -
Called 1 frame after onInit(). It is the perfect place to enter
navigation events, like snackbar, dialogs, or a new route, or
async request.
inherited
-
postChatMessage(
ChatId chatId, {ChatMessageText? text, List< AttachmentId> ? attachments, List<ChatItemId> repliesTo = const []}) → Future<ChatEventsVersionedMixin?> - Posts a new ChatMessage to the specified Chat by the authenticated MyUser.
-
put(
DtoChat chat, {bool pagination = false, bool updateVersion = true, bool ignoreVersion = false}) → Future< RxChatImpl> -
Puts the provided
chat
to Pagination and local storage. -
readChat(
ChatId chatId, ChatItemId untilId) → Future< void> -
Marks the specified Chat as read for the authenticated MyUser until
the specified ChatItem inclusively.
override
-
readUntil(
ChatId chatId, ChatItemId untilId) → Future< void> - Marks the specified Chat as read until the provided ChatItemId for the authenticated MyUser.
-
remove(
ChatId id, {bool force = false}) → Future< void> -
Removes a Chat identified by the provided
id
from the chats.override -
removeChatMember(
ChatId chatId, UserId userId) → Future< void> -
Removes an User from a Chat-group by the authority of the
authenticated MyUser.
override
-
removeCredentials(
ChatId chatId, ChatItemId callId) → Future< void> -
Removes the ChatCallCredentials of an OngoingCall identified by the
provided
id
. -
renameChat(
ChatId id, ChatName? name) → Future< void> -
Renames the specified Chat by the authority of authenticated MyUser.
override
-
resendChatItem(
ChatItem item) → Future< void> -
Resends the specified
item
.override -
sendChatMessage(
ChatId chatId, {ChatMessageText? text, List< Attachment> ? attachments, List<ChatItem> repliesTo = const []}) → Future<void> -
Posts a new ChatMessage to the specified Chat by the authenticated
MyUser.
override
-
toggleChatMute(
ChatId id, MuteDuration? mute) → Future< void> -
Mutes or unmutes the specified Chat for the authenticated MyUser.
Overrides an existing mute even if it's longer.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
unfavoriteChat(
ChatId id) → Future< void> -
Removes the specified Chat from the favorites list of the authenticated
MyUser.
override
-
updateChatAvatar(
ChatId id, {NativeFile? file, CropAreaInput? crop, void onSendProgress(int count, int total)?}) → Future< void> -
Updates the Chat.avatar field with the provided image, or resets it to
null
, by authority of the authenticated MyUser.override -
uploadAttachment(
LocalAttachment attachment) → Future< Attachment> -
Creates a new Attachment linked to the authenticated MyUser for a
later use in the sendChatMessage method.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited