All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.socket.SocketState Maven / Gradle / Ivy

There is a newer version: 2.7.2
Show newest version
package it.auties.whatsapp.socket;

import it.auties.whatsapp.api.DisconnectReason;

public enum SocketState {
    WAITING,
    CONNECTED,
    DISCONNECTED,
    RECONNECTING,
    LOGGED_OUT,
    RESTORE;

    static SocketState of(DisconnectReason reason) {
        return switch (reason) {
            case DISCONNECTED -> DISCONNECTED;
            case RECONNECTING -> RECONNECTING;
            case LOGGED_OUT -> LOGGED_OUT;
            case RESTORE -> RESTORE;
        };
    }

    DisconnectReason toReason() {
        return switch (this) {
            case WAITING, CONNECTED, RECONNECTING -> DisconnectReason.RECONNECTING;
            case DISCONNECTED -> DisconnectReason.DISCONNECTED;
            case LOGGED_OUT -> DisconnectReason.LOGGED_OUT;
            case RESTORE -> DisconnectReason.RESTORE;
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy