|
@@ -151,18 +151,23 @@ object CommonUtils {
|
|
|
tuyaHttp: TuyaHttp<T>
|
|
|
) {
|
|
|
appGlobalScope.launch(Dispatchers.IO) {
|
|
|
- if (TuyaUtils.ioTSDKManager==null || !TuyaUtils.init){
|
|
|
- ToastUtils.showShort(globalApp().getString(R.string.connect_tuya))
|
|
|
- tuyaHttp.fail()
|
|
|
- return@launch
|
|
|
- }
|
|
|
-
|
|
|
- Log.e("TAG TUYA","url :"+url +" json:"+json)
|
|
|
- var httpResponse = TuyaUtils.ioTSDKManager.httpRequest(url, apiVersion, json)
|
|
|
- var str = ""
|
|
|
- if (httpResponse.errorCode == 0) {
|
|
|
- str = httpResponse.result
|
|
|
- }else{
|
|
|
+// if (!TuyaUtilsSo.getInstance().tuyaInitSuccess || !TuyaUtilsSo.getInstance().tuyaNetwork){
|
|
|
+// ToastUtils.showShort(globalApp().getString(R.string.connect_tuya))
|
|
|
+// tuyaHttp.fail()
|
|
|
+// return@launch
|
|
|
+// }
|
|
|
+
|
|
|
+ Log.e("tuya","url :"+url +" json:"+json)
|
|
|
+// var httpResponse = TuyaUtils.ioTSDKManager.httpRequest(url, apiVersion, json)
|
|
|
+// var str = ""
|
|
|
+// if (httpResponse.errorCode == 0) {
|
|
|
+// str = httpResponse.result
|
|
|
+// }else{
|
|
|
+// tuyaHttp.fail()
|
|
|
+// }
|
|
|
+
|
|
|
+ var str = TuyaUtilsSo.getInstance().getPointer(url, apiVersion, json)
|
|
|
+ if ("" == str || str ==null){
|
|
|
tuyaHttp.fail()
|
|
|
}
|
|
|
withContext(Dispatchers.Main){
|
|
@@ -180,16 +185,18 @@ object CommonUtils {
|
|
|
tuyaHttp: TuyaBooleanHttp
|
|
|
) {
|
|
|
appGlobalScope.launch(Dispatchers.IO) {
|
|
|
- if (TuyaUtils.ioTSDKManager==null || !TuyaUtils.init){
|
|
|
+ if (!TuyaUtilsSo.getInstance().tuyaInitSuccess || !TuyaUtilsSo.getInstance().tuyaNetwork){
|
|
|
ToastUtils.showShort(globalApp().getString(R.string.connect_tuya))
|
|
|
tuyaHttp.fail()
|
|
|
return@launch
|
|
|
}
|
|
|
- var httpResponse = TuyaUtils.ioTSDKManager.httpRequest(url, apiVersion, json)
|
|
|
var str = false
|
|
|
- if (httpResponse.errorCode == 0) {
|
|
|
- str = true
|
|
|
- }
|
|
|
+
|
|
|
+ var json = TuyaUtilsSo.getInstance().getPointer(url, apiVersion, json)
|
|
|
+ str = !("" == json || json ==null)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
withContext(Dispatchers.Main){
|
|
|
tuyaHttp.bean(str)
|
|
|
|
|
@@ -208,16 +215,16 @@ object CommonUtils {
|
|
|
tuyaHttpList: TuyaHttpList<T>
|
|
|
) {
|
|
|
appGlobalScope.launch(Dispatchers.IO) {
|
|
|
- if (TuyaUtils.ioTSDKManager==null || !TuyaUtils.init){
|
|
|
- ToastUtils.showShort(globalApp().getString(R.string.connect_tuya))
|
|
|
- tuyaHttpList.fail()
|
|
|
- return@launch
|
|
|
- }
|
|
|
- var httpResponse = TuyaUtils.ioTSDKManager.httpRequest(url, apiVersion, json)
|
|
|
- var str = ""
|
|
|
- if (httpResponse.errorCode == 0) {
|
|
|
- str = httpResponse.result
|
|
|
- }else{
|
|
|
+// if (!TuyaUtilsSo.getInstance().tuyaInitSuccess || !TuyaUtilsSo.getInstance().tuyaNetwork ){
|
|
|
+// ToastUtils.showShort(globalApp().getString(R.string.connect_tuya))
|
|
|
+// tuyaHttpList.fail()
|
|
|
+// return@launch
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ Log.e("tuya","url :"+url +" json:"+json)
|
|
|
+ var str = TuyaUtilsSo.getInstance().getPointer(url, apiVersion, json)
|
|
|
+ if ("" == str || str ==null){
|
|
|
tuyaHttpList.fail()
|
|
|
}
|
|
|
withContext(Dispatchers.Main) {
|