柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 v.java 源代码,内容仅作参考
package com.qiniu.pili.droid.shortvideo.b;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.util.Base64;
import com.qiniu.pili.droid.shortvideo.PLAuthenticationResultCallback;
import com.qiniu.pili.droid.shortvideo.PLVideoSaveListener;
import com.qiniu.pili.droid.shortvideo.b.b;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONException;
public class v {
private static boolean d = true;
private Context a;
private b b = b.UnCheck;
private long c = 0;
private ArrayList<Integer> e = new ArrayList<>();
public static class a {
public static final v a = new v();
}
public enum b {
UnCheck,
Authorized,
UnAuthorized
}
public static v a() {
return a.a;
}
public void a(Context context) {
if (this.a != null || context == null) {
return;
}
Context applicationContext = context.getApplicationContext();
this.a = applicationContext;
SharedPreferences sharedPreferences = applicationContext.getSharedPreferences("ShortVideo", 0);
String string = sharedPreferences.getString("ts", "");
String string2 = sharedPreferences.getString("feature", "");
if (!"".equals(string)) {
this.c = Long.valueOf(new String(Base64.decode(string, 0))).longValue();
}
if (!"".equals(string2)) {
b(new String(Base64.decode(string2, 0)));
}
for (String str : c.a) {
if (a().b(context).contains(str)) {
a().a(false);
return;
}
}
}
public boolean b() {
if (!d) {
this.b = b.Authorized;
return true;
}
c();
return this.b != b.UnAuthorized;
}
public void a(PLAuthenticationResultCallback pLAuthenticationResultCallback) {
b(pLAuthenticationResultCallback);
}
private void c() {
long currentTimeMillis = System.currentTimeMillis() - this.c;
if (currentTimeMillis < 0 || currentTimeMillis >= 3600000) {
b((PLAuthenticationResultCallback) null);
}
}
private void b(final PLAuthenticationResultCallback pLAuthenticationResultCallback) {
if (this.a == null) {
return;
}
this.c = System.currentTimeMillis();
Context context = this.a;
if (context != null) {
SharedPreferences.Editor edit = context.getSharedPreferences("ShortVideo", 0).edit();
edit.putString("ts", Base64.encodeToString(String.valueOf(this.c).getBytes(), 0));
edit.apply();
}
new Thread(new Runnable() {
@Override
public void run() {
v.this.d(pLAuthenticationResultCallback);
}
}).start();
}
private void c(final PLAuthenticationResultCallback pLAuthenticationResultCallback) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (v.this.b != b.Authorized) {
if (v.this.b == b.UnAuthorized) {
pLAuthenticationResultCallback.onAuthorizationResult(0);
return;
} else {
pLAuthenticationResultCallback.onAuthorizationResult(-1);
return;
}
}
pLAuthenticationResultCallback.onAuthorizationResult(1);
}
});
}
public void d(PLAuthenticationResultCallback pLAuthenticationResultCallback) {
String b2 = b(this.a);
if ("".equals(b2)) {
return;
}
try {
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL("https://shortvideo.qiniuapi.com/v1/zeus?appid=" + b2).openConnection();
httpsURLConnection.setRequestMethod("GET");
int responseCode = httpsURLConnection.getResponseCode();
if (responseCode == 200) {
this.b = b.Authorized;
a(httpsURLConnection.getInputStream());
} else if (responseCode == 401) {
this.b = b.UnAuthorized;
} else {
this.b = b.UnCheck;
}
if (pLAuthenticationResultCallback != null) {
c(pLAuthenticationResultCallback);
}
} catch (IOException e) {
if (pLAuthenticationResultCallback != null) {
c(pLAuthenticationResultCallback);
}
e.printStackTrace();
}
}
private String a(InputStream inputStream) {
StringBuffer stringBuffer = new StringBuffer();
BufferedReader bufferedReader = null;
try {
try {
try {
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(inputStream));
while (true) {
try {
String readLine = bufferedReader2.readLine();
if (readLine == null) {
break;
}
stringBuffer.append(readLine);
} catch (Exception e) {
e = e;
bufferedReader = bufferedReader2;
e.printStackTrace();
if (bufferedReader != null) {
bufferedReader.close();
}
return stringBuffer.toString();
} catch (Throwable th) {
th = th;
bufferedReader = bufferedReader2;
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
throw th;
}
}
b(stringBuffer.toString());
a(stringBuffer.toString());
bufferedReader2.close();
} catch (Throwable th2) {
th = th2;
}
} catch (Exception e3) {
e = e3;
}
} catch (IOException e4) {
e4.printStackTrace();
}
return stringBuffer.toString();
}
private void a(String str) {
SharedPreferences.Editor edit = this.a.getSharedPreferences("ShortVideo", 0).edit();
edit.putString("feature", Base64.encodeToString(str.getBytes(), 0));
edit.apply();
}
private void b(String str) {
try {
JSONArray jSONArray = new JSONArray(str);
this.e.clear();
for (int i = 0; i < jSONArray.length(); i++) {
this.e.add(Integer.valueOf(jSONArray.getJSONObject(i).getInt("id")));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public boolean a(b.a aVar) {
boolean z = true;
if (!d) {
this.b = b.Authorized;
return true;
}
c();
if (this.b == b.UnAuthorized) {
z = false;
} else if (!this.e.isEmpty()) {
z = this.e.contains(Integer.valueOf(aVar.a()));
}
if (!z) {
com.qiniu.pili.droid.shortvideo.g.e.b.e("ZeusManager", "no authorized feature : " + aVar + " status : " + this.b);
}
return z;
}
public boolean a(b.a aVar, PLVideoSaveListener pLVideoSaveListener) {
boolean a2 = a(aVar);
if (!a2 && pLVideoSaveListener != null) {
pLVideoSaveListener.onSaveVideoFailed(8);
g.a(this.a).a(8);
}
return a2;
}
private String b(Context context) {
return context != null ? com.qiniu.pili.droid.shortvideo.g.j.g(context) : "";
}
private void a(boolean z) {
d = z;
}
}