正在查看: Vi App v10.18.0 应用的 customMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Vi App v10.18.0 应用的 customMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mventus.selfcare.activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.pushnotification.fcm.CTFcmMessageHandler;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.mventus.selfcare.activity.customMessagingService;
import com.squareup.picasso.Picasso;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
public class customMessagingService extends FirebaseMessagingService {
public CleverTapAPI cleverTapAPI;
private Context context;
private boolean isDialogShowing = false;
private boolean IS_PROD_CMS = false;
public class AnonymousClass1 implements Runnable {
public final String val$backgroundImageUrl;
public final Map val$data;
public AnonymousClass1(String str, Map map) {
this.val$backgroundImageUrl = str;
this.val$data = map;
}
public void lambda$run$0(String str, WindowManager windowManager, FrameLayout frameLayout, View view) {
customMessagingService custommessagingservice = customMessagingService.this;
custommessagingservice.navigateToRecharge(custommessagingservice.isEmptyDataHandling(str, "https://www.myvi.in/Dashboard"));
customMessagingService.this.cleanUpDialog(windowManager, frameLayout);
customMessagingService custommessagingservice2 = customMessagingService.this;
custommessagingservice2.sendEventToClevertap(custommessagingservice2.cleverTapAPI, "recharge");
}
public void lambda$run$1(WindowManager windowManager, FrameLayout frameLayout, View view) {
customMessagingService.this.cleanUpDialog(windowManager, frameLayout);
customMessagingService custommessagingservice = customMessagingService.this;
custommessagingservice.sendEventToClevertap(custommessagingservice.cleverTapAPI, "cross");
}
@Override
public void run() {
WindowManager windowManager;
String str;
WindowManager windowManager2 = (WindowManager) customMessagingService.this.getSystemService("window");
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(-1, -1, Build.VERSION.SDK_INT >= 26 ? 2038 : 2002, 524424, -3);
View inflate = ((LayoutInflater) customMessagingService.this.getSystemService("layout_inflater")).inflate(R.layout.dialog_rechrge_alert, (ViewGroup) null);
final FrameLayout frameLayout = new FrameLayout(customMessagingService.this.context);
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
frameLayout.addView(inflate);
ImageView imageView = (ImageView) inflate.findViewById(R.id.iv_banner);
ImageView imageView2 = (ImageView) inflate.findViewById(R.id.reminder_icon);
TextView textView = (TextView) inflate.findViewById(R.id.tv_alert_title);
TextView textView2 = (TextView) inflate.findViewById(R.id.tv_alert_message);
TextView textView3 = (TextView) inflate.findViewById(R.id.tv_alert_message_description);
Button button = (Button) inflate.findViewById(R.id.btnRechargeNow);
CardView findViewById = inflate.findViewById(R.id.cvClose);
View findViewById2 = inflate.findViewById(R.id.viewSpace);
RelativeLayout relativeLayout = (RelativeLayout) inflate.findViewById(R.id.relBackground);
if (TextUtils.isEmpty(this.val$backgroundImageUrl)) {
windowManager = windowManager2;
} else {
windowManager = windowManager2;
customMessagingService.this.loadBackground(this.val$backgroundImageUrl, relativeLayout);
}
if (TextUtils.isEmpty((CharSequence) this.val$data.get("wzrk_acts"))) {
return;
}
try {
JSONArray jSONArray = new JSONArray((String) this.val$data.get("wzrk_acts"));
String string = jSONArray.getJSONObject(0).getString("l");
String string2 = jSONArray.getJSONObject(0).getString("dl");
if (TextUtils.isEmpty((CharSequence) this.val$data.get("wzrk_bp"))) {
str = string2;
} else {
str = string2;
customMessagingService.this.loadBanner((String) this.val$data.get("wzrk_bp"), imageView, findViewById2);
}
if (!TextUtils.isEmpty((CharSequence) this.val$data.get("box_icon"))) {
customMessagingService.this.loadIcon((String) this.val$data.get("box_icon"), imageView2);
}
textView.setText(customMessagingService.this.isEmptyDataHandling((String) this.val$data.get("box_title"), customMessagingService.this.getString(R.string.recharge_reminder)));
textView2.setText(customMessagingService.this.isEmptyDataHandling((String) this.val$data.get("nt"), customMessagingService.this.getString(R.string.alert_message)));
textView3.setText(customMessagingService.this.isEmptyDataHandling((String) this.val$data.get("nm"), customMessagingService.this.getString(R.string.alert_message_description)));
?? r3 = customMessagingService.this;
button.setText(r3.isEmptyDataHandling(string, r3.getString(R.string.recharge_now)));
textView.setTypeface(customMessagingService.this.getFontsFromAssets("Bold"));
textView2.setTypeface(customMessagingService.this.getFontsFromAssets("Bold"));
textView3.setTypeface(customMessagingService.this.getFontsFromAssets("Regular"));
button.setTypeface(customMessagingService.this.getFontsFromAssets("Regular"));
customMessagingService custommessagingservice = customMessagingService.this;
custommessagingservice.setMediaPlayerForSound(custommessagingservice.context);
final WindowManager windowManager3 = windowManager;
final String str2 = str;
button.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
customMessagingService.AnonymousClass1.this.lambda$run$0(str2, windowManager3, frameLayout, view);
}
});
findViewById.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
customMessagingService.AnonymousClass1.this.lambda$run$1(windowManager3, frameLayout, view);
}
});
windowManager3.addView(frameLayout, layoutParams);
customMessagingService.this.isDialogShowing = true;
} catch (Exception unused) {
customMessagingService.this.isDialogShowing = false;
}
}
}
public void cleanUpDialog(WindowManager windowManager, FrameLayout frameLayout) {
windowManager.removeView(frameLayout);
this.isDialogShowing = false;
}
public Typeface getFontsFromAssets(String str) {
AssetManager assets = getAssets();
str.hashCode();
if (str.equals("Regular")) {
return Typeface.createFromAsset(assets, "fonts/Vi-Regular.otf");
}
if (str.equals("Bold")) {
return Typeface.createFromAsset(assets, "fonts/Vi-Bold.otf");
}
return null;
}
public String isEmptyDataHandling(String str, String str2) {
return !TextUtils.isEmpty(str) ? str : str2;
}
private boolean isoverlayNotification(Map<String, String> map) {
return map.containsKey("nm") && !map.containsKey("notification") && "20".equals(map.get("wzrk_cid"));
}
public void loadBackground(String str, final RelativeLayout relativeLayout) {
if (TextUtils.isEmpty(str)) {
return;
}
Glide.with(getApplicationContext()).asBitmap().load(str).into(new CustomTarget<Bitmap>() {
public void onLoadCleared(Drawable drawable) {
}
public void onResourceReady(@NonNull Object obj, @Nullable Transition transition) {
onResourceReady((Bitmap) obj, (Transition<? super Bitmap>) transition);
}
public void onResourceReady(@NonNull Bitmap bitmap, @Nullable Transition<? super Bitmap> transition) {
relativeLayout.setBackground(new BitmapDrawable(customMessagingService.this.getResources(), bitmap));
}
});
}
public void loadBanner(String str, ImageView imageView, View view) {
if (TextUtils.isEmpty(str)) {
view.setVisibility(0);
imageView.setVisibility(8);
} else {
view.setVisibility(8);
imageView.setVisibility(0);
Picasso.get().load(str).placeholder(2131233632).error(R.drawable.ic_error).into(imageView);
}
}
public void loadIcon(String str, ImageView imageView) {
if (TextUtils.isEmpty(str)) {
imageView.setVisibility(8);
} else {
imageView.setVisibility(0);
Picasso.get().load(str).placeholder(R.drawable.bell_alert).error(R.drawable.ic_error).into(imageView);
}
}
public void navigateToRecharge(String str) {
Intent intent = new Intent((Context) this, (Class<?>) MainActivity.class);
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
intent.addFlags(268435456);
startActivity(intent);
}
public void sendEventToClevertap(CleverTapAPI cleverTapAPI, String str) {
HashMap hashMap;
hashMap = new HashMap();
String lowerCase = str.toLowerCase();
lowerCase.hashCode();
switch (lowerCase) {
case "recharge":
hashMap.put("Element", "CTA");
cleverTapAPI.pushEvent("AOT_Click", hashMap);
break;
case "popup-appeared":
cleverTapAPI.pushEvent("AOT_PopupAppeared");
break;
case "cross":
hashMap.put("Element", "Cross");
cleverTapAPI.pushEvent("AOT_Click", hashMap);
break;
case "remindmelater":
cleverTapAPI.pushEvent("AOT_RemindMeLater");
break;
}
}
public void setMediaPlayerForSound(Context context) {
MediaPlayer create = MediaPlayer.create(context, R.raw.overlay_sound);
create.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public final void onCompletion(MediaPlayer mediaPlayer) {
mediaPlayer.release();
}
});
create.start();
}
private void showOverlyAlert(Map<String, String> map) {
sendEventToClevertap(this.cleverTapAPI, "popup-appeared");
String str = map.get("back_image");
map.get("back_image_flag");
if (this.isDialogShowing) {
return;
}
new Handler(Looper.getMainLooper()).post(new AnonymousClass1(str, map));
}
public void onMessageReceived(RemoteMessage remoteMessage) {
try {
this.context = getApplicationContext();
if (remoteMessage.getData().containsKey("af-uinstall-tracking") || remoteMessage.getData().isEmpty()) {
return;
}
Map data = remoteMessage.getData();
if (isoverlayNotification(data)) {
this.cleverTapAPI = CleverTapAPI.getDefaultInstance(this.context);
showOverlyAlert(data);
return;
}
Bundle bundle = new Bundle();
for (Map.Entry entry : data.entrySet()) {
bundle.putString((String) entry.getKey(), (String) entry.getValue());
}
if (CleverTapAPI.getNotificationInfo(bundle).fromCleverTap) {
new CTFcmMessageHandler().createNotification(this.context, remoteMessage);
}
} catch (Throwable unused) {
}
}
public void onNewToken(String str) {
super.onNewToken(str);
StringBuilder sb = new StringBuilder();
sb.append("New token: ");
sb.append(str);
}
}