- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
191 lines
5.9 KiB
Java
191 lines
5.9 KiB
Java
package com.mbridge.msdk.foundation.controller;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.preference.PreferenceManager;
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.vungle.ads.internal.model.Cookie;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class e implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
private String a;
|
|
private int e;
|
|
private boolean g;
|
|
private boolean h;
|
|
private boolean i;
|
|
private boolean j;
|
|
private boolean k;
|
|
private a l;
|
|
private final SharedPreferences m;
|
|
private String b = "";
|
|
private String c = "";
|
|
private String d = "";
|
|
private boolean f = false;
|
|
|
|
public interface a {
|
|
void a();
|
|
}
|
|
|
|
public final String a() {
|
|
return this.a;
|
|
}
|
|
|
|
public final void a(a aVar) {
|
|
if (aVar != null) {
|
|
this.l = aVar;
|
|
}
|
|
}
|
|
|
|
public e(Context context) {
|
|
this.a = "";
|
|
this.e = 0;
|
|
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
|
|
this.m = defaultSharedPreferences;
|
|
if (defaultSharedPreferences != null) {
|
|
defaultSharedPreferences.registerOnSharedPreferenceChangeListener(this);
|
|
}
|
|
if (defaultSharedPreferences != null) {
|
|
this.a = defaultSharedPreferences.getString("IABTCF_TCString", "");
|
|
this.e = defaultSharedPreferences.getInt(Cookie.IABTCF_GDPR_APPLIES, 0);
|
|
a(defaultSharedPreferences.getString("IABTCF_PurposeConsents", ""));
|
|
b(defaultSharedPreferences.getString("IABTCF_VendorConsents", ""));
|
|
c(defaultSharedPreferences.getString("IABTCF_AddtlConsent", ""));
|
|
}
|
|
}
|
|
|
|
private void a(String str) {
|
|
this.g = a(str, 1);
|
|
this.h = a(str, 2);
|
|
this.b = str;
|
|
}
|
|
|
|
private void b(String str) {
|
|
this.i = a(str, 867);
|
|
this.c = str;
|
|
}
|
|
|
|
private void c(String str) {
|
|
this.d = str;
|
|
if (TextUtils.isEmpty(str)) {
|
|
this.j = true;
|
|
return;
|
|
}
|
|
if (MBridgeConstans.GOOGLE_ATP_ID == -1) {
|
|
this.k = false;
|
|
return;
|
|
}
|
|
this.k = true;
|
|
try {
|
|
String[] split = str.split("~");
|
|
if (split.length > 1) {
|
|
if (TextUtils.isEmpty(split[1])) {
|
|
this.j = false;
|
|
} else {
|
|
this.j = str.contains(String.valueOf(MBridgeConstans.GOOGLE_ATP_ID));
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
af.b("TCStringManager", th.getMessage());
|
|
}
|
|
}
|
|
|
|
public final boolean b() {
|
|
if (this.e == 0) {
|
|
this.f = true;
|
|
return true;
|
|
}
|
|
if (d(this.b) && d(this.c)) {
|
|
if (MBridgeConstans.VERIFY_ATP_CONSENT) {
|
|
this.f = (this.i || (this.k && this.j)) && this.g && this.h;
|
|
return this.f;
|
|
}
|
|
if (!this.i || !this.g || !this.h) {
|
|
r1 = false;
|
|
}
|
|
}
|
|
this.f = r1;
|
|
return this.f;
|
|
}
|
|
|
|
private boolean d(String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return false;
|
|
}
|
|
return str.matches("[01]+");
|
|
}
|
|
|
|
private boolean a(String str, int i) {
|
|
return d(str) && i <= str.length() && i >= 1 && '1' == str.charAt(i - 1);
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
@Override // android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
|
public final void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String str) {
|
|
char c;
|
|
try {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
switch (str.hashCode()) {
|
|
case -2004976699:
|
|
if (str.equals("IABTCF_PurposeConsents")) {
|
|
c = 2;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 83641339:
|
|
if (str.equals(Cookie.IABTCF_GDPR_APPLIES)) {
|
|
c = 1;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 1218895378:
|
|
if (str.equals("IABTCF_TCString")) {
|
|
c = 0;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 1342914771:
|
|
if (str.equals("IABTCF_AddtlConsent")) {
|
|
c = 4;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 1450203731:
|
|
if (str.equals("IABTCF_VendorConsents")) {
|
|
c = 3;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
default:
|
|
c = 65535;
|
|
break;
|
|
}
|
|
if (c == 0) {
|
|
this.a = sharedPreferences.getString("IABTCF_TCString", "");
|
|
} else if (c == 1) {
|
|
this.e = sharedPreferences.getInt(Cookie.IABTCF_GDPR_APPLIES, 0);
|
|
} else if (c == 2) {
|
|
a(sharedPreferences.getString("IABTCF_PurposeConsents", ""));
|
|
} else if (c == 3) {
|
|
b(sharedPreferences.getString("IABTCF_VendorConsents", ""));
|
|
} else if (c == 4) {
|
|
c(sharedPreferences.getString("IABTCF_AddtlConsent", ""));
|
|
}
|
|
a aVar = this.l;
|
|
if (aVar != null) {
|
|
aVar.a();
|
|
}
|
|
} catch (Throwable th) {
|
|
af.b("TCStringManager", th.getMessage());
|
|
}
|
|
}
|
|
}
|