- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
73 lines
3.1 KiB
Java
73 lines
3.1 KiB
Java
package csdk.glucustomersupport.eventbus;
|
|
|
|
import csdk.glucustomersupport.IGluCustomerSupport;
|
|
import csdk.glucustomersupport.eventbus.GluEventBus;
|
|
import csdk.glucustomersupport.util.ConfigUtil;
|
|
import csdk.glucustomersupport.util.GluUtil;
|
|
import java.util.Arrays;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class GluEventHandler implements GluEventBus.IEventHandler {
|
|
private static final String CHANNEL_LIFECYCLE_EVT = "#lifecycle.evt";
|
|
private static final String CHANNEL_SDK = "#csdk.gluCustomerSupport";
|
|
private static final String CHANNEL_SDK_EVT = "#csdk.gluCustomerSupport.evt";
|
|
private static final String ID_HANDLER = "@csdk.gluCustomerSupport";
|
|
private final GluEventBus mEventBus;
|
|
private final IGluCustomerSupport mInstance;
|
|
private Object mToken;
|
|
|
|
public static GluEventHandler subscribe(GluEventBus gluEventBus, Object obj, IGluCustomerSupport iGluCustomerSupport) {
|
|
GluEventHandler gluEventHandler = new GluEventHandler(gluEventBus, iGluCustomerSupport);
|
|
gluEventHandler.mToken = gluEventBus.subscribe(obj, ID_HANDLER, Arrays.asList(CHANNEL_SDK, CHANNEL_LIFECYCLE_EVT), gluEventHandler);
|
|
return gluEventHandler;
|
|
}
|
|
|
|
private GluEventHandler(GluEventBus gluEventBus, IGluCustomerSupport iGluCustomerSupport) {
|
|
this.mEventBus = gluEventBus;
|
|
this.mInstance = iGluCustomerSupport;
|
|
}
|
|
|
|
public void sendAnalyticsEvent(String str, Map<String, Object> map) {
|
|
Map createMap = GluUtil.createMap();
|
|
createMap.put("st2", str);
|
|
createMap.put("data", map);
|
|
this.mEventBus.publish(this.mToken, new GluEventBus.Event("#csdk.gluCentralServices.evt", "logCareEvent", null, createMap));
|
|
}
|
|
|
|
public void onInit(String str) {
|
|
Map createMap = GluUtil.createMap();
|
|
createMap.put("name", "GluCustomerSupport");
|
|
createMap.put("version", str);
|
|
this.mEventBus.publish(this.mToken, new GluEventBus.Event("#sdk.evt", "initialized", null, createMap));
|
|
}
|
|
|
|
public void onDestroy() {
|
|
Map createMap = GluUtil.createMap();
|
|
createMap.put("name", "GluCustomerSupport");
|
|
this.mEventBus.publish(this.mToken, new GluEventBus.Event("#sdk.evt", "destroyed", null, createMap));
|
|
this.mEventBus.unsubscribe(this.mToken);
|
|
}
|
|
|
|
@Override // csdk.glucustomersupport.eventbus.GluEventBus.IEventHandler
|
|
public void handleEvent(GluEventBus gluEventBus, Object obj, String str, GluEventBus.Event event) {
|
|
Map<String, ?> map = event.data;
|
|
if (CHANNEL_SDK.equals(event.channel)) {
|
|
String str2 = event.action;
|
|
str2.hashCode();
|
|
switch (str2) {
|
|
case "updateGDPRConsentStatus":
|
|
this.mInstance.setConsentFlags(map);
|
|
return;
|
|
case "setPushToken":
|
|
this.mInstance.setPushToken(ConfigUtil.getString(map, "val"));
|
|
return;
|
|
case "destroy":
|
|
return;
|
|
default:
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
}
|
|
}
|
|
}
|