Luno v7.28.0版本的 MD5 值为:08d81b3b88ef7df48c89cb5d56dc11a2

以下内容为反编译后的 lb.java 源代码,内容仅作参考


package mdi.sdk;

import android.util.Base64;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import kotlin.jvm.internal.DefaultConstructorMarker;
import mdi.sdk.mt4;

public final class lb implements kb {
    private final mt4 a;
    private String b;
    private String c;
    private String d;
    private String e;
    private boolean f;

    public static final class a {
        private a() {
        }

        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    static {
        new a(null);
    }

    public lb(uf0 uf0Var, Cdo cdo, mt4 mt4Var) {
        w32.h(uf0Var, "deviceUtil");
        w32.h(cdo, "buildConfigProvider");
        w32.h(mt4Var, "settings");
        this.a = mt4Var;
        this.b = "";
        this.c = "";
        this.d = "";
        this.e = "";
        this.f = true;
        String e = mt4.a.e(mt4Var, "api_endpoint", null, 2, null);
        if (cdo.a().length() > 0) {
            e = cdo.a();
        } else {
            if (!(e.length() > 0)) {
                e = cdo.b() ? "https://mobileapi.staging.luno.com/api/" : "https://mobileapi.luno.com/api/";
            }
        }
        this.b = e;
        av2.b("ApiModel", w32.q("Startup base url: ", e), new Object[0]);
        av2.b("ApiModel", "Setting new app API key: bitx_android", new Object[0]);
        this.c = i("bitx_android", "B05_WU1f4HPIL_BSfSecCuSG4Vv0vhqFs9fmtxuJ8nY");
        a(mt4.a.e(mt4Var, "api_key", null, 2, null), mt4.a.e(mt4Var, "api_secret", null, 2, null));
        e(mt4.a.e(mt4Var, "hmac_secret", null, 2, null));
        uf0Var.b();
    }

    private final String i(String str, String str2) {
        boolean z;
        if (str != null) {
            try {
                if (str.length() != 0) {
                    z = false;
                    if (!z) {
                        return "";
                    }
                    if (str2 == null || str2.length() == 0) {
                        return "";
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.append((Object) str);
                    sb.append(':');
                    sb.append((Object) str2);
                    String sb2 = sb.toString();
                    Charset forName = Charset.forName("UTF-8");
                    w32.g(forName, "forName(charsetName)");
                    byte[] bytes = sb2.getBytes(forName);
                    w32.g(bytes, "this as java.lang.String).getBytes(charset)");
                    return w32.q("Basic ", Base64.encodeToString(bytes, 2));
                }
            } catch (UnsupportedEncodingException e) {
                b60.c(e);
                return "";
            }
        }
        z = true;
        if (!z) {
        }
    }

    @Override
    public synchronized void a(String str, String str2) {
        av2.b("ApiModel", w32.q("Setting new API key: ", str), new Object[0]);
        this.d = i(str, str2);
    }

    @Override
    public String b() {
        return this.b;
    }

    @Override
    public String c() {
        return this.d.length() > 0 ? this.d : this.c;
    }

    @Override
    public void d(String str) {
        av2.b("ApiModel", w32.q("Changing base url: ", str), new Object[0]);
        if (this.f) {
            this.a.f("api_endpoint", str);
        }
    }

    @Override
    public synchronized void e(String str) {
        boolean z;
        if (str != null) {
            try {
                if (str.length() != 0) {
                    z = false;
                    if (!z) {
                        str = "";
                    }
                    this.e = str;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        z = true;
        if (!z) {
        }
        this.e = str;
    }

    @Override
    public void f() {
        a("", "");
        e("");
    }

    @Override
    public boolean g() {
        return w32.d(this.b, "https://mobileapi.luno.com/api/");
    }

    @Override
    public String h() {
        return this.e;
    }
}