what-the-bank/sources/o/gHl.java

191 lines
7.0 KiB
Java

package o;
import android.text.TextUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import o.PRA;
import okhttp3.ResponseBody;
import org.simpleframework.xml.transform.InvalidFormatException;
import retrofit2.Response;
/* loaded from: classes3.dex */
public final class gHl implements HAC {
private final JoR b;
final File c;
private final PeS d;
@InterfaceC13391fZD
public gHl(JoR joR, PeS peS, File file) {
this.b = joR;
this.d = peS;
this.c = file;
}
@Override // o.HAC
public final void d(String str) {
this.d.e.edit().putString("com.scb.phone.pref.key.THEME_CHECKSUM_2", str).commit();
}
@Override // o.HAC
public final void b(String str) {
this.d.e.edit().putString("com.scb.phone.pref.key.THEME_PATH_2", str).commit();
}
@Override // o.HAC
public final boolean e() {
return this.d.e.getBoolean("com.scb.phone.pref.key.THEME_DEFAULT", false);
}
@Override // o.HAC
public final void c(boolean z) {
this.d.e.edit().putBoolean("com.scb.phone.pref.key.THEME_DEFAULT", z).commit();
}
@Override // o.HAC
public final String c() {
return this.d.e.getString("com.scb.phone.pref.key.THEME_PATH_2", "");
}
@Override // o.HAC
public final String c(String str) {
try {
return new File(this.d.e.getString("com.scb.phone.pref.key.THEME_PATH_2", ""), str).getAbsolutePath();
} catch (RuntimeException e) {
guQ.e(e, "getThemeSlipPath %s", str);
return null;
}
}
@Override // o.HAC
public final boolean e(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
return !this.d.e.getString("com.scb.phone.pref.key.THEME_CHECKSUM_2", "").equals(str);
}
@Override // o.HAC
public final boolean d() {
return !TextUtils.isEmpty(this.d.e.getString("com.scb.phone.pref.key.THEME_CHECKSUM_2", ""));
}
@Override // o.HAC
public final AbstractC13163fSk<String> a(String str) {
final String str2 = str.split("/")[r0.length - 1];
return this.b.a.downloadTheme(str).flatMap(new fSS(this, str2) { // from class: o.RTL
private gHl c;
private String d;
@Override // o.fSS
public final Object a(Object obj) {
final gHl ghl = this.c;
final String str3 = this.d;
final Response response = (Response) obj;
return AbstractC13163fSk.create(new InterfaceC13170fSr(ghl, str3, response) { // from class: o.aWr
private String b;
private gHl d;
private Response e;
@Override // o.InterfaceC13170fSr
public final void b(InterfaceC13168fSp interfaceC13168fSp) {
File file;
gHl ghl2 = this.d;
String str4 = this.b;
Response response2 = this.e;
try {
String substring = str4.substring(0, str4.indexOf(46));
File file2 = ghl2.c;
StringBuilder sb = new StringBuilder("themes/");
sb.append(substring);
file = new File(file2, sb.toString());
} catch (IOException e) {
e = e;
file = null;
}
try {
if (!file.exists()) {
guQ.c("%s created %s", file.getAbsolutePath(), Boolean.valueOf(file.mkdirs()));
}
File file3 = new File(file, str4);
file3.createNewFile();
InterfaceC15148gic c = C15160gio.c(C15160gio.e(file3));
c.c(((ResponseBody) response2.body()).source());
c.close();
Pzh.c(file3.getAbsolutePath());
try {
Files.delete(Paths.get(file3.getAbsolutePath(), new String[0]));
} catch (IOException e2) {
guQ.e(e2);
}
if (file.exists() && file.isDirectory()) {
YKU yku = new YKU(Arrays.asList(file.listFiles()));
List list = (List) new YKU(yku.a, new wxK(yku.b, new XWF())).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
for (BKa bKa : BKa.values()) {
if (list.contains(bKa.component)) {
}
}
interfaceC13168fSp.e(file.getAbsolutePath());
interfaceC13168fSp.c();
}
gHl.c(file);
interfaceC13168fSp.c(new InvalidFormatException("Some of the theme files do not match ThemesComponent", ""));
interfaceC13168fSp.c();
} catch (IOException e3) {
e = e3;
gHl.c(file);
interfaceC13168fSp.c(e);
}
}
{
this.d = ghl;
this.b = str3;
this.e = response;
}
});
}
{
this.c = this;
this.d = str2;
}
});
}
@Override // o.HAC
public final List<String> b() {
String string = this.d.e.getString("com.scb.phone.pref.key.THEME_PATH_2", "");
if (!TextUtils.isEmpty(string)) {
File file = new File(string);
if (file.exists() && file.isDirectory()) {
YKU yku = new YKU(Arrays.asList(file.listFiles()));
return (List) new YKU(yku.a, new wxK(yku.b, new XWF())).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
}
}
return Collections.emptyList();
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void c(File file) {
if (file.exists() && file.isDirectory()) {
for (File file2 : file.listFiles()) {
try {
Files.delete(Paths.get(file2.getAbsolutePath(), new String[0]));
} catch (IOException e) {
guQ.e(e);
}
}
try {
Files.delete(Paths.get(file.getAbsolutePath(), new String[0]));
} catch (IOException e2) {
guQ.e(e2);
}
}
}
}