RoomList

public final class RoomList : ObservableObject, OrangeChatLoggable

An object representing a list of rooms of a OrangeChatManager instance.

Instance is created in the OrangeChatManager instance and is accessible by using OrangeChatManager.roomList.

Stored Properties

  • The rooms where the user takes part. A room is displayed when the room last update date is greater than the display since date of the current user.

    Declaration

    Swift

    @Published
    public var rooms: [Room] { get set }

API

  • Search for a room between the authenticated and a guest user. A new room is created if it does not exist.

    Searches if an existing; room matches the one the user wants to create:

    • If it exists, the room is returned to the user.
    • If not, a new room is created and returned.

    Declaration

    Swift

    public func p2pRoom(with guestUser: User, showAnyway: Bool = false) -> OrangeChatPublisher<Room>

    Parameters

    guestUser

    The identifier of the user to be invited.

    showAnyway

    Flag to indicate

    Return Value

    A publisher with a Room value.

  • Delete a room from the current user based on a room ID.

    A user may want to not see anymore a message or a conversation. But the messages own to all participants of the conversation and the decision cannot be done by one person. When a user deletes a conversation, the application updates the displaySince parameter of the current user participant in the database. It also updates at the same time the participantDisplaySince parameter of the current participant of the current room. When the conversation need to be displayed, the application only request the messages after this timestamp.

    Declaration

    Swift

    public func deleteRoom(with roomId: OrangeChatKey) -> OrangeChatPublisher<Void>

    Parameters

    id

    The ID of the room to be deleted.

    Return Value

    A publisher with a Void value.

  • Retrieve the information of a user related to his phone number.

    Declaration

    Swift

    public func retrieveUserInformation(with msisdn: String) -> OrangeChatPublisher<User>

    Parameters

    msisdn

    The phone number of the researched user in the database.

    Return Value

    A publisher with a User value corresponding to the found user.