package de.beyondsoft.ownchat.utils;

import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/** Check if network is available.
 * <p>
 * Created by laszloffiferenc on 2/21/17.
 */
public class SystemUtils {

    private final ConnectivityManager mConnectivityManager;

    public SystemUtils(ConnectivityManager connectivityManager) {
        mConnectivityManager = connectivityManager;
    }

    public boolean isNetworkUnavailable() {
        NetworkInfo activeNetwork = mConnectivityManager.getActiveNetworkInfo();

        return activeNetwork == null || !activeNetwork.isConnectedOrConnecting();
    }
}