Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package com.helpshift.notification;
/* loaded from: classes3.dex */
public interface CoreNotificationManager {
void cancelNotifications();
void setNotificationChannelId(String str);
void setNotificationIcon(int i);
void setNotificationLargeIcon(int i);
void setNotificationReceivedCallback(NotificationReceivedCallback notificationReceivedCallback);
void setNotificationSoundId(int i);
void showDebugLogNotification();
void showNotification(String str, boolean z);
}

View File

@@ -0,0 +1,71 @@
package com.helpshift.notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import androidx.core.app.NotificationCompat;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import com.facebook.share.internal.ShareConstants;
import com.google.android.gms.drive.DriveFile;
import com.helpshift.HSPluginEventBridge;
import com.helpshift.log.HSLogger;
import com.helpshift.platform.Device;
import com.helpshift.util.ApplicationUtil;
import com.helpshift.util.AssetsUtil;
import com.helpshift.util.Utils;
/* loaded from: classes3.dex */
public abstract class HSNotification {
public static NotificationCompat.Builder createNotification(Context context, Device device, String str, int i, int i2, int i3, Class cls) {
String appName = device.getAppName();
if (!Utils.isNotEmpty(str)) {
str = "";
}
HSLogger.d("SDKXNotif", "Creating Support notification :\n Title : " + appName);
int logoResourceValue = ApplicationUtil.getLogoResourceValue(context);
if (!AssetsUtil.resourceExists(context, i)) {
i = logoResourceValue;
}
Bitmap decodeResource = AssetsUtil.resourceExists(context, i2) ? BitmapFactory.decodeResource(context.getResources(), i2) : null;
Intent intent = new Intent(context, (Class<?>) cls);
intent.putExtra("SERVICE_MODE", "WEBCHAT_SERVICE_FLAG");
intent.putExtra(ShareConstants.FEED_SOURCE_PARAM, "notification");
intent.setFlags(DriveFile.MODE_READ_ONLY);
PendingIntent pendingIntentForNotification = HSPluginEventBridge.getPendingIntentForNotification(context, PendingIntent.getActivity(context, 50, intent, AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL));
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(i);
builder.setContentTitle(appName);
builder.setContentText(str);
builder.setContentIntent(pendingIntentForNotification);
builder.setAutoCancel(true);
if (decodeResource != null) {
builder.setLargeIcon(decodeResource);
}
Uri notificationSoundUri = getNotificationSoundUri(context, i3);
if (notificationSoundUri == null) {
if (ApplicationUtil.isPermissionGranted(context, "android.permission.VIBRATE")) {
builder.setDefaults(-1);
} else {
builder.setDefaults(5);
}
} else {
builder.setSound(notificationSoundUri);
if (ApplicationUtil.isPermissionGranted(context, "android.permission.VIBRATE")) {
builder.setDefaults(6);
} else {
builder.setDefaults(4);
}
}
return builder;
}
public static Uri getNotificationSoundUri(Context context, int i) {
if (i == 0) {
return null;
}
return Uri.parse("android.resource://" + context.getPackageName() + "/" + i);
}
}

View File

@@ -0,0 +1,153 @@
package com.helpshift.notification;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.media.AudioAttributes;
import android.net.Uri;
import androidx.core.app.NotificationCompat;
import com.helpshift.activities.HSDebugActivity;
import com.helpshift.activities.HSMainActivity;
import com.helpshift.concurrency.HSThreadingService;
import com.helpshift.core.HSContext;
import com.helpshift.log.HSLogger;
import com.helpshift.platform.Device;
import com.helpshift.storage.HSPersistentStorage;
import com.helpshift.util.ApplicationUtil;
import com.helpshift.util.Utils;
import java.lang.ref.WeakReference;
/* loaded from: classes3.dex */
public class HSNotificationManager implements CoreNotificationManager {
public Context context;
public Device device;
public WeakReference notificationReceivedCallback;
public HSPersistentStorage persistentStorage;
public HSThreadingService threadingService;
public HSNotificationManager(Context context, Device device, HSPersistentStorage hSPersistentStorage, HSThreadingService hSThreadingService) {
this.context = context;
this.device = device;
this.persistentStorage = hSPersistentStorage;
this.threadingService = hSThreadingService;
}
@Override // com.helpshift.notification.CoreNotificationManager
public void setNotificationChannelId(String str) {
this.persistentStorage.setNotificationChannelId(str);
}
@Override // com.helpshift.notification.CoreNotificationManager
public void setNotificationSoundId(int i) {
this.persistentStorage.setNotificationSoundId(i);
}
@Override // com.helpshift.notification.CoreNotificationManager
public void setNotificationIcon(int i) {
this.persistentStorage.setNotificationIcon(i);
}
@Override // com.helpshift.notification.CoreNotificationManager
public void setNotificationLargeIcon(int i) {
this.persistentStorage.setNotificationLargeIcon(i);
}
@Override // com.helpshift.notification.CoreNotificationManager
public void setNotificationReceivedCallback(NotificationReceivedCallback notificationReceivedCallback) {
this.notificationReceivedCallback = new WeakReference(notificationReceivedCallback);
}
@Override // com.helpshift.notification.CoreNotificationManager
public void showNotification(final String str, boolean z) {
HSContext hSContext = HSContext.getInstance();
if (hSContext.isSdkOpen()) {
this.threadingService.runOnUIThread(new Runnable() { // from class: com.helpshift.notification.HSNotificationManager.1
@Override // java.lang.Runnable
public void run() {
NotificationReceivedCallback notificationReceivedCallback = (NotificationReceivedCallback) HSNotificationManager.this.notificationReceivedCallback.get();
if (notificationReceivedCallback != null) {
notificationReceivedCallback.onNotificationReceived();
}
}
});
} else {
if (hSContext.isWebchatUIOpen()) {
return;
}
if (z || this.persistentStorage.getEnableInAppNotification()) {
this.threadingService.runOnUIThread(new Runnable() { // from class: com.helpshift.notification.HSNotificationManager.2
@Override // java.lang.Runnable
public void run() {
HSNotificationManager.this.showNotificationInternal(str, HSMainActivity.class);
}
});
}
}
}
@Override // com.helpshift.notification.CoreNotificationManager
public void showDebugLogNotification() {
this.threadingService.runOnUIThread(new Runnable() { // from class: com.helpshift.notification.HSNotificationManager.3
@Override // java.lang.Runnable
public void run() {
HSNotificationManager.this.showNotificationInternal("Helpshift Debugger: Tap to share debug logs", HSDebugActivity.class);
}
});
}
public final void showNotificationInternal(String str, Class cls) {
NotificationCompat.Builder createNotification = HSNotification.createNotification(this.context, this.device, str, this.persistentStorage.getNotificationIcon(), this.persistentStorage.getNotificationLargeIcon(), this.persistentStorage.getNotificationSoundId(), cls);
if (createNotification != null) {
Notification attachChannelId = attachChannelId(createNotification.build(), this.context);
HSLogger.d("notifMngr", "Notification built, trying to post now.");
ApplicationUtil.showNotification(this.context, attachChannelId, cls);
}
}
public final Notification attachChannelId(Notification notification, Context context) {
if (ApplicationUtil.getTargetSDKVersion(context) < 26) {
return notification;
}
Notification.Builder recoverBuilder = Notification.Builder.recoverBuilder(context, notification);
recoverBuilder.setChannelId(getActiveNotificationChannel(context));
return recoverBuilder.build();
}
public final String getActiveNotificationChannel(Context context) {
String notificationChannelId = this.persistentStorage.getNotificationChannelId();
if (Utils.isEmpty(notificationChannelId)) {
ensureDefaultNotificationChannelCreated(context);
return "In-app Support";
}
deleteDefaultNotificationChannel(context);
return notificationChannelId;
}
public final void deleteDefaultNotificationChannel(Context context) {
NotificationManager notificationManager = ApplicationUtil.getNotificationManager(context);
if (notificationManager == null || notificationManager.getNotificationChannel("In-app Support") == null) {
return;
}
notificationManager.deleteNotificationChannel("In-app Support");
}
public final void ensureDefaultNotificationChannelCreated(Context context) {
NotificationManager notificationManager = ApplicationUtil.getNotificationManager(context);
if (notificationManager == null || notificationManager.getNotificationChannel("In-app Support") != null) {
return;
}
NotificationChannel notificationChannel = new NotificationChannel("In-app Support", "In-app Support", 3);
notificationChannel.setDescription("");
Uri notificationSoundUri = HSNotification.getNotificationSoundUri(context, this.persistentStorage.getNotificationSoundId());
if (notificationSoundUri != null) {
notificationChannel.setSound(notificationSoundUri, new AudioAttributes.Builder().build());
}
notificationManager.createNotificationChannel(notificationChannel);
}
@Override // com.helpshift.notification.CoreNotificationManager
public void cancelNotifications() {
ApplicationUtil.cancelNotification(this.context);
}
}

View File

@@ -0,0 +1,105 @@
package com.helpshift.notification;
import com.helpshift.chat.HSEventProxy;
import com.helpshift.concurrency.HSThreadingService;
import com.helpshift.log.HSLogger;
import com.helpshift.network.AuthenticationFailureNetwork;
import com.helpshift.network.HSNetwork;
import com.helpshift.network.HSRequestData;
import com.helpshift.network.HSResponse;
import com.helpshift.network.HTTPTransport;
import com.helpshift.network.POSTNetwork;
import com.helpshift.network.exception.HSRootApiException;
import com.helpshift.network.exception.NetworkException;
import com.helpshift.platform.Device;
import com.helpshift.storage.HSGenericDataManager;
import com.helpshift.storage.HSPersistentStorage;
import com.helpshift.util.Utils;
import com.helpshift.util.ValueListener;
import java.util.Map;
/* loaded from: classes3.dex */
public class HSPushTokenManager {
public Device device;
public HSGenericDataManager genericDataManager;
public HSEventProxy hsEventProxy;
public HSThreadingService hsThreadingService;
public HTTPTransport httpTransport;
public HSPersistentStorage persistentStorage;
public HSPushTokenManager(Device device, HSPersistentStorage hSPersistentStorage, HSThreadingService hSThreadingService, HSEventProxy hSEventProxy, HTTPTransport hTTPTransport, HSGenericDataManager hSGenericDataManager) {
this.device = device;
this.persistentStorage = hSPersistentStorage;
this.hsThreadingService = hSThreadingService;
this.hsEventProxy = hSEventProxy;
this.httpTransport = hTTPTransport;
this.genericDataManager = hSGenericDataManager;
}
public void savePushToken(String str) {
this.persistentStorage.setCurrentPushToken(str);
}
public void registerPushTokenWithBackend(String str, Map map, ValueListener valueListener) {
pushTokenRequest(str, map, false, valueListener);
}
public void deregisterPushTokenForUser(Map map, ValueListener valueListener) {
pushTokenRequest("unreg", map, true, valueListener);
}
public final void pushTokenRequest(String str, Map map, boolean z, ValueListener valueListener) {
if (!this.device.isOnline() || Utils.isEmpty(str) || Utils.isEmpty(map)) {
HSLogger.e("pshTknManagr", "Error in syncing push token, preconditions failed.");
return;
}
Map networkHeaders = this.genericDataManager.getNetworkHeaders();
String pushTokenSyncRoute = this.genericDataManager.getPushTokenSyncRoute();
String platformId = this.persistentStorage.getPlatformId();
String deviceId = this.device.getDeviceId();
if (Utils.isEmpty(networkHeaders) || Utils.isEmpty(pushTokenSyncRoute) || Utils.isEmpty(platformId) || Utils.isEmpty(deviceId)) {
HSLogger.e("pshTknManagr", "Error in reading network header and route data");
return;
}
try {
map.put("token", str);
map.put("did", deviceId);
map.put("platform-id", platformId);
makePushTokenRequest(new AuthenticationFailureNetwork(new POSTNetwork(this.httpTransport, pushTokenSyncRoute)), new HSRequestData(networkHeaders, map), z, valueListener);
} catch (Exception e) {
HSLogger.e("pshTknManagr", "Error in syncing push token", e);
}
}
public final void makePushTokenRequest(final HSNetwork hSNetwork, final HSRequestData hSRequestData, final boolean z, final ValueListener valueListener) {
this.hsThreadingService.getNetworkService().submit(new Runnable() { // from class: com.helpshift.notification.HSPushTokenManager.1
@Override // java.lang.Runnable
public void run() {
try {
HSResponse makeRequest = hSNetwork.makeRequest(hSRequestData);
if (z) {
return;
}
int status = makeRequest.getStatus();
valueListener.update(Boolean.valueOf(status >= 200 && status < 300));
} catch (HSRootApiException e) {
if (!z) {
valueListener.update(Boolean.FALSE);
HSRootApiException.ExceptionType exceptionType = e.exceptionType;
if (exceptionType == NetworkException.INVALID_AUTH_TOKEN) {
HSPushTokenManager.this.hsEventProxy.sendAuthFailureEvent("invalid user auth token");
return;
} else {
if (exceptionType == NetworkException.AUTH_TOKEN_NOT_PROVIDED) {
HSPushTokenManager.this.hsEventProxy.sendAuthFailureEvent("missing user auth token");
return;
}
return;
}
}
HSLogger.e("pshTknManagr", "Network error for deregister push token request", e);
}
}
});
}
}

View File

@@ -0,0 +1,6 @@
package com.helpshift.notification;
/* loaded from: classes3.dex */
public interface NotificationReceivedCallback {
void onNotificationReceived();
}

View File

@@ -0,0 +1,65 @@
package com.helpshift.notification;
import com.helpshift.chat.HSEventProxy;
import com.helpshift.concurrency.HSThreadingService;
import com.helpshift.log.HSLogger;
import com.helpshift.poller.FetchNotificationUpdate;
import com.helpshift.storage.HSPersistentStorage;
import com.helpshift.user.UserManager;
import com.mbridge.msdk.newreward.function.common.MBridgeCommon;
import java.util.HashMap;
/* loaded from: classes3.dex */
public class RequestUnreadMessageCountHandler {
public final HSEventProxy eventProxy;
public final FetchNotificationUpdate fetchNotificationUpdate;
public final HSPersistentStorage persistentStorage;
public final HSThreadingService threadingService;
public final UserManager userManager;
public RequestUnreadMessageCountHandler(HSPersistentStorage hSPersistentStorage, FetchNotificationUpdate fetchNotificationUpdate, UserManager userManager, HSEventProxy hSEventProxy, HSThreadingService hSThreadingService) {
this.persistentStorage = hSPersistentStorage;
this.fetchNotificationUpdate = fetchNotificationUpdate;
this.userManager = userManager;
this.eventProxy = hSEventProxy;
this.threadingService = hSThreadingService;
}
public void handleLocalCacheRequest() {
HSLogger.d("rqUnrdCntHdlr", "Serving count from local cache.");
HashMap hashMap = new HashMap();
hashMap.put("count", Integer.valueOf(Math.max(this.userManager.getUnreadNotificationCount(), this.userManager.getPushUnreadNotificationCount())));
hashMap.put("fromCache", Boolean.TRUE);
this.eventProxy.sendEvent("receivedUnreadMessageCount", hashMap);
}
public void handleRemoteRequest() {
long currentTimeMillis = System.currentTimeMillis();
long lastRequestUnreadCountApiAccess = this.persistentStorage.getLastRequestUnreadCountApiAccess();
int i = this.userManager.shouldPoll() ? MBridgeCommon.DEFAULT_LOAD_TIMEOUT : 300000;
if (lastRequestUnreadCountApiAccess != 0 && currentTimeMillis - lastRequestUnreadCountApiAccess < i) {
handleLocalCacheRequest();
return;
}
this.persistentStorage.setLastRequestUnreadCountApiAccess(currentTimeMillis);
HSLogger.d("rqUnrdCntHdlr", "Fetching unread count from remote.");
this.threadingService.getNetworkService().submit(new Runnable() { // from class: com.helpshift.notification.RequestUnreadMessageCountHandler.1
@Override // java.lang.Runnable
public void run() {
try {
int execute = RequestUnreadMessageCountHandler.this.fetchNotificationUpdate.execute();
boolean z = false;
if (execute >= 200 && execute < 300) {
z = true;
}
HashMap hashMap = new HashMap();
hashMap.put("count", Integer.valueOf(RequestUnreadMessageCountHandler.this.userManager.getUnreadNotificationCount()));
hashMap.put("fromCache", Boolean.valueOf(!z));
RequestUnreadMessageCountHandler.this.eventProxy.sendEvent("receivedUnreadMessageCount", hashMap);
} catch (Exception e) {
HSLogger.e("rqUnrdCntHdlr", "Error in fetching unread count from remote", e);
}
}
});
}
}