Ejemplo n.º 1
0
def update_connection_state(controller: Controller, update: Dict[str,
                                                                 Any]) -> None:
    state = update["state"]["@type"]
    states = {
        "connectionStateWaitingForNetwork": "Waiting for network...",
        "connectionStateConnectingToProxy": "Connecting to proxy...",
        "connectionStateConnecting": "Connecting...",
        "connectionStateUpdating": "Updating...",
        # state exists, but when it's "Ready" we want to show "Chats"
        # "connectionStateReady": "Ready",
    }
    controller.model.chats.title = states.get(state, "Chats")
    controller.render_chats()
Ejemplo n.º 2
0
def update_user_status(controller: Controller, update: Dict[str, Any]):
    controller.model.users.set_status(update["user_id"], update["status"])
    controller.render_chats()