download:React17+React Hook+TS4 最佳實踐 仿 Jira 企業級專案
React17 + React Hook + TypeScript4 已成為大型React 專案質量保證的代名詞,更是 2021年優秀 React 開發者必備的技術。本課程將通過完成一個功能強大的任務管理專案,帶領大家掌握最佳實踐,全方位提升開發效率、開發質量和技術能力。
**
技術要求
有 React 基礎
**
環境引數
React 17.0.1 / TypeScript 4.0.5 / react-router : 6.0.0 / create-react-app 4.0.1
react-query: 1.0.0 / emotion: 10.0.35 / cypress: 6.1.0 / jest: 26.6.3
package com.chengxinet.bobo.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
Created by Administrator on 2016/1/7.
/
public class NetworkUtils {
public static boolean isNetworkAvailable(Context c) {Context context = c.getApplicationContext(); // 獲取手機所有連線管理物件(包括對wi-fi,net等連線的管理) ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager == null) { return false; } else { // 獲取NetworkInfo物件 NetworkInfo[] networkInfo = connectivityManager.getAllNetworkInfo(); if (networkInfo != null && networkInfo.length > 0) { for (NetworkInfo aNetworkInfo : networkInfo) {
// System.out.println(i + “===狀態===” + networkInfo[i].getState());
// System.out.println(i + “===型別===” + networkInfo[i].getTypeName());// 判斷當前網路狀態是否為連線狀態 if (aNetworkInfo.getState() == NetworkInfo.State.CONNECTED) { return true; } } } } return false;
}
/**
判斷WIFI是否開啟
@param context
@return
/
public static boolean isWifiEnabled(Context context) {
ConnectivityManager mgrConn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
TelephonyManager mgrTel = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
return ((mgrConn.getActiveNetworkInfo() != null && mgrConn
.getActiveNetworkInfo().getState() == NetworkInfo.State.CONNECTED) || mgrTel .getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS);
}
/**
判斷是否是3G網路
@param context
@return
/
public static boolean is3rd(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkINfo = cm.getActiveNetworkInfo();
if (networkINfo != null&& networkINfo.getType() == ConnectivityManager.TYPE_MOBILE) { return true;
}
return false;
}/**
判斷是wifi還是3g網路
@param context
@return
/
public static boolean isWifi(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkINfo = cm.getActiveNetworkInfo();
if (networkINfo != null&& networkINfo.getType() == ConnectivityManager.TYPE_WIFI) { return true;
}
return false;
}
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結