Skip to content

Commit f7b50bb

Browse files
Merge pull request #103 from appodeal/release/3.5.2
[APDM-1127] Release Appodeal Unity Plugin v3.5.2
2 parents a1e3a22 + bd04fce commit f7b50bb

File tree

14 files changed

+2253
-262
lines changed

14 files changed

+2253
-262
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
*The full changelog can always be obtained at [Appodeal website](https://docs.appodeal.com/unity/changelog).*
66

7+
### 3.5.2 (April 15, 2025)
8+
9+
+ Updated Appodeal Android SDK to v3.5.2
10+
+ Updated Appodeal iOS SDK to v3.5.2
11+
+ Implemented selective dispatch for `LogEvent` public API method
12+
713
### 3.5.1 (April 01, 2025)
814

915
+ Updated Appodeal Android SDK to v3.5.1

Editor/DependencyManager/DefaultDependencies/AppodealDependencies.txt

Lines changed: 90 additions & 89 deletions
Large diffs are not rendered by default.

Runtime/Api/Appodeal.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -722,18 +722,23 @@ public static double GetPredictedEcpmForPlacement(int adType, string placement)
722722
}
723723

724724
/// <summary>
725-
/// <para>Sends event data to all connected analytic services such as Firebase, Adjust, AppsFlyer and Facebook.</para>
725+
/// Sends event data to selected analytic services such as Adjust, AppsFlyer, Facebook, or Firebase.<br/>
726726
/// See <see href="https://docs.appodeal.com/unity/advanced/event-tracking?distribution=upm#step-1-how-to-track-in-app-events"/> for more details.
727727
/// </summary>
728+
/// <param name="eventName">the name of the event.</param>
729+
/// <param name="eventParams">optional parameters associated with the event.</param>
730+
/// <param name="services">target services to send the event to. Defaults to all connected services.</param>
728731
/// <remarks>
729-
/// <para>Event parameter values must be one of the following types: <see langword="string"/>, <see langword="double"/>, or <see langword="int"/></para>
730-
/// If event has no params, call the shorten version of this method by passing only name of the event.
732+
/// For the <c>eventParams</c> argument, every dictionary value should be either a <c>string</c>, <c>double</c>, or <c>int</c>.<br/>
733+
/// Use the named argument <c>services:</c> if you want to specify target services while omitting the second optional argument.
731734
/// </remarks>
732-
/// <param name="eventName">name of the event.</param>
733-
/// <param name="eventParams">parameters of the event if any.</param>
734-
public static void LogEvent(string eventName, Dictionary<string, object> eventParams = null)
735+
/// <example>Send event to all connected services w/o params:<code>Appodeal.LogEvent("eventName");</code></example>
736+
/// <example>Send event to all connected services w/ params:<code>Appodeal.LogEvent("eventName", eventParams);</code></example>
737+
/// <example>Send event to a group of services w/o params:<code>Appodeal.LogEvent("eventName", services:AppodealService.AppsFlyer | AppodealService.Facebook);</code></example>
738+
/// <example>Send event to a specific service w/ params:<code>Appodeal.LogEvent("eventName", eventParams, AppodealService.Adjust);</code></example>
739+
public static void LogEvent(string eventName, Dictionary<string, object> eventParams = null, AppodealService services = AppodealService.All)
735740
{
736-
GetInstance().LogEvent(eventName, eventParams);
741+
GetInstance().LogEvent(eventName, eventParams, services);
737742
}
738743

739744
/// <summary>

Runtime/Common/AppodealEnums.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ReSharper Disable CheckNamespace
22

3+
using System;
34
using System.Diagnostics.CodeAnalysis;
45

56
namespace AppodealStack.Monetization.Common
@@ -71,4 +72,14 @@ public enum MediationDebuggerProvider
7172
{
7273
AppLovinSdk,
7374
}
75+
76+
[Flags]
77+
public enum AppodealService
78+
{
79+
Adjust = 1 << 0,
80+
AppsFlyer = 1 << 1,
81+
Facebook = 1 << 2,
82+
Firebase = 1 << 3,
83+
All = Adjust | AppsFlyer | Facebook | Firebase
84+
}
7485
}

Runtime/Common/AppodealVersions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace AppodealStack.Monetization.Common
1212
[SuppressMessage("ReSharper", "UnusedMember.Global")]
1313
public static class AppodealVersions
1414
{
15-
private const string AppodealPluginVersion = "3.5.1";
15+
private const string AppodealPluginVersion = "3.5.2";
1616

1717
/// <summary>
1818
/// Gets the current version of the Appodeal Unity Plugin.

Runtime/Common/Interfaces/IAppodealAdsClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public interface IAppodealAdsClient
6868
void ResetExtraData(string key);
6969
double GetPredictedEcpm(int adType);
7070
double GetPredictedEcpmForPlacement(int adType, string placement);
71-
void LogEvent(string eventName, Dictionary<string, object> eventParams);
71+
void LogEvent(string eventName, Dictionary<string, object> eventParams, AppodealService services);
7272
void ValidatePlayStoreInAppPurchase(IPlayStoreInAppPurchase purchase, IInAppPurchaseValidationListener listener);
7373
void ValidateAppStoreInAppPurchase(IAppStoreInAppPurchase purchase, IInAppPurchaseValidationListener listener);
7474
void SetBidonEndpoint(string baseUrl);

Runtime/Platforms/Android/AndroidAppodealClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,11 @@ public bool IsAutoCacheEnabled(int adType)
430430
return AppodealJavaClass?.CallStatic<bool>(AndroidConstants.JavaMethodName.Appodeal.IsAutoCacheEnabled, AndroidAppodealHelper.GetJavaAdTypes(adType)) ?? false;
431431
}
432432

433-
public void LogEvent(string eventName, Dictionary<string, object> eventParams)
433+
public void LogEvent(string eventName, Dictionary<string, object> eventParams, AppodealService services)
434434
{
435435
if (eventParams == null)
436436
{
437-
AppodealJavaClass?.CallStatic(AndroidConstants.JavaMethodName.Appodeal.LogEvent, eventName, null);
437+
AppodealJavaClass?.CallStatic(AndroidConstants.JavaMethodName.Appodeal.LogEvent, eventName, null, (int)services);
438438
return;
439439
}
440440

@@ -451,7 +451,7 @@ public void LogEvent(string eventName, Dictionary<string, object> eventParams)
451451
map.Call<AndroidJavaObject>("put", entry.Key, AndroidAppodealHelper.GetJavaObject(entry.Value));
452452
}
453453

454-
AppodealJavaClass?.CallStatic(AndroidConstants.JavaMethodName.Appodeal.LogEvent, eventName, map);
454+
AppodealJavaClass?.CallStatic(AndroidConstants.JavaMethodName.Appodeal.LogEvent, eventName, map, (int)services);
455455
}
456456
catch (Exception e)
457457
{

Runtime/Platforms/Dummy/DummyAppodealClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ public string GetUserId()
824824
return String.Empty;
825825
}
826826

827-
public void LogEvent(string eventName, Dictionary<string, object> eventParams)
827+
public void LogEvent(string eventName, Dictionary<string, object> eventParams, AppodealService services)
828828
{
829829
if (CheckIfLoggingEnabled()) Debug.Log("Calling Appodeal.LogEvent method on an unsupported platform. Run your application on either Android or iOS device to test this method.");
830830
}

Runtime/Platforms/iOS/Bridge/AppodealObjCBridge.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ internal static class AppodealObjCBridge
183183
internal static extern bool AppodealIsAutoCacheEnabled(int adType);
184184

185185
[DllImport("__Internal")]
186-
internal static extern void AppodealLogEvent(string eventName, string eventParams);
186+
internal static extern void AppodealLogEvent(string eventName, string eventParams, int services);
187187

188188
[DllImport("__Internal")]
189189
internal static extern void AppodealValidateInAppPurchase(

Runtime/Platforms/iOS/IosAppodealClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,14 +745,14 @@ public void TrackInAppPurchase(double amount, string currency)
745745
AppodealObjCBridge.AppodealTrackInAppPurchase(amount, currency);
746746
}
747747

748-
public void LogEvent(string eventName, Dictionary<string, object> eventParams)
748+
public void LogEvent(string eventName, Dictionary<string, object> eventParams, AppodealService services)
749749
{
750750
var paramsFiltered = new Dictionary<string, object>();
751751

752752
eventParams?.Keys.Where(key => eventParams[key] is int || eventParams[key] is double || eventParams[key] is string)
753753
.ToList().ForEach(key => paramsFiltered.Add(key, eventParams[key]));
754754

755-
AppodealObjCBridge.AppodealLogEvent(eventName, DictionaryToString(paramsFiltered));
755+
AppodealObjCBridge.AppodealLogEvent(eventName, DictionaryToString(paramsFiltered), (int)services);
756756
}
757757

758758
public void ValidateAppStoreInAppPurchase(IAppStoreInAppPurchase purchase, IInAppPurchaseValidationListener listener)

Runtime/Plugins/iOS/AppodealObjCBridge.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ void AppodealSetUserId(const char *userid) {
312312
return strncpy(cStringCopy, cString, [[Appodeal userId] length]);
313313
}
314314

315-
void AppodealLogEvent(const char *eventName, const char *eventParams) {
316-
[Appodeal trackEvent:NSStringFromUTF8String(eventName) customParameters:NSDictionaryFromUTF8String(eventParams)];
315+
void AppodealLogEvent(const char *eventName, const char *eventParams, int services) {
316+
[Appodeal trackEvent:NSStringFromUTF8String(eventName) customParameters:NSDictionaryFromUTF8String(eventParams) analytics:services];
317317
}
318318

319319
void AppodealValidateInAppPurchase(const char *productIdentifier,

Samples~/UsageSample/AppodealDemo.cs

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public class AppodealDemo : MonoBehaviour
4444
[SerializeField] private Text pluginVersionText;
4545
[SerializeField] private Text interstitialButtonText;
4646
[SerializeField] private Text rewardedVideoButtonText;
47+
[SerializeField] private Toggle allServicesToggle;
48+
[SerializeField] private Toggle adjustServiceToggle;
49+
[SerializeField] private Toggle appsFlyerServiceToggle;
50+
[SerializeField] private Toggle facebookServiceToggle;
51+
[SerializeField] private Toggle firebaseServiceToggle;
4752

4853
#endregion
4954

@@ -65,6 +70,8 @@ public class AppodealDemo : MonoBehaviour
6570

6671
private bool _shouldChangeIntText, _shouldChangeRewText;
6772

73+
private List<Toggle> _serviceToggles;
74+
6875
#endregion
6976

7077
#region MonoBehavior Functions
@@ -90,6 +97,19 @@ private void Awake()
9097
Assert.IsNotNull(pluginVersionText);
9198
Assert.IsNotNull(interstitialButtonText);
9299
Assert.IsNotNull(rewardedVideoButtonText);
100+
Assert.IsNotNull(allServicesToggle);
101+
Assert.IsNotNull(adjustServiceToggle);
102+
Assert.IsNotNull(appsFlyerServiceToggle);
103+
Assert.IsNotNull(facebookServiceToggle);
104+
Assert.IsNotNull(firebaseServiceToggle);
105+
106+
_serviceToggles = new List<Toggle>
107+
{
108+
adjustServiceToggle,
109+
appsFlyerServiceToggle,
110+
facebookServiceToggle,
111+
firebaseServiceToggle,
112+
};
93113
}
94114

95115
private void Start()
@@ -142,6 +162,30 @@ public void ShowNextPanel()
142162
if (index + 2 >= panels.Count) nextPanelButton.interactable = false;
143163
}
144164

165+
public void OnServiceToggleValueChanged()
166+
{
167+
if (_serviceToggles.Any(toggle => !toggle.isOn)) return;
168+
169+
allServicesToggle.isOn = true;
170+
_serviceToggles.ForEach(toggle => toggle.interactable = false);
171+
}
172+
173+
public void OnAllServicesToggleValueChanged(bool isOn)
174+
{
175+
if (isOn)
176+
{
177+
_serviceToggles.ForEach(toggle =>
178+
{
179+
toggle.isOn = true;
180+
toggle.interactable = false;
181+
});
182+
}
183+
else
184+
{
185+
_serviceToggles.ForEach(toggle => toggle.interactable = true);
186+
}
187+
}
188+
145189
#endregion
146190

147191
#region Appodeal Monetization
@@ -302,7 +346,20 @@ public void ValidateInAppPurchase()
302346

303347
public void LogEvent()
304348
{
305-
Appodeal.LogEvent("test_event", new Dictionary<string, object> { { "test_key_1", 42 }, { "test_key_2", "test_value" } });
349+
var eventParams = new Dictionary<string, object> { { "test_key_1", 42 }, { "test_key_2", "test_value" } };
350+
if (allServicesToggle.isOn)
351+
{
352+
Appodeal.LogEvent("test_event", eventParams);
353+
}
354+
else
355+
{
356+
AppodealService services = 0;
357+
if (adjustServiceToggle.isOn) services |= AppodealService.Adjust;
358+
if (appsFlyerServiceToggle.isOn) services |= AppodealService.AppsFlyer;
359+
if (facebookServiceToggle.isOn) services |= AppodealService.Facebook;
360+
if (firebaseServiceToggle.isOn) services |= AppodealService.Firebase;
361+
Appodeal.LogEvent("test_event", eventParams, services);
362+
}
306363
}
307364

308365
#endregion
@@ -385,6 +442,10 @@ private void OnInitializationFinished(object sender, SdkInitializedEventArgs e)
385442
networksList = Appodeal.GetNetworks(AppodealAdType.Mrec);
386443
output = networksList == null ? String.Empty : String.Join(", ", (networksList.ToArray()));
387444
Debug.Log($"[APDUnity] [Appodeal] GetNetworks() for Mrec: {output}");
445+
446+
pluginVersionText.text = $"Appodeal Unity Plugin v{ AppodealVersions.GetPluginVersion() } & SDK v{ Appodeal.GetNativeSDKVersion() }";
447+
448+
Appodeal.ShowMediationDebugger();
388449
}
389450

390451
#endregion

0 commit comments

Comments
 (0)