正在查看: Vi App v10.18.0 应用的 MoviesWebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Vi App v10.18.0 应用的 MoviesWebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.yupptv.ott;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Base64;
import android.view.MenuItem;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.WindowInsetsControllerCompat;
import androidx.core.view.z1;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yupptv.ott.MoviesWebViewActivity;
import com.yupptv.ott.activity.BaseActivity;
import com.yupptv.ott.activity.LoadScreenActivity;
import com.yupptv.ott.enums.DialogType;
import com.yupptv.ott.enums.ScreenType;
import com.yupptv.ott.utils.APIUtils;
import com.yupptv.ott.utils.CleverTap;
import com.yupptv.ott.utils.Constants;
import com.yupptv.ott.utils.CustomLog;
import com.yupptv.ott.utils.JuspayUtility;
import com.yupptv.ott.utils.NavigationConstants;
import com.yupptv.ott.utils.NavigationUtils;
import com.yupptv.ott.views.LineSpinFadeLoaderView;
import com.yupptv.ottsdk.managers.Payment.PaymentManager;
import com.yupptv.ottsdk.managers.User.UserManager;
import com.yupptv.ottsdk.model.Error;
import com.yupptv.ottsdk.model.User;
import com.yupptv.ottsdk.model.payments.InitiateJuspay;
import com.yupptv.ottsdk.model.payments.JuspayConfig;
import com.yupptv.ottsdk.model.payments.ProcessJuspay;
import com.yupptv.ottsdk.model.user.Configs;
import com.yupptv.ottsdk.utils.OttLog;
import in.juspay.hyper.constants.LogCategory;
import in.juspay.hypersdk.core.PaymentConstants;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class MoviesWebViewActivity extends BaseActivity {
private static final String TAG = "com.yupptv.ott.MoviesWebViewActivity";
private static String load_fragment = null;
public static boolean setdisplayLanguage = true;
public String gateWay;
public LineSpinFadeLoaderView jp_progressbar;
public RelativeLayout jp_progressbarRL;
public Toolbar mToolbar;
public WebView mWebView;
public String orderId;
public LineSpinFadeLoaderView progressBar;
public String subscriptionPackName;
public String subscriptionPageSource;
public ImageView toolbarLogo;
public TextView toolbarTitle;
public String url;
public String userCategory;
public String webviewTitle;
public String paypal_redirection_cancel_url = "";
public String redirectionStatus = "-1";
public String displayLanguage = "pot";
public boolean isFromUserProfiles = false;
public boolean isFromDetailsPage = false;
public boolean isFromPartnersPage = false;
public String IS_FROM_PAYMENT_WEBVIEW = "";
public String JUSPAY_PLAN_ID = "";
public String JUSPAY_GATEWAY = "";
public String JUSPAY_ORDER_ID = "";
public String JUSPAY_ORDER_LINEITEM_ID = "";
public String JUSPAY_E_ORDER_ID = "";
public String JUSPAY_MANDATE_ID = "";
public String JUSPAY_TRANSACTION_TYPE = "";
public String JUSPAY_PLAN_EXPIRY = "";
public class CleverTapWebInterface {
private Context mContext;
public CleverTapWebInterface(Context context) {
this.mContext = context;
}
public void lambda$pushEvent$0() {
JSONObject jSONObject;
String initiateResponse = JuspayUtility.getInstance().getInitiateResponse();
if (TextUtils.isEmpty(initiateResponse)) {
MoviesWebViewActivity.this.initiateJuspayCall();
} else {
if (JuspayUtility.getInstance().isJuspayInitialized() || TextUtils.isEmpty(initiateResponse)) {
return;
}
try {
jSONObject = new JSONObject(initiateResponse);
} catch (JSONException unused) {
jSONObject = null;
}
JuspayUtility.getInstance().initiateJuspay(MoviesWebViewActivity.this, jSONObject, null);
}
}
@JavascriptInterface
public void pushEvent(String str, String str2) {
String str3;
try {
str3 = new JSONObject(str2).optString("page name");
} catch (Exception unused) {
str3 = "";
}
if (!TextUtils.isEmpty(str) && str.equalsIgnoreCase("subscription page appeared") && !TextUtils.isEmpty(str3) && str3.equalsIgnoreCase("plans")) {
new Handler().post(new Runnable() {
@Override
public final void run() {
MoviesWebViewActivity.CleverTapWebInterface.this.lambda$pushEvent$0();
}
});
}
HashMap hashMap = new HashMap();
try {
JSONObject jSONObject = new JSONObject(str2);
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
hashMap.put(next, jSONObject.get(next));
}
} catch (Exception unused2) {
}
if (hashMap.size() > 0) {
CleverTap.moviesClevertapEvent(3, str, hashMap, true);
}
}
}
private String getUrl() {
Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(getApplicationContext());
if (utilAppConfigurations == null) {
return null;
}
String str = load_fragment;
str.getClass();
switch (str) {
case "nav_from_hamburger_terms":
if (utilAppConfigurations.getTermsConditionsPageUrl() == null) {
return "";
}
return utilAppConfigurations.getTermsConditionsPageUrl() + "";
case "nav_from_hamburger_faq":
if (utilAppConfigurations.getFaqPageUrl() == null) {
return "";
}
return utilAppConfigurations.getFaqPageUrl() + "";
case "nav_roku_store":
return "https://my.roku.com/account/add?channel=frndlytv";
case "nav_amazon_store":
return "https://www.amazon.com/Frndly-TV/dp/B07VC9NCQN/ref=sr_1_1?keywords=FrndlyTV&qid=1564137654&s=gateway&sr=8-1";
case "nav_privacy_policy":
case "nav_from_hamburger_privacy":
CustomLog.e("Privacy Policy : ", utilAppConfigurations.getPrivacyPolicyPageUrl());
if (utilAppConfigurations.getPrivacyPolicyPageUrl() == null) {
return "";
}
return utilAppConfigurations.getPrivacyPolicyPageUrl() + "";
case "nav_privacy_terms":
if (utilAppConfigurations.getTermsConditionsPageUrl() == null) {
return "";
}
return utilAppConfigurations.getTermsConditionsPageUrl() + "";
case "nav_compliance_report":
return utilAppConfigurations.getComplianceReport() != null ? utilAppConfigurations.getComplianceReport() : "";
case "nav_aboutus":
case "nav_take_a_test":
return utilAppConfigurations.getAboutUsPageUrl() != null ? utilAppConfigurations.getAboutUsPageUrl() : "";
case "nav_contact_us":
case "nav_from_hamburger_contactus":
if (utilAppConfigurations.getContactUsPageUrl() == null) {
return "";
}
return utilAppConfigurations.getContactUsPageUrl() + "";
case "nav_grievance_redressal":
return utilAppConfigurations.getGrievanceRedressalUrl() != null ? utilAppConfigurations.getGrievanceRedressalUrl() : "";
case "nav_faq":
return utilAppConfigurations.getFaqPageUrl() != null ? utilAppConfigurations.getFaqPageUrl() : "";
case "nav_help":
this.toolbarTitle.setText(getString(R.string.help));
this.mToolbar.setVisibility(0);
if (utilAppConfigurations.getHelpPageUrl() == null) {
return "";
}
return utilAppConfigurations.getHelpPageUrl() + "";
default:
if (getIntent().getExtras().getString(NavigationConstants.WEB_URL) != null) {
return getIntent().getExtras().getString(NavigationConstants.WEB_URL);
}
return null;
}
}
public void hideProgressBar() {
if (isFinishing()) {
return;
}
LineSpinFadeLoaderView lineSpinFadeLoaderView = this.progressBar;
if (lineSpinFadeLoaderView != null) {
lineSpinFadeLoaderView.setVisibility(8);
}
LineSpinFadeLoaderView lineSpinFadeLoaderView2 = this.progressBar;
if (lineSpinFadeLoaderView2 instanceof LineSpinFadeLoaderView) {
lineSpinFadeLoaderView2.stopAnimation();
}
}
public void lambda$showJuspayLoader$0(boolean z) {
RelativeLayout relativeLayout = this.jp_progressbarRL;
if (relativeLayout != null) {
relativeLayout.setVisibility(z ? 0 : 8);
if (z) {
this.jp_progressbar.startAnimation();
} else {
this.jp_progressbar.stopAnimation();
}
}
}
public void launchJuspay(ProcessJuspay processJuspay, JSONObject jSONObject) {
JSONObject jSONObject2;
String initiateResponse = JuspayUtility.getInstance().getInitiateResponse();
JuspayUtility.getInstance().setJuspayOrderId(processJuspay.getOrderId());
JuspayUtility.getInstance().setChangeUpiParams(jSONObject);
JuspayUtility.getInstance().setJuspayGateway(this.JUSPAY_GATEWAY);
String processPaymentResponse = processJuspay.getProcessPaymentResponse();
if (TextUtils.isEmpty(processPaymentResponse)) {
String message = TextUtils.isEmpty(processJuspay.getMessage()) ? "Something went wrong, Please try again" : processJuspay.getMessage();
String valueOf = String.valueOf(processJuspay.getCode());
Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(getApplicationContext());
if (utilAppConfigurations == null || utilAppConfigurations.getUpiIdChangeErrorPopupJson() == null) {
Toast.makeText((Context) this, (CharSequence) message, 0).show();
return;
}
Map map = (Map) new Gson().fromJson(utilAppConfigurations.getUpiIdChangeErrorPopupJson(), new TypeToken<Map<String, Map<String, Object>>>() {
}.getType());
HashMap hashMap = new HashMap();
try {
if (!map.containsKey(valueOf) || map.get(valueOf) == null) {
Toast.makeText((Context) this, (CharSequence) message, 0).show();
} else {
hashMap.put(Constants.DIALOG_TITLE, (String) ((Map) map.get(valueOf)).get("heading"));
hashMap.put(Constants.DIALOG_SUBTITLE, (String) ((Map) map.get(valueOf)).get("description"));
hashMap.put(Constants.DIALOG_BUTTON_LABEL1, (String) ((Map) map.get(valueOf)).get("button_title"));
hashMap.put("target_path", (String) ((Map) map.get(valueOf)).get("target_path"));
hashMap.put(Constants.CLOSE_ENABLED, String.valueOf((Boolean) ((Map) map.get(valueOf)).get("close_enabled")));
NavigationUtils.showChangeUpiJuspayCallDialog("", this, DialogType.CHANGE_UPI_JUSPAY_CALL_DIALOG, hashMap, null, null);
}
return;
} catch (Exception unused) {
Toast.makeText((Context) this, (CharSequence) message, 0).show();
return;
}
}
if (TextUtils.isEmpty(initiateResponse)) {
Toast.makeText((Context) this, (CharSequence) "Something went wrong, Please try again", 1).show();
return;
}
showJuspayLoader(true);
JSONObject jSONObject3 = null;
try {
jSONObject2 = new JSONObject(initiateResponse);
} catch (Throwable unused2) {
jSONObject2 = null;
}
try {
if (!TextUtils.isEmpty(processPaymentResponse)) {
jSONObject3 = new JSONObject(processPaymentResponse);
}
} catch (Throwable unused3) {
showJuspayLoader(false);
if (jSONObject2 != null) {
return;
} else {
return;
}
}
if (jSONObject2 != null || jSONObject3 == null) {
return;
}
if (JuspayUtility.getInstance().isJuspayInitialized()) {
JuspayUtility.getInstance().processJuspay(this, jSONObject3);
} else {
JuspayUtility.getInstance().initiateJuspay(this, jSONObject2, jSONObject3);
}
}
private void showProgressBar() {
if (isFinishing()) {
return;
}
LineSpinFadeLoaderView lineSpinFadeLoaderView = this.progressBar;
if (lineSpinFadeLoaderView != null && lineSpinFadeLoaderView.getVisibility() == 8) {
this.progressBar.setVisibility(0);
}
LineSpinFadeLoaderView lineSpinFadeLoaderView2 = this.progressBar;
if (lineSpinFadeLoaderView2 instanceof LineSpinFadeLoaderView) {
lineSpinFadeLoaderView2.startAnimation();
}
}
private void systemUI() {
if (Build.VERSION.SDK_INT >= 35) {
z1.a(getWindow(), false);
new WindowInsetsControllerCompat(getWindow(), getWindow().getDecorView()).setAppearanceLightStatusBars(false);
getWindow().getDecorView().setBackgroundColor(-16777216);
}
}
public void changeUpiJuspayCall() {
if (TextUtils.isEmpty(this.JUSPAY_MANDATE_ID) || TextUtils.isEmpty(this.JUSPAY_TRANSACTION_TYPE) || TextUtils.isEmpty(this.JUSPAY_E_ORDER_ID) || TextUtils.isEmpty(this.JUSPAY_PLAN_EXPIRY)) {
Toast.makeText((Context) this, (CharSequence) "Something went wrong, Please try again later....", 0).show();
return;
}
if (APIUtils.getUtilPreferenceManager(getApplicationContext()).getLoggedUser() == null) {
Toast.makeText((Context) this, (CharSequence) "Please login and try again", 1).show();
return;
}
showJuspayLoader(true);
final JSONObject jSONObject = null;
try {
JSONObject jSONObject2 = new JSONObject();
try {
jSONObject2.put("mandateId", this.JUSPAY_MANDATE_ID);
jSONObject2.put(LogCategory.ACTION, "CHANGE_UPI_HANDLE");
jSONObject2.put("transactionType", this.JUSPAY_TRANSACTION_TYPE);
jSONObject2.put("ecommOrderId", this.JUSPAY_E_ORDER_ID);
jSONObject2.put("currentPlanExpiryDate", this.JUSPAY_PLAN_EXPIRY);
} catch (JSONException unused) {
}
jSONObject = jSONObject2;
} catch (JSONException unused2) {
}
if (jSONObject != null) {
APIUtils.getOTTSdkInstance(getApplicationContext()).getPaymentManager().changeUpiUpdateMandate(jSONObject, new PaymentManager.PaymentCallback<ProcessJuspay>() {
@Override
public void onFailure(Error error) {
MoviesWebViewActivity.this.showJuspayLoader(false);
if (error != null) {
String message = error.getMessage();
String valueOf = String.valueOf(error.getCode());
Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(MoviesWebViewActivity.this.getApplicationContext());
if (utilAppConfigurations == null || utilAppConfigurations.getUpiIdChangeErrorPopupJson() == null) {
Toast.makeText((Context) MoviesWebViewActivity.this, (CharSequence) message, 0).show();
} else {
Map map = (Map) new Gson().fromJson(utilAppConfigurations.getUpiIdChangeErrorPopupJson(), new TypeToken<Map<String, Map<String, Object>>>() {
}.getType());
HashMap hashMap = new HashMap();
try {
if (!map.containsKey(valueOf) || map.get(valueOf) == null) {
Toast.makeText((Context) MoviesWebViewActivity.this, (CharSequence) message, 0).show();
} else {
hashMap.put(Constants.DIALOG_TITLE, (String) ((Map) map.get(valueOf)).get("heading"));
hashMap.put(Constants.DIALOG_SUBTITLE, (String) ((Map) map.get(valueOf)).get("description"));
hashMap.put(Constants.DIALOG_BUTTON_LABEL1, (String) ((Map) map.get(valueOf)).get("button_title"));
hashMap.put("target_path", (String) ((Map) map.get(valueOf)).get("target_path"));
hashMap.put(Constants.CLOSE_ENABLED, String.valueOf((Boolean) ((Map) map.get(valueOf)).get("close_enabled")));
NavigationUtils.showChangeUpiJuspayCallDialog("", MoviesWebViewActivity.this, DialogType.CHANGE_UPI_JUSPAY_CALL_DIALOG, hashMap, null, null);
}
} catch (Exception unused3) {
Toast.makeText((Context) MoviesWebViewActivity.this, (CharSequence) message, 0).show();
}
}
CustomLog.e("JuspaySDKLogEvent", "processJuspayPayment onFailure : " + message);
}
}
@Override
public void onSuccess(ProcessJuspay processJuspay) {
MoviesWebViewActivity.this.showJuspayLoader(false);
MoviesWebViewActivity.this.launchJuspay(processJuspay, jSONObject);
}
});
}
}
public void closeWebViewRedirectSignIn() {
APIUtils.getOTTSdkInstance(getApplicationContext()).getUserManager().logout(new UserManager.UserCallback<String>() {
@Override
public void onEmptySuccess() {
com.yupptv.ottsdk.managers.User.a.a(this);
}
@Override
public void onFailure(Error error) {
Toast.makeText(MoviesWebViewActivity.this.getApplicationContext(), "Failed to Logout", 0).show();
NavigationUtils.logKibanaError("WebViewActivity", "API", "/service/api/auth/signout", "NA", "NA", "NA", f.a(error, new StringBuilder("")), error.getMessage());
}
@Override
public void onSuccess(String str) {
Toast.makeText(MoviesWebViewActivity.this.getApplicationContext(), "Logged Out", 0).show();
Intent intent = new Intent((Context) MoviesWebViewActivity.this, (Class<?>) LoadScreenActivity.class);
intent.putExtra(NavigationConstants.SCREEN_TYPE, ScreenType.SIGNIN);
intent.putExtra(NavigationConstants.NAV_FROM, NavigationConstants.NAV_COCP_USER_SIGN_IN);
intent.putExtra(NavigationConstants.PAGEPATH, "");
MoviesWebViewActivity.this.startActivity(intent);
}
});
}
public String getAppCloseRedirectExternalUrl(String str) {
Uri parse = Uri.parse(str);
String queryParameter = parse.getQueryParameter("redirectionURL");
String queryParameter2 = parse.getQueryParameter("pid");
String queryParameter3 = parse.getQueryParameter("gw");
String queryParameter4 = parse.getQueryParameter(PaymentConstants.ORDER_ID_CAMEL);
String queryParameter5 = parse.getQueryParameter("orderLineItemid");
String queryParameter6 = parse.getQueryParameter("lroid");
String queryParameter7 = parse.getQueryParameter("mid");
String queryParameter8 = parse.getQueryParameter("tt");
String queryParameter9 = parse.getQueryParameter("exp");
if (!TextUtils.isEmpty(queryParameter2)) {
this.JUSPAY_PLAN_ID = queryParameter2;
}
if (!TextUtils.isEmpty(queryParameter3)) {
this.JUSPAY_GATEWAY = queryParameter3;
}
if (!TextUtils.isEmpty(queryParameter4)) {
this.JUSPAY_ORDER_ID = queryParameter4;
}
if (!TextUtils.isEmpty(queryParameter5)) {
this.JUSPAY_ORDER_LINEITEM_ID = queryParameter5;
}
if (!TextUtils.isEmpty(queryParameter9)) {
this.JUSPAY_PLAN_EXPIRY = queryParameter9;
}
if (!TextUtils.isEmpty(queryParameter6)) {
this.JUSPAY_E_ORDER_ID = queryParameter6;
}
if (!TextUtils.isEmpty(queryParameter8)) {
this.JUSPAY_TRANSACTION_TYPE = queryParameter8;
}
if (!TextUtils.isEmpty(queryParameter7)) {
this.JUSPAY_MANDATE_ID = queryParameter7;
}
return !TextUtils.isEmpty(queryParameter) ? queryParameter : "";
}
public void initiateJuspayCall() {
if (APIUtils.getUtilPreferenceManager(getApplicationContext()).getLoggedUser() != null) {
User loggedUser = APIUtils.getUtilPreferenceManager(getApplicationContext()).getLoggedUser();
if (loggedUser != null && loggedUser.getUserCategory() != null) {
if (loggedUser.getUserCategory().intValue() == 1) {
this.userCategory = "PREPAID";
} else if (loggedUser.getUserCategory().intValue() == 2) {
this.userCategory = "POSTPAID";
} else if (loggedUser.getUserCategory().intValue() == 3) {
this.userCategory = "non-vi";
}
}
JuspayConfig enableJuspayConfig = APIUtils.getUtilPreferenceManager(getApplicationContext()).getEnableJuspayConfig();
if (enableJuspayConfig == null || enableJuspayConfig.getCustomerTypes() == null || enableJuspayConfig.getCustomerTypes().size() <= 0) {
return;
}
for (String str : enableJuspayConfig.getCustomerTypes()) {
if (!TextUtils.isEmpty("PREPAID") && "PREPAID".equalsIgnoreCase(str)) {
showJuspayLoader(true);
APIUtils.getOTTSdkInstance(getApplicationContext()).getPaymentManager().initiateJuspayPayment(new PaymentManager.PaymentCallback<InitiateJuspay>() {
@Override
public void onFailure(Error error) {
MoviesWebViewActivity.this.showJuspayLoader(false);
if (error != null) {
CustomLog.e("JuspaySDKLogEvent", "initiateJuspayPayment onFailure : " + error.getMessage());
}
}
@Override
public void onSuccess(InitiateJuspay initiateJuspay) {
JSONObject jSONObject;
MoviesWebViewActivity.this.showJuspayLoader(false);
if (initiateJuspay != null) {
String json = new Gson().toJson(initiateJuspay);
if (TextUtils.isEmpty(json)) {
return;
}
try {
jSONObject = new JSONObject(json);
} catch (JSONException unused) {
jSONObject = null;
}
JuspayUtility.getInstance().setInitiateResponse(json);
JuspayUtility.getInstance().initiateJuspay(MoviesWebViewActivity.this, jSONObject, null);
}
}
});
return;
}
}
}
}
public void onBackPressed() {
WebView webView;
if (OTTApplication.isPlayerPage) {
OTTApplication.isDrawerOpen = false;
}
if (isFinishing()) {
return;
}
if (this.IS_FROM_PAYMENT_WEBVIEW.equalsIgnoreCase("true")) {
super/*androidx.activity.ComponentActivity*/.onBackPressed();
return;
}
if (load_fragment.equalsIgnoreCase(NavigationConstants.NAV_ACCOUNT)) {
if (this.mWebView != null) {
finish();
return;
}
} else if (load_fragment.equalsIgnoreCase(NavigationConstants.NAV_HELP) && (webView = this.mWebView) != null && webView.canGoBack()) {
this.mWebView.goBack();
return;
}
if (load_fragment.equalsIgnoreCase(NavigationConstants.NAV_WHOISWATCHING)) {
hideProgressBar();
finish();
return;
}
hideProgressBar();
if (!load_fragment.equalsIgnoreCase("nav_help")) {
CleverTap.moviesEventSubscriptionPageClicked("plans", this.subscriptionPageSource, "pro", "closed", "mobile back", "");
}
if (getIntent().getExtras().getString("navigatedFrom") == null || !getIntent().getExtras().getString("navigatedFrom").equalsIgnoreCase("signinPage")) {
OTTApplication.IS_FROM_AFTER_WEB_VIEW_FINISH = false;
} else {
OTTApplication.IS_FROM_AFTER_WEB_VIEW_FINISH = true;
}
finish();
}
public void onCreate(Bundle bundle) {
super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
setRequestedOrientation(1);
overridePendingTransition(0, 0);
setContentView(R.layout.vilite_web_view_layout);
this.mToolbar = findViewById(R.id.toolBarLayout);
this.toolbarTitle = (TextView) findViewById(R.id.toolbar_title);
this.mToolbar.setVisibility(8);
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
this.jp_progressbarRL = (RelativeLayout) findViewById(R.id.jp_progressbar_layout);
this.jp_progressbar = (LineSpinFadeLoaderView) findViewById(R.id.jp_progressbar);
ImageView imageView = (ImageView) findViewById(R.id.toolbar_logo);
this.toolbarLogo = imageView;
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
MoviesWebViewActivity.this.onBackPressed();
}
});
Bundle extras = getIntent().getExtras();
this.isFromUserProfiles = false;
if (extras != null && extras.containsKey(NavigationConstants.WEB_URL_FROM_USER_PROFILES)) {
this.isFromUserProfiles = extras.getBoolean(NavigationConstants.WEB_URL_FROM_USER_PROFILES);
}
this.progressBar = (LineSpinFadeLoaderView) findViewById(R.id.web_progressbar);
showProgressBar();
systemUI();
load_fragment = (String) getIntent().getSerializableExtra("load_fragment");
if (extras != null && extras.containsKey("isFromDetailsPage")) {
this.isFromDetailsPage = extras.getBoolean("isFromDetailsPage", false);
}
if (extras != null && extras.containsKey("isFromPartnersPage")) {
this.isFromPartnersPage = extras.getBoolean("isFromPartnersPage", false);
}
String str = "";
if (extras != null && extras.containsKey("webview_title")) {
this.webviewTitle = extras.getString("webview_title", "");
}
if (this.isFromDetailsPage) {
OTTApplication.IS_FROM_DETAILS_PAGE = true;
} else {
OTTApplication.IS_FROM_DETAILS_PAGE = false;
}
if (this.isFromPartnersPage) {
OTTApplication.IS_FROM_PARTNERS_PAGE = true;
} else {
OTTApplication.IS_FROM_PARTNERS_PAGE = false;
}
if (APIUtils.getUtilPreferenceManager(getApplicationContext()) != null && APIUtils.getUtilPreferenceManager(getApplicationContext()).getDisplayLanguage() != null) {
if (APIUtils.getUtilPreferenceManager(getApplicationContext()).getDisplayLanguage().equalsIgnoreCase("pot")) {
this.displayLanguage = "pot";
if (setdisplayLanguage) {
OTTApplication.setLocalePortuguese(this);
setdisplayLanguage = false;
}
} else if (APIUtils.getUtilPreferenceManager(getApplicationContext()).getDisplayLanguage().equalsIgnoreCase("eng")) {
this.displayLanguage = "eng";
if (setdisplayLanguage) {
OTTApplication.setLocaleEnglish(this);
setdisplayLanguage = false;
}
}
}
if (getIntent().getExtras().getString(NavigationConstants.WEB_URL) != null) {
this.url = getIntent().getExtras().getString(NavigationConstants.WEB_URL);
if (OTTApplication.IS_INTERNAL_FLOW) {
OTTApplication.IS_INTERNAL_FLOW = false;
this.toolbarTitle.setText(getString(R.string.plans_and_offers));
this.mToolbar.setVisibility(0);
}
if (!TextUtils.isEmpty(this.webviewTitle)) {
this.toolbarTitle.setText(this.webviewTitle);
this.mToolbar.setVisibility(0);
}
} else {
this.url = getUrl();
}
if (getIntent().getExtras().getString(NavigationConstants.SUBCRIPTION_PAGE_SOURCE) != null) {
this.subscriptionPageSource = getIntent().getExtras().getString(NavigationConstants.SUBCRIPTION_PAGE_SOURCE);
} else {
this.subscriptionPageSource = "";
}
if (getIntent().getExtras().getString(NavigationConstants.ORDERID) != null) {
this.orderId = getIntent().getExtras().getString(NavigationConstants.ORDERID);
} else {
this.orderId = "";
}
if (getIntent().getExtras().getString(NavigationConstants.PURCHASE_GATEWAY) != null) {
this.gateWay = getIntent().getExtras().getString(NavigationConstants.PURCHASE_GATEWAY);
} else {
this.gateWay = "";
}
if (this.url == null) {
Toast.makeText((Context) this, R.string.no_url, 1).show();
finish();
return;
}
if (this.gateWay.equalsIgnoreCase(NavigationConstants.PAYMENT_TYPE_PAYPAL)) {
if (getIntent().getExtras().getString(NavigationConstants.CANCELURL) != null) {
this.paypal_redirection_cancel_url = getIntent().getExtras().getString(NavigationConstants.CANCELURL);
} else {
this.paypal_redirection_cancel_url = "";
}
}
OttLog.error("WebViewActivity", "url : " + this.url);
if (Uri.parse(this.url).getQueryParameter("redirectstatus") != null) {
this.redirectionStatus = Uri.parse(this.url).getQueryParameter("redirectstatus");
}
this.subscriptionPackName = "NA";
if (APIUtils.getUtilPreferenceManager(getApplicationContext()).getLoggedUser() != null) {
User loggedUser = APIUtils.getUtilPreferenceManager(getApplicationContext()).getLoggedUser();
if (loggedUser != null) {
if (loggedUser.getUserCategory().intValue() == 1) {
this.userCategory = "PREPAID";
} else if (loggedUser.getUserCategory().intValue() == 2) {
this.userCategory = "POSTPAID";
} else if (loggedUser.getUserCategory().intValue() == 3) {
this.userCategory = "non-vi";
}
if (loggedUser.getAttributes() != null) {
this.subscriptionPackName = loggedUser.getAttributes().getActivePackName();
}
} else {
this.userCategory = "NA";
}
}
WebView webView = (WebView) findViewById(R.id.subscriptionWebView);
this.mWebView = webView;
webView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setDomStorageEnabled(true);
this.mWebView.setBackgroundColor(getResources().getColor(R.color.webView_background));
this.mWebView.setWebViewClient(new CustomWebViewClient(this));
this.mWebView.addJavascriptInterface(new CleverTapWebInterface(this), "com_vilite_clevertap");
this.mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView webView2, String str2, String str3, final JsResult jsResult) {
new AlertDialog.Builder(MoviesWebViewActivity.this).setTitle(R.string.alert).setMessage(str3).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
jsResult.confirm();
}
}).setCancelable(false).create().show();
return true;
}
});
this.mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView webView2, int i2) {
String str2;
WebView webView3;
super.onProgressChanged(webView2, i2);
if (MoviesWebViewActivity.load_fragment.equalsIgnoreCase(NavigationConstants.NAV_ACCOUNT) || MoviesWebViewActivity.load_fragment.equalsIgnoreCase(NavigationConstants.NAV_WHOISWATCHING)) {
Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(MoviesWebViewActivity.this.getApplicationContext());
if (utilAppConfigurations == null || utilAppConfigurations.getSiteURL() == null) {
str2 = "";
} else {
str2 = utilAppConfigurations.getSiteURL();
if (webView2 == null || webView2.getUrl() == null || !webView2.getUrl().endsWith("/")) {
if (str2.endsWith("/")) {
str2 = str2.subSequence(0, str2.length() - 1).toString();
}
} else if (!str2.endsWith("/")) {
str2 = str2.concat("/");
}
}
if (MoviesWebViewActivity.this.url.contains("profiles")) {
str2 = str2 + "/home";
}
CustomLog.d("DEBUG", "siteUrl " + str2);
CustomLog.d("DEBUG", "view.getUrl() " + webView2.getUrl());
if (webView2.getUrl() == null || !webView2.getUrl().equalsIgnoreCase(str2) || (webView3 = MoviesWebViewActivity.this.mWebView) == null) {
return;
}
webView3.destroy();
}
}
});
this.mWebView.setHorizontalScrollBarEnabled(false);
this.mWebView.setVerticalScrollBarEnabled(false);
if (this.url != null) {
String str2 = load_fragment;
if (str2 == null || !str2.equalsIgnoreCase(NavigationConstants.NAV_TAKE_A_TEST)) {
if (!this.url.contains("pdf")) {
this.mWebView.loadUrl(this.url);
return;
}
this.mWebView.loadUrl("https://drive.google.com/viewerng/viewer?embedded=true&url=" + this.url);
return;
}
User loggedUser2 = APIUtils.getUtilPreferenceManager(getApplicationContext()).getLoggedUser();
if (loggedUser2 == null) {
this.mWebView.loadUrl(this.url);
return;
}
String trim = (APIUtils.getUtilAppConfigurations(getApplicationContext()) == null || APIUtils.getUtilAppConfigurations(getApplicationContext()).getLmsEntryUrl() == null) ? "" : APIUtils.getUtilAppConfigurations(this).getLmsEntryUrl().trim();
if (loggedUser2.getAttributes() != null) {
User.Attributes attributes = loggedUser2.getAttributes();
str = "un=" + attributes.getLms_user_name() + "&pd=" + attributes.getLms_password() + "&url=" + this.url;
}
if (str.trim().length() > 0) {
this.mWebView.postUrl(trim, str.getBytes());
} else {
this.mWebView.loadUrl(this.url);
}
}
}
public void onDestroy() {
super.onDestroy();
JuspayUtility.getInstance().terminatePayment();
if (this.mWebView != null) {
this.mWebView = null;
}
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 16908332) {
onBackPressed();
}
return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
}
public void processJuspayCall() {
if (TextUtils.isEmpty(this.JUSPAY_PLAN_ID) || TextUtils.isEmpty(this.JUSPAY_GATEWAY)) {
Toast.makeText((Context) this, (CharSequence) "Something went wrong, Please try again later....", 0).show();
return;
}
if (APIUtils.getUtilPreferenceManager(getApplicationContext()).getLoggedUser() == null) {
Toast.makeText((Context) this, (CharSequence) "Please login and try again", 1).show();
return;
}
showJuspayLoader(true);
JSONObject jSONObject = null;
try {
JSONObject jSONObject2 = new JSONObject();
try {
jSONObject2.put("packages", this.JUSPAY_PLAN_ID);
jSONObject2.put("gateway", this.JUSPAY_GATEWAY);
} catch (JSONException unused) {
}
jSONObject = jSONObject2;
} catch (JSONException unused2) {
}
if (jSONObject != null) {
APIUtils.getOTTSdkInstance(getApplicationContext()).getPaymentManager().processJuspayPayment(jSONObject, new PaymentManager.PaymentCallback<ProcessJuspay>() {
@Override
public void onFailure(Error error) {
MoviesWebViewActivity.this.showJuspayLoader(false);
if (error != null) {
String message = error.getMessage();
Toast.makeText((Context) MoviesWebViewActivity.this, (CharSequence) message, 1).show();
CustomLog.e("JuspaySDKLogEvent", "processJuspayPayment onFailure : " + message);
}
}
@Override
public void onSuccess(ProcessJuspay processJuspay) {
MoviesWebViewActivity.this.showJuspayLoader(false);
MoviesWebViewActivity.this.launchJuspay(processJuspay, null);
}
});
}
}
public void showJuspayLoader(final boolean z) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
MoviesWebViewActivity.this.lambda$showJuspayLoader$0(z);
}
});
}
public class CustomWebViewClient extends WebViewClient {
private Context mContext;
public CustomWebViewClient(Context context) {
this.mContext = context;
}
public void downloadInvoice(String str) {
Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(MoviesWebViewActivity.this.getApplicationContext());
String siteURL = (utilAppConfigurations == null || utilAppConfigurations.getSiteURL() == null) ? "" : utilAppConfigurations.getSiteURL();
String sessionId = APIUtils.getUtilPreferenceManager(MoviesWebViewActivity.this.getApplicationContext()).getSessionId() != null ? APIUtils.getUtilPreferenceManager(MoviesWebViewActivity.this.getApplicationContext()).getSessionId() : "";
String deviceUniqueId = APIUtils.getUtilPreferenceManager(MoviesWebViewActivity.this.getApplicationContext()).getDeviceUniqueId() != null ? APIUtils.getUtilPreferenceManager(MoviesWebViewActivity.this.getApplicationContext()).getDeviceUniqueId() : "";
int yuppDeviceId = APIUtils.getUtilPreferenceManager(MoviesWebViewActivity.this.getApplicationContext()).getYuppDeviceId();
CustomLog.d("DEBUG", "sessionId " + sessionId);
CustomLog.d("DEBUG", "boxId " + deviceUniqueId);
CustomLog.d("DEBUG", "clientId " + yuppDeviceId);
String str2 = "bi===" + deviceUniqueId + "&&&si===" + sessionId + "&&&ci===" + yuppDeviceId + "&&&theme===w&&&source===" + MoviesWebViewActivity.this.subscriptionPageSource + "&&&platform===lsdk&&&ucv===15&&&lroid===" + MoviesWebViewActivity.this.JUSPAY_ORDER_ID + "&&&oiid===" + MoviesWebViewActivity.this.JUSPAY_ORDER_LINEITEM_ID;
if (str != null && !str.trim().isEmpty()) {
str2 = b.a(str2, "&&&redirect===", str);
}
CustomLog.d("DEBUG", "siteurl string to encode " + str2);
String encodeToString = Base64.encodeToString(str2.getBytes(), 0);
try {
encodeToString = URLEncoder.encode(encodeToString, "UTF-8");
} catch (UnsupportedEncodingException unused) {
}
String a = siteURL.endsWith("/") ? b.a(siteURL, "sso/manage?ut=", encodeToString) : b.a(siteURL, "/sso/manage?ut=", encodeToString);
g.a("siteurl ", a, "DEBUG");
try {
Intent makeMainSelectorActivity = Intent.makeMainSelectorActivity("android.intent.action.MAIN", "android.intent.category.APP_BROWSER");
makeMainSelectorActivity.setData(Uri.parse(a));
MoviesWebViewActivity.this.startActivity(makeMainSelectorActivity);
} catch (Exception unused2) {
}
MoviesWebViewActivity.this.hideProgressBar();
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
MoviesWebViewActivity.this.hideProgressBar();
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
MoviesWebViewActivity.this.hideProgressBar();
super.onPageStarted(webView, str, bitmap);
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
OttLog.error(MoviesWebViewActivity.TAG, "onReceivedError" + webResourceError);
}
@Override
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
OttLog.error(MoviesWebViewActivity.TAG, "onReceivedHttpError" + webResourceResponse);
}
@Override
public void onReceivedSslError(WebView webView, final SslErrorHandler sslErrorHandler, SslError sslError) {
OttLog.error(MoviesWebViewActivity.TAG, "onReceivedSslError" + sslError);
AppCompatActivity appCompatActivity = MoviesWebViewActivity.this;
if (appCompatActivity == null || appCompatActivity.isFinishing() || MoviesWebViewActivity.this.isDestroyed()) {
sslErrorHandler.cancel();
return;
}
AlertDialog create = new AlertDialog.Builder(MoviesWebViewActivity.this).create();
int primaryError = sslError.getPrimaryError();
String concat = (primaryError != 0 ? primaryError != 1 ? primaryError != 2 ? primaryError != 3 ? "SSL Certificate error." : "The certificate authority is not trusted." : "The certificate Hostname mismatch." : "The certificate has expired." : "The certificate is not yet valid.").concat(" Do you want to continue anyway?");
create.setTitle("SSL Certificate Error");
create.setMessage(concat);
create.setButton(-1, "OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
sslErrorHandler.proceed();
}
});
create.setButton(-2, "Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
sslErrorHandler.cancel();
}
});
create.show();
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
OttLog.error(MoviesWebViewActivity.TAG, "shouldInterceptRequest : url " + webResourceRequest);
return super.shouldInterceptRequest(webView, webResourceRequest);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
OttLog.error(MoviesWebViewActivity.TAG, "should override url loading : url ");
OttLog.error(MoviesWebViewActivity.TAG, str);
if (str == null) {
return false;
}
if (str.contains("pdf")) {
webView.loadUrl(str);
return true;
}
if (MoviesWebViewActivity.load_fragment.equalsIgnoreCase(NavigationConstants.NAV_ACCOUNT) && str.contains("appclose")) {
String appCloseRedirectExternalUrl = MoviesWebViewActivity.this.getAppCloseRedirectExternalUrl(str);
if (!TextUtils.isEmpty(appCloseRedirectExternalUrl)) {
if (appCloseRedirectExternalUrl.equalsIgnoreCase("cocp_logout") || appCloseRedirectExternalUrl.equalsIgnoreCase("logout")) {
MoviesWebViewActivity.this.closeWebViewRedirectSignIn();
} else {
if (appCloseRedirectExternalUrl.contains("http") || appCloseRedirectExternalUrl.contains("https")) {
OTTApplication.isDrawerOpen = false;
OTTApplication.IS_FROM_PREPAID_EXTERNAL_BROWSER = true;
if (OTTApplication.getWebLinkCallback() != null) {
OTTApplication.getWebLinkCallback().callWebLink(appCloseRedirectExternalUrl);
}
MoviesWebViewActivity.this.setResult(105);
MoviesWebViewActivity.this.finish();
return true;
}
if (appCloseRedirectExternalUrl.contains("success")) {
OTTApplication.SUBSCRIPTION_STATUS_SUCCESS = true;
} else if (appCloseRedirectExternalUrl.equalsIgnoreCase("back")) {
if (MoviesWebViewActivity.this.getIntent().getExtras().getString("navigatedFrom") == null || !MoviesWebViewActivity.this.getIntent().getExtras().getString("navigatedFrom").equalsIgnoreCase("signinPage")) {
OTTApplication.IS_FROM_AFTER_WEB_VIEW_FINISH = false;
} else {
OTTApplication.IS_FROM_AFTER_WEB_VIEW_FINISH = true;
}
} else if (appCloseRedirectExternalUrl.equalsIgnoreCase("continueWatching")) {
OTTApplication.isDrawerOpen = false;
}
}
}
if (appCloseRedirectExternalUrl.equalsIgnoreCase("payment")) {
MoviesWebViewActivity moviesWebViewActivity = MoviesWebViewActivity.this;
moviesWebViewActivity.IS_FROM_PAYMENT_WEBVIEW = "true";
moviesWebViewActivity.processJuspayCall();
return true;
}
if (appCloseRedirectExternalUrl.equalsIgnoreCase("changeupi")) {
MoviesWebViewActivity moviesWebViewActivity2 = MoviesWebViewActivity.this;
moviesWebViewActivity2.IS_FROM_PAYMENT_WEBVIEW = "true";
if (!TextUtils.isEmpty(moviesWebViewActivity2.JUSPAY_MANDATE_ID) && !TextUtils.isEmpty(MoviesWebViewActivity.this.JUSPAY_TRANSACTION_TYPE) && !TextUtils.isEmpty(MoviesWebViewActivity.this.JUSPAY_E_ORDER_ID) && !TextUtils.isEmpty(MoviesWebViewActivity.this.JUSPAY_PLAN_EXPIRY)) {
MoviesWebViewActivity.this.changeUpiJuspayCall();
return true;
}
} else {
if (!appCloseRedirectExternalUrl.equalsIgnoreCase("invoice")) {
?? r4 = MoviesWebViewActivity.this;
r4.IS_FROM_PAYMENT_WEBVIEW = "false";
if (OTTApplication.SUBSCRIPTION_STATUS_SUCCESS) {
r4.setResult(39, r4.getIntent());
}
MoviesWebViewActivity.this.finish();
return true;
}
MoviesWebViewActivity moviesWebViewActivity3 = MoviesWebViewActivity.this;
moviesWebViewActivity3.IS_FROM_PAYMENT_WEBVIEW = "true";
if (!TextUtils.isEmpty(moviesWebViewActivity3.JUSPAY_ORDER_ID) && !TextUtils.isEmpty(MoviesWebViewActivity.this.JUSPAY_ORDER_LINEITEM_ID)) {
downloadInvoice(appCloseRedirectExternalUrl);
return true;
}
}
}
return false;
}
@Override
public void onReceivedError(WebView webView, int i2, String str, String str2) {
super.onReceivedError(webView, i2, str, str2);
OttLog.error(MoviesWebViewActivity.TAG, "onReceived Error : code " + i2 + " description : " + str);
String str3 = MoviesWebViewActivity.TAG;
StringBuilder sb = new StringBuilder("onReceived Error : failedurl : ");
sb.append(str2);
OttLog.error(str3, sb.toString());
if (MoviesWebViewActivity.this.redirectionStatus.equalsIgnoreCase("-1")) {
MoviesWebViewActivity.this.redirectionStatus = "0";
}
MoviesWebViewActivity.this.onBackPressed();
}
}
}