package cn.jpush.android.helper; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import cn.jpush.android.api.CmdMessage; import cn.jpush.android.api.CustomMessage; import cn.jpush.android.api.JPushInterface; import cn.jpush.android.api.JPushMessage; import cn.jpush.android.api.NotificationMessage; import cn.jpush.android.d.b; import cn.jpush.android.local.JPushConstants; import cn.jpush.android.s.c; import cn.jpush.android.service.JPushMessageReceiver; import cn.jpush.android.u.e; import com.baidu.speech.utils.AsrError; import java.util.Iterator; import java.util.List; import java.util.Locale; public class a { private static a a; /* renamed from: cn.jpush.android.helper.a$a reason: collision with other inner class name */ private class C0010a extends e { private Context b; private JPushMessageReceiver c; private Intent d; public C0010a(Context context, JPushMessageReceiver jPushMessageReceiver, Intent intent) { this.b = context; this.c = jPushMessageReceiver; this.d = intent; this.e = "JMessageReceiverHelper#MessageReceiverRunable"; } @Override // cn.jpush.android.u.e public void a() { String str; String str2; try { if (this.d == null) { Logger.w("JMessageReceiverHelper", "intent was null"); return; } String action = this.d.getAction(); Logger.d("JMessageReceiverHelper", "do receiver action :" + action); if (action == null) { Logger.w("JMessageReceiverHelper", "unsupport action type"); return; } if (action.equals("cn.jpush.android.intent.RECEIVE_MESSAGE")) { int intExtra = this.d.getIntExtra("message_type", -1); JPushMessage jPushMessage = null; if (1 == intExtra || 2 == intExtra) { jPushMessage = c.a().a(this.b, this.d); } Logger.d("JMessageReceiverHelper", "messageType:" + intExtra + ",jPushMessage:" + jPushMessage); if (jPushMessage == null) { Logger.w("JMessageReceiverHelper", "parse tagalias message failed"); return; } else if (intExtra == 1) { if (jPushMessage.isTagCheckOperator()) { this.c.onCheckTagOperatorResult(this.b, jPushMessage); return; } else { this.c.onTagOperatorResult(this.b, jPushMessage); return; } } else if (intExtra == 2) { this.c.onAliasOperatorResult(this.b, jPushMessage); return; } else { str = "JMessageReceiverHelper"; str2 = "unsupport message type"; } } else if (action.equals("mobile_result")) { this.c.onMobileNumberOperatorResult(this.b, d.a().a(this.b, this.d)); return; } else if (action.equals(cn.jpush.android.u.a.e(this.b, "custom_msg"))) { this.c.onMessage(this.b, b.a(this.d)); return; } else if (action.equals(cn.jpush.android.u.a.e(this.b, "cmd_msg"))) { a.a(this.c, this.b, this.d); return; } else if (action.equals("cn.jpush.android.intent.NOTIFICATION_ARRIVED")) { this.c.onNotifyMessageArrived(this.b, cn.jpush.android.p.b.b(this.b, this.d)); return; } else if (action.equals("cn.jpush.android.intent.NOTIFICATION_UN_SHOW")) { try { this.c.onNotifyMessageUnShow(this.b, cn.jpush.android.p.b.b(this.b, this.d)); return; } catch (Throwable unused) { return; } } else if (action.equals(JPushInterface.ACTION_NOTIFICATION_OPENED)) { this.c.onNotifyMessageOpened(this.b, cn.jpush.android.p.b.b(this.b, this.d)); return; } else if (action.equals("cn.jpush.android.intent.NOTIFICATION_DISMISS")) { this.c.onNotifyMessageDismiss(this.b, cn.jpush.android.p.b.b(this.b, this.d)); return; } else if (JPushInterface.ACTION_NOTIFICATION_CLICK_ACTION_PROXY.equals(this.d.getAction())) { Intent intent = new Intent(JPushInterface.ACTION_NOTIFICATION_CLICK_ACTION); if (this.d.getExtras() != null) { intent.putExtras(this.d.getExtras()); } this.c.onMultiActionClicked(this.b, intent); return; } else if ("on_noti_settings_check".equals(action)) { this.c.onNotificationSettingsCheck(this.b, this.d.getBooleanExtra("isOn", false), this.d.getIntExtra("source", 0)); return; } else { str = "JMessageReceiverHelper"; str2 = "unsupport action type"; } Logger.w(str, str2); } catch (Throwable th) { Logger.ww("JMessageReceiverHelper", "MessageReceiver run failed:" + th.getMessage()); } } } private a() { } public static a a() { if (a == null) { synchronized (a.class) { if (a == null) { a = new a(); } } } return a; } public static void a(Context context, Intent intent) { try { Logger.i("JMessageReceiverHelper", "Click notification action with extra: " + intent.getExtras().getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA)); Intent intent2 = new Intent(JPushInterface.ACTION_NOTIFICATION_CLICK_ACTION); intent2.putExtras(intent.getExtras()); intent2.addCategory(context.getPackageName()); intent2.setPackage(context.getPackageName()); context.sendBroadcast(intent2, context.getPackageName() + JPushInterface.PUSH_MESSAGE_PERMISSION_POSTFIX); } catch (Throwable th) { Logger.ww("JMessageReceiverHelper", "Click notification sendBroadcast :" + th.getMessage()); } } public static void a(Context context, CustomMessage customMessage) { if (context == null || customMessage == null) { Logger.dd("JMessageReceiverHelper", "Send custom message to app failed, param is invalid!"); return; } Logger.dd("JMessageReceiverHelper", "not found user push message,use old action to user"); Intent intent = new Intent(JPushInterface.ACTION_MESSAGE_RECEIVED); intent.putExtra(JPushInterface.EXTRA_APP_KEY, customMessage.senderId); intent.putExtra(JPushInterface.EXTRA_MESSAGE, customMessage.message); intent.putExtra(JPushInterface.EXTRA_CONTENT_TYPE, customMessage.contentType); intent.putExtra(JPushInterface.EXTRA_TITLE, customMessage.title); intent.putExtra(JPushInterface.EXTRA_EXTRA, customMessage.extra); intent.putExtra(JPushInterface.EXTRA_MSG_ID, customMessage.messageId); intent.addCategory(customMessage.appId); intent.setPackage(context.getPackageName()); context.sendBroadcast(intent, String.format(Locale.ENGLISH, "%s.permission.JPUSH_MESSAGE", customMessage.appId)); Logger.i("JMessageReceiverHelper", "Send broadcast to app: " + String.format(Locale.ENGLISH, "%s.permission.JPUSH_MESSAGE", customMessage.appId)); } /* JADX WARNING: Removed duplicated region for block: B:41:0x00d7 A[Catch:{ Throwable -> 0x01d7 }] */ /* JADX WARNING: Removed duplicated region for block: B:44:0x00f7 A[Catch:{ Throwable -> 0x01d7 }] */ /* JADX WARNING: Removed duplicated region for block: B:47:0x0106 A[Catch:{ Throwable -> 0x01d7 }] */ /* JADX WARNING: Removed duplicated region for block: B:50:0x0115 A[Catch:{ Throwable -> 0x01d7 }] */ /* JADX WARNING: Removed duplicated region for block: B:53:0x0124 A[Catch:{ Throwable -> 0x01d7 }] */ /* JADX WARNING: Removed duplicated region for block: B:56:0x012f A[Catch:{ Throwable -> 0x01d7 }] */ public static void a(Context context, NotificationMessage notificationMessage, String str) { String str2; String str3; if (context == null || notificationMessage == null || TextUtils.isEmpty(str)) { Logger.dd("JMessageReceiverHelper", "Send broad cast to app failed,the params are incorrect!"); return; } Intent intent = new Intent(str); try { if (str.equals(JPushInterface.ACTION_NOTIFICATION_OPENED)) { List<String> b = cn.jpush.android.u.a.b(context, intent, notificationMessage.appId + JPushInterface.PUSH_MESSAGE_PERMISSION_POSTFIX); if (b == null || b.isEmpty()) { Logger.dd("JMessageReceiverHelper", "not found receiver by action:cn.jpush.android.intent.NOTIFICATION_OPENED,will start main activity"); cn.jpush.android.u.a.e(context); return; } } } catch (Throwable unused) { } try { Logger.dd("JMessageReceiverHelper", "Send push received broadcast to developer defined receiver"); Bundle bundle = new Bundle(); bundle.putString(JPushInterface.EXTRA_MSG_ID, notificationMessage.msgId); bundle.putInt(JPushInterface.EXTRA_NOTIFICATION_ID, notificationMessage.notificationId); bundle.putString(JPushInterface.EXTRA_ALERT, notificationMessage.notificationContent); bundle.putString(JPushInterface.EXTRA_ALERT_TYPE, notificationMessage.notificationAlertType + ""); if (!TextUtils.isEmpty(notificationMessage.notificationTitle)) { bundle.putString(JPushInterface.EXTRA_NOTIFICATION_TITLE, notificationMessage.notificationTitle); } if (!TextUtils.isEmpty(notificationMessage.notificationExtras)) { bundle.putString(JPushInterface.EXTRA_EXTRA, notificationMessage.notificationExtras); } if (notificationMessage.notificationStyle == 1 && !TextUtils.isEmpty(notificationMessage.notificationBigText)) { str2 = JPushInterface.EXTRA_BIG_TEXT; str3 = notificationMessage.notificationBigText; } else if (notificationMessage.notificationStyle != 2 || TextUtils.isEmpty(notificationMessage.notificationInbox)) { if (notificationMessage.notificationStyle == 3 && !TextUtils.isEmpty(notificationMessage.notificationBigPicPath)) { str2 = JPushInterface.EXTRA_BIG_PIC_PATH; str3 = notificationMessage.notificationBigPicPath; } if (notificationMessage.notificationPriority != 0) { bundle.putString(JPushInterface.EXTRA_NOTI_PRIORITY, notificationMessage.notificationPriority + ""); } if (!TextUtils.isEmpty(notificationMessage.notificationCategory)) { bundle.putString(JPushInterface.EXTRA_NOTI_CATEGORY, notificationMessage.notificationCategory); } if (!TextUtils.isEmpty(notificationMessage.notificationSmallIcon)) { bundle.putString(JPushInterface.EXTRA_NOTIFICATION_SMALL_ICON, notificationMessage.notificationSmallIcon); } if (!TextUtils.isEmpty(notificationMessage.notificationLargeIcon)) { bundle.putString(JPushInterface.EXTRA_NOTIFICATION_LARGET_ICON, notificationMessage.notificationLargeIcon); } if (!TextUtils.isEmpty(notificationMessage.developerArg0)) { intent.putExtra(JPushInterface.EXTRA_NOTIFICATION_DEVELOPER_ARG0, notificationMessage.developerArg0); } if (notificationMessage.isRichPush) { if (!(notificationMessage.richType == 0 || notificationMessage.richType == 4 || notificationMessage._webPagePath == null || !notificationMessage._webPagePath.startsWith("file://"))) { notificationMessage._webPagePath = notificationMessage._webPagePath.replaceFirst("file://", ""); intent.putExtra(JPushInterface.EXTRA_RICHPUSH_HTML_PATH, notificationMessage._webPagePath); } if (notificationMessage.showResourceList != null && notificationMessage.showResourceList.size() > 0) { StringBuilder sb = new StringBuilder(); String c = cn.jpush.android.u.c.c(context, notificationMessage.msgId); Iterator<String> it = notificationMessage.showResourceList.iterator(); while (it.hasNext()) { String next = it.next(); if (next.startsWith(JPushConstants.HTTP_PRE)) { next = cn.jpush.android.u.c.b(next); } if (TextUtils.isEmpty(sb.toString())) { sb.append(c); } else { sb.append(","); sb.append(c); } sb.append(next); } intent.putExtra(JPushInterface.EXTRA_RICHPUSH_HTML_RES, sb.toString()); } } intent.putExtras(bundle); intent.addCategory(notificationMessage.appId); intent.setPackage(context.getPackageName()); context.sendBroadcast(intent, notificationMessage.appId + JPushInterface.PUSH_MESSAGE_PERMISSION_POSTFIX); } else { str2 = JPushInterface.EXTRA_INBOX; str3 = notificationMessage.notificationInbox; } bundle.putString(str2, str3); if (notificationMessage.notificationPriority != 0) { } if (!TextUtils.isEmpty(notificationMessage.notificationCategory)) { } if (!TextUtils.isEmpty(notificationMessage.notificationSmallIcon)) { } if (!TextUtils.isEmpty(notificationMessage.notificationLargeIcon)) { } if (!TextUtils.isEmpty(notificationMessage.developerArg0)) { } if (notificationMessage.isRichPush) { } intent.putExtras(bundle); intent.addCategory(notificationMessage.appId); intent.setPackage(context.getPackageName()); context.sendBroadcast(intent, notificationMessage.appId + JPushInterface.PUSH_MESSAGE_PERMISSION_POSTFIX); } catch (Throwable th) { Logger.ww("JMessageReceiverHelper", "sendNotificationReceivedBroadcast error:" + th.getMessage()); cn.jpush.android.u.a.a(context, intent, notificationMessage.appId + JPushInterface.PUSH_MESSAGE_PERMISSION_POSTFIX); } } public static void a(JPushMessageReceiver jPushMessageReceiver, Context context, Intent intent) { CmdMessage cmdMessage; try { int intExtra = intent.getIntExtra("code", -2); int intExtra2 = intent.getIntExtra("cmd", -2); String stringExtra = intent.getStringExtra("message"); Logger.d("JMessageReceiverHelper", "[callCmdMessage] code:" + intExtra + ",cmd:" + intExtra2 + ",message:" + stringExtra); Bundle extras = intent.getExtras(); if (intExtra2 == -1) { jPushMessageReceiver.onConnected(context, false); return; } if (intExtra2 == 0) { if (intExtra == 0) { jPushMessageReceiver.onRegister(context, stringExtra); return; } cmdMessage = new CmdMessage(intExtra2, intExtra, stringExtra, extras); } else if (intExtra2 == 1) { jPushMessageReceiver.onConnected(context, true); return; } else if (intExtra2 != 2001) { if (intExtra2 != 10000) { switch (intExtra2) { case AsrError.ERROR_NETWORK_FAIL_READ_UP /*{ENCODED_INT: 2003}*/: case AsrError.ERROR_NETWORK_FAIL_CONNECT_DOWN /*{ENCODED_INT: 2004}*/: case AsrError.ERROR_NETWORK_FAIL_READ_DOWN /*{ENCODED_INT: 2005}*/: case AsrError.ERROR_NETWORK_FAIL_DATA_DOWN /*{ENCODED_INT: 2006}*/: case 2007: break; default: switch (intExtra2) { case 100001: case 100002: case 100003: case 100004: case 100005: break; default: Logger.dd("JMessageReceiverHelper", "unkown cmd:" + intExtra2); return; } } } cmdMessage = new CmdMessage(intExtra2, intExtra, stringExtra, extras); } else { return; } jPushMessageReceiver.onCommandResult(context, cmdMessage); } catch (Throwable th) { Logger.e("JMessageReceiverHelper", "callCmdMessage failed:" + th.getMessage()); } } public void a(Context context, JPushMessageReceiver jPushMessageReceiver, Intent intent) { JCoreHelper.majorExecutor(context, "JMessageReceiverHelper", new C0010a(context, jPushMessageReceiver, intent)); } }