- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
241 lines
11 KiB
Java
241 lines
11 KiB
Java
package com.helpshift.core;
|
|
|
|
import android.content.Context;
|
|
import com.helpshift.analytics.HSAnalyticsEventDM;
|
|
import com.helpshift.analytics.HSWebchatAnalyticsManager;
|
|
import com.helpshift.cache.ChatResourceEvictStrategy;
|
|
import com.helpshift.cache.HCResourceCacheEvictStrategy;
|
|
import com.helpshift.cache.HelpcenterCacheEvictionManager;
|
|
import com.helpshift.cache.HelpshiftResourceCacheManager;
|
|
import com.helpshift.cache.ResourceCacheEvictStrategy;
|
|
import com.helpshift.chat.HSEventProxy;
|
|
import com.helpshift.concurrency.HSThreadingService;
|
|
import com.helpshift.concurrency.HSUIThreader;
|
|
import com.helpshift.concurrency.HSWorkerThreader;
|
|
import com.helpshift.config.HSConfigManager;
|
|
import com.helpshift.migrator.MigrationFailureLogProvider;
|
|
import com.helpshift.migrator.NativeToSdkxMigrator;
|
|
import com.helpshift.network.HSDownloaderNetwork;
|
|
import com.helpshift.network.HSHttpTransport;
|
|
import com.helpshift.network.HTTPTransport;
|
|
import com.helpshift.network.URLConnectionProvider;
|
|
import com.helpshift.notification.CoreNotificationManager;
|
|
import com.helpshift.notification.HSNotificationManager;
|
|
import com.helpshift.notification.HSPushTokenManager;
|
|
import com.helpshift.notification.RequestUnreadMessageCountHandler;
|
|
import com.helpshift.platform.Device;
|
|
import com.helpshift.poller.ConversationPoller;
|
|
import com.helpshift.poller.ExponentialBackoff;
|
|
import com.helpshift.poller.FetchNotificationUpdate;
|
|
import com.helpshift.poller.PollerController;
|
|
import com.helpshift.storage.HSGenericDataManager;
|
|
import com.helpshift.storage.HSPersistentStorage;
|
|
import com.helpshift.storage.SharedPreferencesStore;
|
|
import com.helpshift.user.UserManager;
|
|
import com.helpshift.util.SdkURLs;
|
|
import com.mbridge.msdk.newreward.function.common.MBridgeCommon;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
import java.util.concurrent.ThreadFactory;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class HSContext {
|
|
public static AtomicBoolean installCallSuccessful = new AtomicBoolean(false);
|
|
public static HSContext instance;
|
|
public HSAnalyticsEventDM analyticsEventDM;
|
|
public HSWebchatAnalyticsManager analyticsManager;
|
|
public HelpshiftResourceCacheManager chatResourceCacheManager;
|
|
public HSConfigManager configManager;
|
|
public final Context context;
|
|
public ConversationPoller conversationPoller;
|
|
public Device device;
|
|
public HSGenericDataManager genericDataManager;
|
|
public HelpcenterCacheEvictionManager helpcenterCacheEvictionManager;
|
|
public HelpshiftResourceCacheManager helpcenterResourceCacheManager;
|
|
public HSEventProxy hsEventProxy;
|
|
public HSThreadingService hsThreadingService = new HSThreadingService(new HSWorkerThreader(Executors.newFixedThreadPool(2)), new HSWorkerThreader(Executors.newSingleThreadExecutor()), new HSUIThreader());
|
|
public HTTPTransport httpTransport;
|
|
public boolean isSDKLoggingEnabled;
|
|
public boolean isSdkOpen;
|
|
public boolean isWebchatOpen;
|
|
public boolean isWebchatOpenedFromHelpcenter;
|
|
public HSJSGenerator jsGenerator;
|
|
public final NativeToSdkxMigrator nativeToSdkxMigrator;
|
|
public CoreNotificationManager notificationManager;
|
|
public HSPersistentStorage persistentStorage;
|
|
public HSPushTokenManager pushTokenManager;
|
|
public RequestUnreadMessageCountHandler requestUnreadMessageCountHandler;
|
|
public ScheduledThreadPoolExecutor scheduledThreadPoolExecutor;
|
|
public UserManager userManager;
|
|
|
|
public static HSContext getInstance() {
|
|
return instance;
|
|
}
|
|
|
|
public HSAnalyticsEventDM getAnalyticsEventDM() {
|
|
return this.analyticsEventDM;
|
|
}
|
|
|
|
public HSConfigManager getConfigManager() {
|
|
return this.configManager;
|
|
}
|
|
|
|
public ConversationPoller getConversationPoller() {
|
|
return this.conversationPoller;
|
|
}
|
|
|
|
public Device getDevice() {
|
|
return this.device;
|
|
}
|
|
|
|
public HSGenericDataManager getGenericDataManager() {
|
|
return this.genericDataManager;
|
|
}
|
|
|
|
public HSEventProxy getHsEventProxy() {
|
|
return this.hsEventProxy;
|
|
}
|
|
|
|
public HSThreadingService getHsThreadingService() {
|
|
return this.hsThreadingService;
|
|
}
|
|
|
|
public HSJSGenerator getJsGenerator() {
|
|
return this.jsGenerator;
|
|
}
|
|
|
|
public NativeToSdkxMigrator getNativeToSdkxMigrator() {
|
|
return this.nativeToSdkxMigrator;
|
|
}
|
|
|
|
public CoreNotificationManager getNotificationManager() {
|
|
return this.notificationManager;
|
|
}
|
|
|
|
public HSPersistentStorage getPersistentStorage() {
|
|
return this.persistentStorage;
|
|
}
|
|
|
|
public RequestUnreadMessageCountHandler getRequestUnreadMessageCountHandler() {
|
|
return this.requestUnreadMessageCountHandler;
|
|
}
|
|
|
|
public UserManager getUserManager() {
|
|
return this.userManager;
|
|
}
|
|
|
|
public HSWebchatAnalyticsManager getWebchatAnalyticsManager() {
|
|
return this.analyticsManager;
|
|
}
|
|
|
|
public boolean isIsWebchatOpenedFromHelpcenter() {
|
|
return this.isWebchatOpenedFromHelpcenter;
|
|
}
|
|
|
|
public boolean isSDKLoggingEnabled() {
|
|
return this.isSDKLoggingEnabled;
|
|
}
|
|
|
|
public boolean isSdkOpen() {
|
|
return this.isSdkOpen;
|
|
}
|
|
|
|
public boolean isWebchatUIOpen() {
|
|
return this.isWebchatOpen;
|
|
}
|
|
|
|
public void setIsWebchatOpenedFromHelpcenter(boolean z) {
|
|
this.isWebchatOpenedFromHelpcenter = z;
|
|
}
|
|
|
|
public void setSDKLoggingEnabled(boolean z) {
|
|
this.isSDKLoggingEnabled = z;
|
|
}
|
|
|
|
public void setSdkIsOpen(boolean z) {
|
|
this.isSdkOpen = z;
|
|
}
|
|
|
|
public void setWebchatUIIsOpen(boolean z) {
|
|
this.isWebchatOpen = z;
|
|
}
|
|
|
|
public static synchronized void initInstance(Context context) {
|
|
synchronized (HSContext.class) {
|
|
if (instance == null) {
|
|
instance = new HSContext(context);
|
|
}
|
|
}
|
|
}
|
|
|
|
public HSContext(Context context) {
|
|
this.context = context;
|
|
this.persistentStorage = new HSPersistentStorage(new SharedPreferencesStore(context, "__hs_lite_sdk_store", 0));
|
|
this.nativeToSdkxMigrator = new NativeToSdkxMigrator(context, this.persistentStorage);
|
|
}
|
|
|
|
public void initialiseComponents(Context context) {
|
|
this.scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1, new ThreadFactory() { // from class: com.helpshift.core.HSContext.1
|
|
@Override // java.util.concurrent.ThreadFactory
|
|
public Thread newThread(Runnable runnable) {
|
|
return new Thread(runnable, "hs_notif_poller");
|
|
}
|
|
});
|
|
AndroidDevice androidDevice = new AndroidDevice(context, this.persistentStorage);
|
|
this.device = androidDevice;
|
|
this.notificationManager = new HSNotificationManager(context, androidDevice, this.persistentStorage, this.hsThreadingService);
|
|
this.genericDataManager = new HSGenericDataManager(this.persistentStorage);
|
|
this.httpTransport = new HSHttpTransport();
|
|
this.analyticsManager = new HSWebchatAnalyticsManager(this.persistentStorage, this.device);
|
|
HSEventProxy hSEventProxy = new HSEventProxy(this.hsThreadingService);
|
|
this.hsEventProxy = hSEventProxy;
|
|
HSPushTokenManager hSPushTokenManager = new HSPushTokenManager(this.device, this.persistentStorage, this.hsThreadingService, hSEventProxy, this.httpTransport, this.genericDataManager);
|
|
this.pushTokenManager = hSPushTokenManager;
|
|
UserManager userManager = new UserManager(this.persistentStorage, hSPushTokenManager, this.genericDataManager, this.hsThreadingService, this.notificationManager);
|
|
this.userManager = userManager;
|
|
this.configManager = new HSConfigManager(this.persistentStorage, this.analyticsManager, this.device, userManager);
|
|
FetchNotificationUpdate fetchNotificationUpdate = new FetchNotificationUpdate(this.device, this.persistentStorage, this.genericDataManager, this.userManager, this.notificationManager, this.httpTransport, this.hsEventProxy);
|
|
ConversationPoller conversationPoller = new ConversationPoller(new PollerController(fetchNotificationUpdate, this.userManager, new ExponentialBackoff(5000, MBridgeCommon.DEFAULT_LOAD_TIMEOUT), this.scheduledThreadPoolExecutor), this.userManager);
|
|
this.conversationPoller = conversationPoller;
|
|
this.userManager.setConversationPoller(conversationPoller);
|
|
this.userManager.setFetchNotificationUpdateFunction(fetchNotificationUpdate);
|
|
this.analyticsEventDM = new HSAnalyticsEventDM(this.device, this.userManager, this.persistentStorage, this.analyticsManager, this.hsThreadingService, this.httpTransport);
|
|
this.jsGenerator = new HSJSGenerator(this.configManager);
|
|
this.requestUnreadMessageCountHandler = new RequestUnreadMessageCountHandler(this.persistentStorage, fetchNotificationUpdate, this.userManager, this.hsEventProxy, this.hsThreadingService);
|
|
}
|
|
|
|
public HelpshiftResourceCacheManager getChatResourceCacheManager() {
|
|
if (this.chatResourceCacheManager == null) {
|
|
this.chatResourceCacheManager = getHelpshiftResourceCacheManager(new SharedPreferencesStore(this.context, "__hs_chat_resource_cache", 0), new ChatResourceEvictStrategy(), SdkURLs.AWS_CACHE_URLS_CONFIG, "chat_cacheURLs", "webchat");
|
|
}
|
|
return this.chatResourceCacheManager;
|
|
}
|
|
|
|
public HelpshiftResourceCacheManager getHelpcenterResourceCacheManager() {
|
|
if (this.helpcenterResourceCacheManager == null) {
|
|
this.helpcenterResourceCacheManager = getHelpshiftResourceCacheManager(new SharedPreferencesStore(this.context, "__hs_helpcenter_resource_cache", 0), new HCResourceCacheEvictStrategy(), SdkURLs.HC_CACHE_URLS_CONFIG, "helpcenter_cacheURLs", "helpcenter");
|
|
}
|
|
return this.helpcenterResourceCacheManager;
|
|
}
|
|
|
|
public HelpcenterCacheEvictionManager getHelpcenterCacheEvictionManager() {
|
|
if (this.helpcenterCacheEvictionManager == null) {
|
|
this.helpcenterCacheEvictionManager = new HelpcenterCacheEvictionManager(this.persistentStorage, this.context.getCacheDir().getAbsolutePath(), "helpcenter");
|
|
}
|
|
return this.helpcenterCacheEvictionManager;
|
|
}
|
|
|
|
public final HelpshiftResourceCacheManager getHelpshiftResourceCacheManager(SharedPreferencesStore sharedPreferencesStore, ResourceCacheEvictStrategy resourceCacheEvictStrategy, String str, String str2, String str3) {
|
|
return new HelpshiftResourceCacheManager(sharedPreferencesStore, new HSDownloaderNetwork(new URLConnectionProvider()), resourceCacheEvictStrategy, this.context.getCacheDir().getAbsolutePath(), str, str2, str3);
|
|
}
|
|
|
|
public void sendMigrationFailureLogs() {
|
|
new MigrationFailureLogProvider(this.context, this.httpTransport, this.persistentStorage, this.device, this.hsThreadingService).sendMigrationFailureLogs();
|
|
}
|
|
|
|
public static boolean verifyInstall() {
|
|
return installCallSuccessful.get();
|
|
}
|
|
}
|