导航菜单

页面标题

页面副标题

Mint v5.7.3 - ManageSubscriptionForWebIos.java 源代码

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

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


package com.htmedia.mint.ui.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.text.Spannable;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.DataBindingUtil;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.WebEngageAnalytices;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.subscription.SubscriptionSource;
import com.htmedia.sso.activities.LoginRegisterActivity;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import in.juspay.merchants.R;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;

public class ManageSubscriptionForWebIos extends com.htmedia.mint.ui.activity.a implements f7.c {
    x4.k1 a;

    class a implements View.OnClickListener {
        a() {
        }

        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.putExtra("isFromBack", true);
            ManageSubscriptionForWebIos.this.setResult(-1, intent);
            ManageSubscriptionForWebIos.this.finish();
        }
    }

    class b implements View.OnClickListener {
        b() {
        }

        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.putExtra("isFromBack", true);
            ManageSubscriptionForWebIos.this.setResult(-1, intent);
            ManageSubscriptionForWebIos.this.finish();
        }
    }

    class c extends com.htmedia.mint.utils.a3 {
        c() {
        }

        @Override
        public void onLinkClick(String str) {
            ?? r2 = ManageSubscriptionForWebIos.this;
            r2.K(true, r2);
        }
    }

    class d extends TimerTask {
        final Context a;

        d(Context context) {
            this.a = context;
        }

        @Override
        public void run() {
            com.htmedia.mint.utils.j1.x0(1, this.a);
        }
    }

    class e implements DialogInterface.OnClickListener {
        final Activity a;

        e(Activity activity) {
            this.a = activity;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            Intent intent = new Intent(this.a, (Class<?>) LoginRegisterActivity.class);
            WebEngageAnalytices.trackClickEvents("Sign In", (String) null, "Sign In Initiate", (Content) null, "MS Token Expire", BuildConfig.FLAVOR, BuildConfig.FLAVOR);
            intent.putExtra("origin", "MS Token Expire");
            this.a.startActivityForResult(intent, 102);
        }
    }

    class f implements DialogInterface.OnClickListener {
        f() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            ManageSubscriptionForWebIos.this.finish();
        }
    }

    private void J() {
        Config g = AppController.j().g();
        String str = null;
        if (g != null && g.getSubscription() != null) {
            str = g.getSubscription().getManageWebSubscriptionRedirect();
        }
        if (TextUtils.isEmpty(str)) {
            return;
        }
        String G1 = com.htmedia.mint.utils.f0.G1(this, "userToken");
        if (!TextUtils.isEmpty(G1)) {
            str = str + G1;
        }
        L(str, this);
    }

    public void K(boolean z, Context context) {
        Config g = AppController.j().g();
        String str = BuildConfig.FLAVOR;
        String ssoBaseUrl = (g == null || g.getSso() == null) ? BuildConfig.FLAVOR : g.getSso().getSsoBaseUrl();
        if (g != null && g.getSso() != null) {
            str = g.getSso().getAuthenticateToken();
        }
        String str2 = ssoBaseUrl + str;
        if (TextUtils.isEmpty(str2)) {
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("Authorization", com.htmedia.mint.utils.f0.G1(context, "userToken"));
        new f7.b(context, this).b(0, "authenticateTokenTag", str2, hashMap, false, z);
    }

    private void L(String str, Context context) {
        com.htmedia.mint.utils.j1.x0(2, context);
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str.trim()));
        if (intent.resolveActivity(getPackageManager()) != null) {
            try {
                com.htmedia.mint.utils.j1.x0(2, context);
                startActivity(intent);
                new Timer().schedule(new d(context), 100L);
            } catch (ActivityNotFoundException unused) {
            }
        }
    }

    private void M(TextView textView) {
        textView.setMovementMethod(new c());
    }

    private void N(Activity activity, String str) {
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setMessage(str);
        builder.setPositiveButton(2131952166, new e(activity));
        builder.setNegativeButton(2131952550, new f());
        builder.setCancelable(false);
        AlertDialog create = builder.create();
        if (activity == null || activity.isFinishing()) {
            return;
        }
        create.show();
    }

    @Override
    public void isValidToken(String str, boolean z) {
        if (z) {
            J();
        } else {
            WebEngageAnalytices.trackAccessTokenExpire(this, (String) null, "Manage Subscription for Web");
            N(this, "Your session has expired. Please login again to continue.");
        }
    }

    protected void onActivityResult(int i, int i2, @Nullable Intent intent) {
        if (i == 102 && i2 == -1) {
            HashMap hashMap = new HashMap();
            String F1 = com.htmedia.mint.utils.f0.F1(this);
            if (F1 != null) {
                hashMap.put("userEmail", F1);
            }
            if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
                hashMap.put("userName", com.htmedia.mint.utils.f0.G1(this, "userName"));
            }
            if (!hashMap.isEmpty()) {
                com.htmedia.mint.utils.o0.i(hashMap);
            }
            if (!TextUtils.isEmpty(com.htmedia.mint.utils.f0.G1(this, "userToken"))) {
                setResult(-1);
            }
            finish();
        }
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
    }

    public void onConfigurationChanged(@NonNull Configuration configuration) {
        super.onConfigurationChanged(configuration);
        AppController.e(getIntent(), this);
    }

    protected void onCreate(Bundle bundle) {
        int i;
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        this.a = DataBindingUtil.setContentView(this, 2131624001);
        Bundle extras = getIntent().getExtras();
        if (extras != null && extras.containsKey("server") && (i = extras.getInt("server", 3)) < SubscriptionSource.values().length) {
            SubscriptionSource subscriptionSource = SubscriptionSource.values()[i];
            if (subscriptionSource == SubscriptionSource.app) {
                this.a.f.setText("Looking to manage your plan?");
                Spannable.Factory.getInstance().newSpannable(Html.fromHtml("Please visit <a href =\"https://www.livemint.com\">livemint.com</a> on the web to manage your subscription plan."));
                this.a.h.setText(Html.fromHtml("Please visit <a href =\"https://www.livemint.com\">livemint.com</a> on the web to manage your subscription plan."));
                M(this.a.h);
            } else if (subscriptionSource == SubscriptionSource.appstore) {
                this.a.f.setText("Looking to manage your plan?");
                this.a.h.setText("Please use the iOS app on the apple app store to manage your subscription plan.");
            } else {
                this.a.f.setText(BuildConfig.FLAVOR);
                this.a.h.setText(BuildConfig.FLAVOR);
            }
        }
        setSupportActionBar(this.a.g);
        this.a.g.setContentInsetStartWithNavigation(0);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        getSupportActionBar().setDisplayUseLogoEnabled(false);
        this.a.g.setNavigationIcon(R.drawable.ic_back_arrow);
        this.a.g.setTitle("back");
        this.a.g.setNavigationOnClickListener(new a());
        if (this.a.g.getTitle() != null) {
            String charSequence = this.a.g.getTitle().toString();
            for (int i2 = 0; i2 < this.a.g.getChildCount(); i2++) {
                AppCompatTextView childAt = this.a.g.getChildAt(i2);
                if ("androidx.appcompat.widget.AppCompatTextView".equals(childAt.getClass().getName())) {
                    AppCompatTextView appCompatTextView = childAt;
                    if (appCompatTextView.getText().equals(charSequence)) {
                        appCompatTextView.setTypeface(ResourcesCompat.getFont(this, 2131296270));
                        appCompatTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
                        appCompatTextView.setCompoundDrawablePadding(0);
                        childAt.setOnClickListener(new b());
                    }
                }
            }
        }
        if (AppController.j().E()) {
            this.a.g.setBackgroundColor(getResources().getColor(2131100008));
            this.a.e.setBackgroundColor(getResources().getColor(2131100008));
            this.a.f.setTextColor(-1);
            this.a.h.setTextColor(-1);
            this.a.g.setNavigationIcon(2131231334);
            if (AppController.j().l() == null || !AppController.j().l().isSubscriptionActive()) {
                this.a.b.setImageDrawable(getResources().getDrawable(2131233472));
                return;
            } else {
                this.a.b.setImageDrawable(getResources().getDrawable(2131232639));
                return;
            }
        }
        this.a.g.setBackgroundColor(-1);
        this.a.e.setBackgroundColor(-1);
        this.a.f.setTextColor(-16777216);
        this.a.h.setTextColor(-16777216);
        this.a.g.setTitleTextColor(-16777216);
        this.a.g.setNavigationIcon(2131231330);
        if (AppController.j().l() == null || !AppController.j().l().isSubscriptionActive()) {
            this.a.b.setImageDrawable(getResources().getDrawable(2131233472));
        } else {
            this.a.b.setImageDrawable(getResources().getDrawable(2131232638));
        }
    }

    @Override
    public void onError(String str, String str2) {
        Toast.makeText((Context) this, (CharSequence) "Please try again!", 0).show();
    }

    protected void onStart() {
        super.onStart();
        if (TextUtils.isEmpty(com.htmedia.mint.utils.f0.G1(this, "userToken"))) {
            finish();
        }
    }
}