导航菜单

页面标题

页面副标题

Mint v5.7.3 - m3.java 源代码

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

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


package y7;

import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModel;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.SubscriptionPlanSingleton;
import com.htmedia.mint.htsubscription.SubscriptionTrigger;
import com.htmedia.mint.htsubscription.WebEngageAnalytices;
import com.htmedia.mint.htsubscription.planpagerewamp.ui.activities.PlanPageActivity;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.Metadata;
import com.htmedia.mint.pojo.NewsLetterAuthorData;
import com.htmedia.mint.pojo.NewsLetterItemNew;
import com.htmedia.mint.pojo.NewsLetterSubUnsubResponseModelNew;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.ui.activity.WebViewActivityWithHeader;
import com.htmedia.mint.utils.n;
import com.htmedia.sso.activities.LoginRegisterActivity;
import com.htmedia.sso.helpers.SSOSingleton;
import com.htmedia.sso.helpers.ToastHelper;
import com.htmedia.sso.helpers.WebEngageNewSSOEvents;
import com.htmedia.sso.network.ApiClient;
import com.htmedia.sso.network.ApiServices;
import com.htmedia.sso.network.CustomObserver;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import in.juspay.hyper.constants.LogCategory;
import java.util.ArrayList;
import t5.a;

public class m3 extends ViewModel {
    public ArrayList<NewsLetterItemNew> a;
    public ArrayList<NewsLetterAuthorData> b;
    public boolean c = false;
    public String d = BuildConfig.FLAVOR;

    class a extends CustomObserver<NewsLetterSubUnsubResponseModelNew> {
        final Context a;
        final boolean b;
        final NewsLetterItemNew c;

        a(Context context, boolean z, Context context2, boolean z2, NewsLetterItemNew newsLetterItemNew) {
            super(context, z);
            this.a = context2;
            this.b = z2;
            this.c = newsLetterItemNew;
        }

        @Override
        public void onNext(NewsLetterSubUnsubResponseModelNew newsLetterSubUnsubResponseModelNew) {
            super.onNext(newsLetterSubUnsubResponseModelNew);
            if (!newsLetterSubUnsubResponseModelNew.isSuccess()) {
                ToastHelper.showToast(this.a, newsLetterSubUnsubResponseModelNew.getMessage());
                return;
            }
            m3 m3Var = m3.this;
            if (m3Var.c) {
                m3Var.f(this.a, m3Var.d, this.b ? "subscribe" : "unsubscribe", this.c);
            } else {
                Context context = this.a;
                String str = com.htmedia.mint.utils.n.w0;
                String str2 = com.htmedia.mint.utils.n.p0;
                String[] strArr = new String[2];
                strArr[0] = this.b ? "Subscribe" : "Unsubscribe";
                strArr[1] = this.c.getName();
                com.htmedia.mint.utils.n.M(context, str, str2, null, BuildConfig.FLAVOR, strArr);
            }
            if (this.b) {
                ToastHelper.showToast(this.a, "Your newsletter preferences have been updated!");
                return;
            }
            ToastHelper.showToast(this.a, "You have unsubscribed from " + this.c.getName());
        }
    }

    private Content c(NewsLetterItemNew newsLetterItemNew) {
        Content content = new Content();
        content.setMobileHeadline(newsLetterItemNew.getName());
        Metadata metadata = new Metadata();
        metadata.setUrl(newsLetterItemNew.getUrl());
        metadata.setSection("News");
        content.setType("story_type");
        content.setMetadata(metadata);
        content.setId(Integer.parseInt(newsLetterItemNew.getNewsletter_id()));
        return content;
    }

    public void f(Context context, String str, String str2, NewsLetterItemNew newsLetterItemNew) {
        com.htmedia.mint.utils.h0.f(str);
        String str3 = "/mymint/" + str + "/newsletters";
        a.a aVar = t5.a.a;
        String str4 = com.htmedia.mint.utils.n.Z1;
        String[] strArr = new String[4];
        strArr[0] = "newsletters";
        strArr[1] = str2;
        strArr[2] = "my mint";
        strArr[3] = (newsLetterItemNew == null || TextUtils.isEmpty(newsLetterItemNew.getName())) ? BuildConfig.FLAVOR : newsLetterItemNew.getName();
        aVar.h(context, str4, str3, str3, (Object) null, strArr);
    }

    public void b(Context context, NewsLetterItemNew newsLetterItemNew) {
        if (this.c) {
            f(context, this.d, "see latest", newsLetterItemNew);
        } else {
            String str = com.htmedia.mint.utils.n.c2;
            String str2 = com.htmedia.mint.utils.n.p0;
            String[] strArr = new String[4];
            strArr[0] = "Newsletter";
            strArr[1] = "Read now";
            strArr[2] = newsLetterItemNew.getName();
            strArr[3] = newsLetterItemNew.getType().equalsIgnoreCase("FREE") ? "FREE" : "PREMIUM";
            com.htmedia.mint.utils.n.M(context, str, str2, null, BuildConfig.FLAVOR, strArr);
        }
        Intent intent = new Intent(context, (Class<?>) WebViewActivityWithHeader.class);
        intent.putExtra("url", com.htmedia.mint.utils.f0.v(newsLetterItemNew.getUrl(), context));
        intent.putExtra("Title", "NewsLetter");
        context.startActivity(intent);
        Tracker instance = Tracker.instance();
        Content c = c(newsLetterItemNew);
        String str3 = com.htmedia.mint.utils.q.c[6];
        com.htmedia.mint.utils.k1.w(instance, c, null, str3, str3, true, -1, null, BuildConfig.FLAVOR);
    }

    public void d(Context context, NewsLetterItemNew newsLetterItemNew, boolean z) {
        String unsubscribeNewsletter;
        ArrayList<NewsLetterItemNew> arrayList = this.a;
        if (arrayList == null || arrayList.isEmpty()) {
            ToastHelper.showToast(context, "No newsletter present at the moment, Please try again later!");
            return;
        }
        newsLetterItemNew.setIs_subscribed(z);
        JsonObject jsonObject = new JsonObject();
        String G1 = com.htmedia.mint.utils.f0.G1(context, "userName") != null ? com.htmedia.mint.utils.f0.G1(context, "userEmail") : BuildConfig.FLAVOR;
        JsonArray jsonArray = new JsonArray();
        jsonObject.addProperty("domain", "LM");
        jsonObject.addProperty("email", G1);
        jsonArray.add(newsLetterItemNew.getNewsletter_id());
        jsonObject.add("newsletter_ids", jsonArray);
        if (z) {
            jsonObject.addProperty(LogCategory.ACTION, "ADD");
            unsubscribeNewsletter = AppController.j().g().getNewsLetterNetcore().getSubscribeNewsletter();
        } else {
            jsonObject.addProperty(LogCategory.ACTION, "DELETE");
            unsubscribeNewsletter = AppController.j().g().getNewsLetterNetcore().getUnsubscribeNewsletter();
        }
        ((ApiServices) ApiClient.getClient().create(ApiServices.class)).setUserNewsLetterSubscriptionData(unsubscribeNewsletter, jsonObject).s(sg.a.b()).k(ag.a.a()).a(new a(context, true, context, z, newsLetterItemNew));
    }

    public void e(Context context, NewsLetterItemNew newsLetterItemNew) {
        if (this.c) {
            f(context, this.d, "mail", newsLetterItemNew);
        }
        ArrayList<NewsLetterAuthorData> arrayList = this.b;
        if (arrayList == null || arrayList.isEmpty()) {
            return;
        }
        for (int i = 0; i < this.b.size(); i++) {
            if (this.b.get(i).getName().equalsIgnoreCase(newsLetterItemNew.getName()) || this.b.get(i).getNewsletter_id().equalsIgnoreCase(newsLetterItemNew.getNewsletter_id())) {
                com.htmedia.mint.utils.f0.D2(context, !TextUtils.isEmpty(this.b.get(i).getAuthor_email()) ? this.b.get(i).getAuthor_email() : "[email protected]");
            }
        }
    }

    public String g(NewsLetterItemNew newsLetterItemNew) {
        ArrayList<NewsLetterAuthorData> arrayList = this.b;
        if (arrayList != null && !arrayList.isEmpty()) {
            for (int i = 0; i < this.b.size(); i++) {
                if (this.b.get(i).getName().equalsIgnoreCase(newsLetterItemNew.getName()) || this.b.get(i).getNewsletter_id().equalsIgnoreCase(newsLetterItemNew.getNewsletter_id())) {
                    if (!TextUtils.isEmpty(this.b.get(i).getAuthor())) {
                        return "By " + this.b.get(i).getAuthor();
                    }
                }
            }
        }
        return "By Team Mint";
    }

    public void h(Context context, NewsLetterItemNew newsLetterItemNew, boolean z) {
        if (com.htmedia.mint.utils.f0.G1(context, "userName") == null) {
            n.a aVar = n.a.HEADER;
            com.htmedia.mint.utils.n.g0(null, null, aVar.a(), aVar.a());
            WebEngageNewSSOEvents.trackSSOLinkClicked("Login", "Home Login");
            Intent intent = new Intent(context, (Class<?>) LoginRegisterActivity.class);
            intent.putExtra("origin", "Home Login");
            intent.putExtra("referer", "Home Login");
            intent.putExtra("newsLetter", "News Letter");
            intent.setFlags(603979776);
            AppCompatActivity appCompatActivity = (AppCompatActivity) context;
            appCompatActivity.overridePendingTransition(2130772024, 2130772025);
            appCompatActivity.startActivityForResult(intent, 102, ActivityOptions.makeCustomAnimation(context, 2130772024, 2130772030).toBundle());
            return;
        }
        if (newsLetterItemNew.getType().equalsIgnoreCase("FREE")) {
            d(context, newsLetterItemNew, z);
            return;
        }
        Config g = AppController.j().g();
        boolean z2 = true;
        boolean z3 = AppController.j().l() != null && AppController.j().l().isSubscriptionActive();
        if (g != null && (g.getSubscription() == null || !g.getSubscription().isSubscriptionEnable())) {
            z2 = false;
        }
        if (z3 || !z2) {
            d(context, newsLetterItemNew, z);
            return;
        }
        WebEngageAnalytices.trackClickEvents("Hamburger_Subscribe", (String) null, (String) null, (Content) null, "Explore", BuildConfig.FLAVOR, BuildConfig.FLAVOR);
        Bundle bundle = new Bundle();
        bundle.putString(com.htmedia.mint.utils.n.X, "explore_menu");
        com.htmedia.mint.utils.n.l0(context, com.htmedia.mint.utils.n.t1, bundle);
        Intent intent2 = new Intent(context, (Class<?>) PlanPageActivity.class);
        if (context != null && (context instanceof AppCompatActivity)) {
            intent2 = SubscriptionTrigger.openPlanPageIntent((AppCompatActivity) context, "Newsletter", false);
        }
        intent2.putExtra("urlkey", "https://accounts.hindustantimes.com/lm/userplan");
        intent2.putExtra("keybuttonName", "Subscribe_Explore");
        intent2.putExtra("funnelName", "Explore");
        SubscriptionPlanSingleton.getInstance().setContent((Content) null);
        SSOSingleton.getInstance().setPlanPageReason("explore");
        SSOSingleton.getInstance().setPaywallReson(BuildConfig.FLAVOR);
        ((AppCompatActivity) context).startActivityForResult(intent2, 1009);
    }
}