Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
package com.unity3d.ads.broadcast;
/* loaded from: classes2.dex */
public enum BroadcastError {
JSON_ERROR
}

View File

@@ -0,0 +1,6 @@
package com.unity3d.ads.broadcast;
/* loaded from: classes2.dex */
public enum BroadcastEvent {
ACTION
}

View File

@@ -0,0 +1,45 @@
package com.unity3d.ads.broadcast;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.unity3d.ads.log.DeviceLog;
import com.unity3d.ads.webview.WebViewApp;
import com.unity3d.ads.webview.WebViewEventCategory;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class BroadcastEventReceiver extends BroadcastReceiver {
private String _name;
public BroadcastEventReceiver(String str) {
this._name = str;
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action == null) {
return;
}
String dataString = intent.getDataString() != null ? intent.getDataString() : "";
JSONObject jSONObject = new JSONObject();
try {
if (intent.getExtras() != null) {
Bundle extras = intent.getExtras();
for (String str : extras.keySet()) {
jSONObject.put(str, extras.get(str));
}
}
} catch (JSONException e) {
DeviceLog.debug("JSONException when composing extras for broadcast action " + action + ": " + e.getMessage());
}
WebViewApp currentApp = WebViewApp.getCurrentApp();
if (currentApp == null || !currentApp.isWebAppLoaded()) {
return;
}
currentApp.sendEvent(WebViewEventCategory.BROADCAST, BroadcastEvent.ACTION, this._name, action, dataString, jSONObject);
}
}

View File

@@ -0,0 +1,49 @@
package com.unity3d.ads.broadcast;
import android.content.IntentFilter;
import com.unity3d.ads.properties.ClientProperties;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes2.dex */
public class BroadcastMonitor {
private static Map<String, BroadcastEventReceiver> _eventReceivers;
public static void addBroadcastListener(String str, String str2, String[] strArr) {
removeBroadcastListener(str);
IntentFilter intentFilter = new IntentFilter();
for (String str3 : strArr) {
intentFilter.addAction(str3);
}
if (str2 != null) {
intentFilter.addDataScheme(str2);
}
if (_eventReceivers == null) {
_eventReceivers = new HashMap();
}
BroadcastEventReceiver broadcastEventReceiver = new BroadcastEventReceiver(str);
_eventReceivers.put(str, broadcastEventReceiver);
ClientProperties.getApplicationContext().registerReceiver(broadcastEventReceiver, intentFilter);
}
public static void removeAllBroadcastListeners() {
Map<String, BroadcastEventReceiver> map = _eventReceivers;
if (map != null) {
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
ClientProperties.getApplicationContext().unregisterReceiver(_eventReceivers.get(it.next()));
}
_eventReceivers = null;
}
}
public static void removeBroadcastListener(String str) {
Map<String, BroadcastEventReceiver> map = _eventReceivers;
if (map == null || !map.containsKey(str)) {
return;
}
ClientProperties.getApplicationContext().unregisterReceiver(_eventReceivers.get(str));
_eventReceivers.remove(str);
}
}