|
|
|
|
@ -134,13 +134,14 @@ public class API { |
|
|
|
|
url = url.startsWith("https") ? url : "https://api.aliyundrive.com/" + url; |
|
|
|
|
String result = OkHttp.postJson(url, json, getHeaderSign()); |
|
|
|
|
Log.e("sign", result); |
|
|
|
|
if (retry && checkSign(result)) return sign(url, json, false); |
|
|
|
|
if (retry && checkAuth(result)) return sign(url, json, false); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean checkAuth(String result) { |
|
|
|
|
if (result.contains("AccessTokenInvalid")) return refreshAccessToken(); |
|
|
|
|
if (result.contains("ShareLinkTokenInvalid") || result.contains("InvalidParameterNotMatch")) return refreshShareToken(); |
|
|
|
|
if (result.contains("UserDeviceOffline") || result.contains("UserDeviceIllegality") || result.contains("DeviceSessionSignatureInvalid")) return refreshSignature(); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -149,11 +150,6 @@ public class API { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean checkSign(String result) { |
|
|
|
|
if (result.contains("UserDeviceOffline") || result.contains("UserDeviceIllegality") || result.contains("DeviceSessionSignatureInvalid")) return refreshSignature(); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void checkAccessToken() { |
|
|
|
|
if (auth.getAccessToken().isEmpty()) refreshAccessToken(); |
|
|
|
|
} |
|
|
|
|
|