导航菜单

页面标题

页面副标题

Mint v5.7.3 - k1.java 源代码

正在查看: Mint v5.7.3 应用的 k1.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.htmedia.mint.utils;

import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.Metadata;
import com.htmedia.mint.pojo.PinnedArticlePojo;
import com.htmedia.mint.pojo.config.Section;
import com.htmedia.sso.models.GenericEventRequest;
import com.htmedia.sso.network.ApiClient;
import com.htmedia.sso.network.CustomObserver;
import com.htmedia.sso.network.SnowPlowApiService;
import com.snowplowanalytics.snowplow.tracker.BuildConfig;
import com.snowplowanalytics.snowplow.tracker.DevicePlatforms;
import com.snowplowanalytics.snowplow.tracker.Emitter;
import com.snowplowanalytics.snowplow.tracker.Subject;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.snowplowanalytics.snowplow.tracker.constants.Parameters;
import com.snowplowanalytics.snowplow.tracker.events.PageView;
import com.snowplowanalytics.snowplow.tracker.events.ScreenView;
import com.snowplowanalytics.snowplow.tracker.events.SelfDescribing;
import com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson;
import com.snowplowanalytics.snowplow.tracker.utils.LogLevel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.json.JSONObject;

public class k1 {

    class a implements Runnable {
        final Context a;
        final GenericEventRequest b;

        class C0037a extends CustomObserver<String> {
            C0037a(Context context, boolean z) {
                super(context, z);
            }

            @Override
            public void onNext(String str) {
                super.onNext(str);
            }

            @Override
            public void onComplete() {
                super.onComplete();
            }

            @Override
            public void onError(Throwable th) {
                super.onError(th);
            }

            @Override
            public void onSubscribe(bg.b bVar) {
                super.onSubscribe(bVar);
            }
        }

        a(Context context, GenericEventRequest genericEventRequest) {
            this.a = context;
            this.b = genericEventRequest;
        }

        @Override
        public void run() {
            try {
                AdvertisingIdClient.Info advertisingIdInfo = AdvertisingIdClient.getAdvertisingIdInfo(this.a);
                String id2 = advertisingIdInfo != null ? advertisingIdInfo.getId() : null;
                this.b.setGaid(id2);
                ((SnowPlowApiService) ApiClient.getClientForSnowPlow().create(SnowPlowApiService.class)).genericEvent(this.b, "_ht_fp=" + f6.d.b(this.a)).s(sg.a.b()).k(ag.a.a()).a(new C0037a(this.a, false));
                Log.i("UIDMY", id2);
            } catch (Exception unused) {
            }
        }
    }

    class b implements k6.u0 {
        b() {
        }

        @Override
        public void getResponse(JSONObject jSONObject, String str) {
        }

        @Override
        public void onError(String str) {
        }
    }

    public static boolean a(List<PinnedArticlePojo> list, Content content) {
        if (list != null && list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i).getArticle().getId().equalsIgnoreCase(String.valueOf(content.getId()))) {
                    return true;
                }
            }
        }
        return false;
    }

    private static SelfDescribingJson b(Content content, Section section, String str, String str2, boolean z, int i, List<PinnedArticlePojo> list, String str3) {
        boolean z2 = !TextUtils.isEmpty(str3) && str3.equalsIgnoreCase("yes");
        boolean a2 = a(list, content);
        HashMap hashMap = new HashMap();
        hashMap.put("cardType", str);
        hashMap.put("template", str2);
        hashMap.put("storyId", String.valueOf(content.getId()));
        if (content.getType() == null || !content.getType().equalsIgnoreCase(j5.b.f0.a())) {
            hashMap.put("storyType", content.getType());
        } else {
            hashMap.put("storyType", content.getSubType());
        }
        hashMap.put("headline", content.getHeadline());
        if (content.getMetadata() != null && content.getMetadata().getUrl() != null) {
            hashMap.put("urlPath", content.getMetadata().getUrl());
        }
        hashMap.put("lastUpdated", content.getLastPublishedDate());
        if (str2.equals(j5.b.H.a())) {
            if (content.getMetadata() == null || TextUtils.isEmpty(content.getMetadata().getSection())) {
                hashMap.put("section", "Collection Name Empty");
            } else {
                hashMap.put("section", content.getMetadata().getSection().trim());
            }
        }
        hashMap.put("position", "Vertical");
        hashMap.put("orderNumber", Integer.valueOf(i));
        if (z) {
            hashMap.put("pseudoPageView", Boolean.FALSE);
        } else {
            hashMap.put("pseudoPageView", Boolean.TRUE);
        }
        hashMap.put("appVersion", "5.7.3");
        if (section == null || section.getDisplayName() == null) {
            hashMap.put("screenName", "~");
        } else {
            hashMap.put("screenName", f0.k1(section.getDisplayName(), section.getParentSectionName()));
        }
        hashMap.put("isPf", Boolean.valueOf(z2));
        hashMap.put("isFeatured", Boolean.valueOf(a2));
        o1.a("SnowPlow Analytics", "IsPersonalize : " + z2);
        o1.a("SnowPlow Analytics", "IsPinned : " + a2);
        return new SelfDescribingJson("iglu:com.htdigital.streams/page_detail/jsonschema/1-0-0", hashMap);
    }

    private static SelfDescribingJson c(Content content) {
        HashMap hashMap = new HashMap();
        Metadata metadata = content != null ? content.getMetadata() : null;
        if (metadata != null) {
            hashMap.put("topics", n.h(",", metadata.getTopic()));
        }
        return new SelfDescribingJson("iglu:com.snowplowanalytics.iglu/anything-a/jsonschema/1-0-0", hashMap);
    }

    public static void d(Context context, String str, JSONObject jSONObject, String str2) {
        try {
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("eventName", str);
            jSONObject2.put("eventType", str2);
            jSONObject2.put("appId", "lm");
            jSONObject2.put("eventDetail", jSONObject);
            jSONObject2.put("vTracker", BuildConfig.TRACKER_LABEL);
            jSONObject2.put("appVersion", "5.7.3");
            jSONObject2.put("id", f6.d.b(context));
            jSONObject2.put(Parameters.SESSION_USER_ID, f0.G1(context, "userName") != null ? f0.G1(context, "userClient") : f6.d.b(context));
            jSONObject2.put("webPageId", UUID.randomUUID().toString());
            jSONObject2.put("trackerUID", "dfbhjksefge3rskdn");
            jSONObject2.put("deviceTstamp", com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR + System.currentTimeMillis() + com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR);
            new k6.x0(context, new b()).a(5, "SnowPlow", "https://dap.hindustantimes.com/ge", jSONObject2, f(context), false, false);
        } catch (Exception unused) {
        }
    }

    public static void e(GenericEventRequest genericEventRequest, Context context) {
        AsyncTask.execute(new a(context, genericEventRequest));
    }

    private static HashMap<String, String> f(Context context) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("Cookie", "_ht_fp=" + f6.d.b(context));
        return hashMap;
    }

    public static String g(Context context) {
        if (!(context instanceof Activity)) {
            return "0";
        }
        DisplayMetrics displayMetrics = new DisplayMetrics();
        ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        return com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR + displayMetrics.heightPixels;
    }

    public static int h(Context context) {
        return i(context).heightPixels;
    }

    public static DisplayMetrics i(Context context) {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
        return displayMetrics;
    }

    public static int j(Context context) {
        return i(context).widthPixels;
    }

    public static void k(Context context, int i, Content content, String str, boolean z) {
    }

    public static Tracker l(Context context) {
        Tracker instance = Tracker.instance();
        instance.setPlatform(DevicePlatforms.Mobile);
        Subject build = new Subject.SubjectBuilder().build();
        build.setDomainUserId(f6.d.b(context));
        build.setNetworkUserId(f6.d.b(context));
        if (f0.G1(context, "userName") != null) {
            build.setUserId(f0.G1(context, "userClient"));
        }
        instance.setSubject(build);
        return instance;
    }

    public static SelfDescribingJson m(String str) {
        HashMap hashMap = new HashMap();
        hashMap.put("id", str);
        return new SelfDescribingJson("iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0", hashMap);
    }

    public static String n(Context context) {
        if (!(context instanceof Activity)) {
            return "0";
        }
        DisplayMetrics displayMetrics = new DisplayMetrics();
        ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        return com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR + displayMetrics.widthPixels;
    }

    public static void o(Context context) {
        Tracker.close();
        Emitter build = new Emitter.EmitterBuilder("dap.hindustantimes.com", context).build();
        Subject build2 = new Subject.SubjectBuilder().context(context).build();
        build2.setNetworkUserId(f6.d.b(context));
        build2.setDomainUserId(f6.d.b(context));
        build2.setLanguage("en");
        build2.setScreenResolution(j(context), h(context));
        Tracker.TrackerBuilder threadCount = new Tracker.TrackerBuilder(build, "AndroidTracker", "lm", context).level(LogLevel.VERBOSE).platform(DevicePlatforms.Mobile).subject(build2).threadCount(20);
        Boolean bool = Boolean.TRUE;
        Tracker.init(threadCount.mobileContext(bool).sessionContext(true).applicationCrash(bool).screenContext(bool).build());
        Log.i("emitter ", com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR + build.toString());
    }

    public static void p(Context context, String str, String str2, Activity activity) {
        int o1 = f0.o1(f6.l.j(context, "app_open_time"), System.currentTimeMillis());
        HashMap hashMap = new HashMap();
        try {
            hashMap.put("appVersion", f6.d.d(context));
            hashMap.put("closeAction", str);
            hashMap.put("screenName", f0.k1(str2, null));
            hashMap.put("timeSpent", Integer.valueOf(o1));
            hashMap.put("screen_height", g(context));
            hashMap.put("screen_width", n(context));
        } catch (Exception unused) {
        }
        z(l(context), null, hashMap, "iglu:com.htdigital.streams/app_close/jsonschema/2-0-0");
        o1.a("SnowPlow Analytics", "App Close Event Fired");
    }

    public static void q(Context context, String str) {
        f6.l.m(context, "app_open_time", Long.valueOf(System.currentTimeMillis()));
        HashMap hashMap = new HashMap();
        try {
            hashMap.put("appVersion", f6.d.d(context));
            hashMap.put("launchAction", str);
            hashMap.put("screen_height", g(context));
            hashMap.put("screen_width", n(context));
        } catch (Exception e) {
            o0.f(e);
        }
        z(l(context), null, hashMap, "iglu:com.htdigital.streams/app_launch/jsonschema/1-0-0");
        o1.a("SnowPlow Analytics", "App Open Event Fired");
    }

    public static void r(Context context) {
    }

    public static void s(Context context, String str, JSONObject jSONObject, String str2) {
        d(context, str, jSONObject, str2);
    }

    public static void t(Tracker tracker, Content content, Section section, String str, String str2, boolean z, int i, List<PinnedArticlePojo> list, String str3) {
        SelfDescribingJson b2 = b(content, section, str, str2, z, i, list, str3);
        SelfDescribingJson m = m(content != null ? content.getWebPageId() : com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR);
        ArrayList arrayList = new ArrayList();
        arrayList.add(b2);
        arrayList.add(m);
        z(tracker, arrayList, new HashMap(), "iglu:com.htdigital.streams/card_view/jsonschema/1-0-0");
    }

    public static void u(Context context, String str, String str2, String str3) {
        HashMap hashMap = new HashMap();
        hashMap.put("name", str2);
        hashMap.put("uuid", str3);
        hashMap.put("adCode", str);
        hashMap.put("time", System.currentTimeMillis() + com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR);
        hashMap.put("screen_height", g(context));
        hashMap.put("screen_width", n(context));
        try {
            z(l(context), null, hashMap, "iglu:com.htdigital.streams/ads_event/jsonschema/1-0-0");
        } catch (Exception e) {
            o0.f(e);
        }
    }

    public static void v(Tracker tracker, Content content, Section section, String str, String str2, boolean z, int i, List<PinnedArticlePojo> list, String str3) {
        SelfDescribingJson b2 = b(content, section, str, str2, z, i, list, str3);
        SelfDescribingJson m = m(content != null ? content.getWebPageId() : com.thoughtbot.expandablerecyclerview.BuildConfig.FLAVOR);
        SelfDescribingJson c = c(content);
        ArrayList arrayList = new ArrayList();
        arrayList.add(b2);
        arrayList.add(m);
        arrayList.add(c);
        try {
            if (content.getMetadata() == null || TextUtils.isEmpty(content.getMetadata().getUrl())) {
                tracker.track(((PageView.Builder) ((PageView.Builder) ((PageView.Builder) PageView.builder().pageUrl("https://www.livemint.com").pageTitle(content.getHeadline()).referrer("Android").eventId(UUID.randomUUID().toString())).deviceCreatedTimestamp(System.currentTimeMillis())).customContext(arrayList)).build());
            } else {
                tracker.track(((PageView.Builder) ((PageView.Builder) ((PageView.Builder) PageView.builder().pageUrl(content.getMetadata().getUrl()).pageTitle(content.getHeadline()).referrer("Android").eventId(UUID.randomUUID().toString())).deviceCreatedTimestamp(System.currentTimeMillis())).customContext(arrayList)).build());
            }
        } catch (Exception e) {
            o1.a("SDK ERROR", e.toString());
        }
    }

    public static void w(Tracker tracker, Content content, Section section, String str, String str2, boolean z, int i, List<PinnedArticlePojo> list, String str3) {
        if (z) {
            v(tracker, content, section, str, str2, z, i, list, str3);
        } else {
            t(tracker, content, section, str, str2, z, i, list, str3);
        }
    }

    public static void x(Tracker tracker, String str) {
        if (tracker != null) {
            tracker.track(ScreenView.builder().id(null).name(str).build());
        }
    }

    public static void y(Tracker tracker, String str, String str2) {
        if (tracker != null) {
            tracker.track(ScreenView.builder().id(null).name(str2).build());
        }
    }

    public static void z(Tracker tracker, List<SelfDescribingJson> list, HashMap<String, Object> hashMap, String str) {
        SelfDescribingJson selfDescribingJson = new SelfDescribingJson(str, hashMap);
        try {
            if (list != null) {
                tracker.track(((SelfDescribing.Builder) ((SelfDescribing.Builder) SelfDescribing.builder().deviceCreatedTimestamp(System.currentTimeMillis())).eventData(selfDescribingJson).customContext(list)).build());
            } else {
                tracker.track(((SelfDescribing.Builder) SelfDescribing.builder().deviceCreatedTimestamp(System.currentTimeMillis())).eventData(selfDescribingJson).build());
            }
        } catch (Exception e) {
            o0.f(e);
            o1.a("SDK ERROR", e.toString());
        }
    }
}