Skip to content

Commit 1179a33

Browse files
authored
Merge branch 'development' into feat/SQDSDKS-7422-add-Rokt-Events
2 parents 481e17d + e583057 commit 1179a33

17 files changed

Lines changed: 338 additions & 259 deletions

File tree

.github/workflows/pull-request.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ jobs:
5050
#script: ./gradlew :android-core:cAT :android-kit-base:cAT --stacktrace
5151
script: |
5252
# Disable benchmark tests as they do not work on emulators
53-
adb uninstall com.mparticle.kits.test; ./gradlew connectedCheck --stacktrace
54-
./gradlew :android-core:cAT :android-kit-base:cAT -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=none
53+
adb uninstall com.mparticle.kits.test || true
54+
adb uninstall com.mparticle.testutils.test || true
55+
./gradlew connectedCheck --stacktrace
56+
57+
adb uninstall com.mparticle.kits.test || true
58+
adb uninstall com.mparticle.testutils.test || true
59+
./gradlew :android-core:cAT :android-kit-base:cAT -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=none
5560
- name: "Archive Instrumented Tests Results"
5661
uses: actions/upload-artifact@v4
5762
if: always()

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## [5.69.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.68.0...v5.69.0) (2025-06-17)
2+
3+
4+
### Features
5+
6+
* Always set the wrapperSdkVersion in KitManager ([#584](https://github.com/mParticle/mparticle-android-sdk/issues/584)) ([a473157](https://github.com/mParticle/mparticle-android-sdk/commit/a4731572656dccc0dc6e3511539bbe8db38792e1))
7+
8+
9+
### Bug Fixes
10+
11+
* ensure user attributes are applied before proceeding with Rokt execution ([#585](https://github.com/mParticle/mparticle-android-sdk/issues/585)) ([df0450e](https://github.com/mParticle/mparticle-android-sdk/commit/df0450e724e9d5b2945739fc3304d87cb0b3a567))
12+
113
## [5.68.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.67.0...v5.68.0) (2025-06-14)
214

315

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You can grab the Core SDK via Maven Central. Please see the badge above and foll
1616

1717
```groovy
1818
dependencies {
19-
implementation 'com.mparticle:android-core:5.68.0'
19+
implementation 'com.mparticle:android-core:5.69.0'
2020
}
2121
```
2222

@@ -27,8 +27,8 @@ Several integrations require additional client-side add-on libraries called "kit
2727
```groovy
2828
dependencies {
2929
implementation (
30-
'com.mparticle:android-example-kit:5.68.0',
31-
'com.mparticle:android-another-kit:5.68.0'
30+
'com.mparticle:android-example-kit:5.69.0',
31+
'com.mparticle:android-another-kit:5.69.0'
3232
)
3333
}
3434
```

android-core/proguard.pro

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@
198198
-keep public class com.mparticle.rokt.* {
199199
*;
200200
}
201+
202+
# Additional Rokt-specific rules to preserve all classes and method signatures
203+
-keep class com.mparticle.rokt.RoktConfig { *; }
204+
-keep class com.mparticle.rokt.RoktConfig$Builder { *; }
205+
-keep class com.mparticle.rokt.RoktConfig$ColorMode { *; }
206+
-keep class com.mparticle.rokt.CacheConfig { *; }
207+
-keep class com.mparticle.rokt.RoktEmbeddedView { *; }
208+
-keep class com.mparticle.rokt.RoktLayoutDimensionCallBack { *; }
209+
210+
# Preserve all method signatures in the Rokt class to prevent overload resolution issues
211+
-keepclassmembers class com.mparticle.Rokt {
212+
public void selectPlacements(...);
213+
public void purchaseFinalized(...);
214+
}
201215
-keep public class com.mparticle.audience.* {
202216
*;
203217
}
@@ -223,4 +237,15 @@
223237

224238
-keepnames class * implements android.os.Parcelable {
225239
public static final ** CREATOR;
226-
}
240+
}
241+
242+
-keepclassmembers class com.mparticle.Rokt {
243+
<init>(...);
244+
void *(...);
245+
void *$default(...);
246+
<fields>;
247+
}
248+
249+
-keep interface com.mparticle.MpRoktEventCallback { *; }
250+
-keep interface com.mparticle.UnloadReasons { *; }
251+
-keep class com.mparticle.UnloadReasons { *; }

android-core/src/main/java/com/mparticle/MParticle.java

Lines changed: 2 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.content.Context;
77
import android.content.Intent;
88
import android.content.SharedPreferences;
9-
import android.graphics.Typeface;
109
import android.location.Location;
1110
import android.location.LocationManager;
1211
import android.net.Uri;
@@ -52,14 +51,11 @@
5251
import com.mparticle.media.MediaCallbacks;
5352
import com.mparticle.messaging.MPMessagingAPI;
5453
import com.mparticle.messaging.ProviderCloudMessage;
55-
import com.mparticle.rokt.RoktConfig;
56-
import com.mparticle.rokt.RoktEmbeddedView;
5754

5855
import org.jetbrains.annotations.NotNull;
5956
import org.json.JSONObject;
6057

6158
import java.io.File;
62-
import java.lang.ref.WeakReference;
6359
import java.math.BigDecimal;
6460
import java.util.HashMap;
6561
import java.util.HashSet;
@@ -114,7 +110,7 @@ public class MParticle {
114110
protected boolean locationTrackingEnabled = false;
115111
@NonNull
116112
protected Internal mInternal = new Internal();
117-
protected Rokt rokt = new Rokt();
113+
protected Rokt rokt;
118114
private IdentityStateListener mDeferredModifyPushRegistrationListener;
119115
@NonNull
120116
private WrapperSdkVersion wrapperSdkVersion = new WrapperSdkVersion(WrapperSdk.WrapperNone, null);
@@ -194,6 +190,7 @@ private static MParticle getInstance(@NonNull Context context, @NonNull MParticl
194190
instance = new MParticle(options);
195191
instance.mKitManager = new KitFrameworkWrapper(options.getContext(), instance.mMessageManager, instance.Internal().getConfigManager(), instance.Internal().getAppStateManager(), options);
196192
instance.mIdentityApi = new IdentityApi(options.getContext(), instance.mInternal.getAppStateManager(), instance.mMessageManager, instance.mConfigManager, instance.mKitManager, options.getOperatingSystem());
193+
instance.rokt = new Rokt(instance.mConfigManager, instance.mKitManager);
197194

198195
// Check if we've switched workspaces on startup
199196
UploadSettings lastUploadSettings = instance.mConfigManager.getLastUploadSettings();
@@ -1788,136 +1785,6 @@ public interface ResetListener {
17881785
void onReset();
17891786
}
17901787

1791-
/**
1792-
* ### Optional callback events for when the view loads and unloads.
1793-
*/
1794-
public interface MpRoktEventCallback {
1795-
/**
1796-
* onLoad Callback will be triggered immediately when the View displays.
1797-
*/
1798-
void onLoad();
1799-
1800-
/**
1801-
* onUnLoad Callback will be triggered if the View failed to show or it closed.
1802-
*/
1803-
void onUnload(UnloadReasons reason);
1804-
1805-
/**
1806-
* onShouldShowLoadingIndicator callback will be triggered if View start processing
1807-
*/
1808-
void onShouldShowLoadingIndicator();
1809-
1810-
/**
1811-
* onShouldHideLoadingIndicator callback will be triggered if View end processing
1812-
*/
1813-
void onShouldHideLoadingIndicator();
1814-
}
1815-
1816-
/**
1817-
* Enum representing the reasons for unloading.
1818-
*/
1819-
public enum UnloadReasons {
1820-
/**
1821-
* Called when there are no offers to display so the view does not get loaded in.
1822-
*/
1823-
NO_OFFERS,
1824-
1825-
/**
1826-
* View has been rendered and has been completed.
1827-
*/
1828-
FINISHED,
1829-
1830-
/**
1831-
* Operation to fetch view took too long to resolve.
1832-
*/
1833-
TIMEOUT,
1834-
1835-
/**
1836-
* Some error has occurred regarding the network.
1837-
*/
1838-
NETWORK_ERROR,
1839-
1840-
/**
1841-
* View is empty.
1842-
*/
1843-
NO_WIDGET,
1844-
1845-
/**
1846-
* Init request was not successful.
1847-
*/
1848-
INIT_FAILED,
1849-
1850-
/**
1851-
* Placeholder string mismatch.
1852-
*/
1853-
UNKNOWN_PLACEHOLDER,
1854-
1855-
/**
1856-
* Catch-all for all issues.
1857-
*/
1858-
UNKNOWN;
1859-
1860-
/**
1861-
* Returns the enum constant matching the provided string.
1862-
* If no match is found, UNKNOWN is returned.
1863-
*
1864-
* @param value the name of the enum constant to look up
1865-
* @return the corresponding UnloadReasons constant or UNKNOWN if no match is found
1866-
*/
1867-
public static UnloadReasons from(String value) {
1868-
for (UnloadReasons reason : UnloadReasons.values()) {
1869-
if (reason.name().equals(value)) {
1870-
return reason;
1871-
}
1872-
}
1873-
return UNKNOWN;
1874-
}
1875-
}
1876-
1877-
1878-
/**
1879-
* Rokt Integration
1880-
* */
1881-
public class Rokt{
1882-
protected Rokt(){
1883-
1884-
}
1885-
1886-
public void selectPlacements(@NonNull String viewName,
1887-
@NonNull Map<String, String> attributes,
1888-
@Nullable MpRoktEventCallback callbacks,
1889-
@Nullable Map<String, WeakReference<RoktEmbeddedView>> placeHolders,
1890-
@Nullable Map<String, WeakReference<Typeface>> fontTypefaces,
1891-
@Nullable RoktConfig config) {
1892-
if (mConfigManager.isEnabled()) {
1893-
mKitManager.execute(viewName,
1894-
attributes,
1895-
callbacks,
1896-
placeHolders,
1897-
fontTypefaces,
1898-
config);
1899-
}
1900-
}
1901-
1902-
public void selectPlacements(@NonNull String viewName,
1903-
@NonNull Map<String, String> attributes) {
1904-
if (mConfigManager.isEnabled()) {
1905-
mKitManager.execute(viewName,
1906-
attributes,
1907-
null,
1908-
null,
1909-
null,
1910-
null
1911-
);
1912-
}
1913-
}
1914-
1915-
public void purchaseFinalized(@NonNull String placementId, @NonNull String catalogItemId, boolean status) {
1916-
if (mConfigManager.isEnabled()) {
1917-
mKitManager.purchaseFinalized(placementId, catalogItemId, status);
1918-
}
1919-
}
1920-
}
19211788
/**
19221789
* @hidden
19231790
*/

android-core/src/main/java/com/mparticle/internal/KitFrameworkWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.mparticle.MPEvent;
1818
import com.mparticle.MParticle;
1919
import com.mparticle.MParticleOptions;
20+
import com.mparticle.MpRoktEventCallback;
2021
import com.mparticle.WrapperSdkVersion;
2122
import com.mparticle.consent.ConsentState;
2223
import com.mparticle.identity.IdentityApiRequest;
@@ -654,7 +655,7 @@ public void reset() {
654655
@Override
655656
public void execute(@NonNull String viewName,
656657
@NonNull Map<String, String> attributes,
657-
@Nullable MParticle.MpRoktEventCallback mpRoktEventCallback,
658+
@Nullable MpRoktEventCallback mpRoktEventCallback,
658659
@Nullable Map<String, WeakReference<RoktEmbeddedView>> placeHolders,
659660
@Nullable Map<String, WeakReference<Typeface>> fontTypefaces,
660661
@Nullable RoktConfig config) {

android-core/src/main/java/com/mparticle/internal/KitManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.mparticle.MPEvent;
1717
import com.mparticle.MParticle;
1818
import com.mparticle.MParticleOptions;
19+
import com.mparticle.MpRoktEventCallback;
1920
import com.mparticle.WrapperSdkVersion;
2021
import com.mparticle.consent.ConsentState;
2122
import com.mparticle.identity.IdentityApiRequest;
@@ -125,10 +126,10 @@ public interface KitManager {
125126

126127
void reset();
127128

128-
void execute(@NonNull String viewName,
129+
void execute(@NonNull String identifier,
129130
@NonNull Map<String, String> attributes,
130-
@Nullable MParticle.MpRoktEventCallback mpRoktEventCallback,
131-
@Nullable Map<String, WeakReference<RoktEmbeddedView>> placeHolders,
131+
@Nullable MpRoktEventCallback mpRoktEventCallback,
132+
@Nullable Map<String, WeakReference<RoktEmbeddedView>> embeddedViews,
132133
@Nullable Map<String, WeakReference<Typeface>> fontTypefaces,
133134
@Nullable RoktConfig config);
134135

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package com.mparticle
2+
3+
/**
4+
* ### Optional callback events for when the view loads and unloads.
5+
*/
6+
interface MpRoktEventCallback {
7+
8+
/**
9+
* onLoad Callback will be triggered immediately when the View displays.
10+
*/
11+
fun onLoad()
12+
13+
/**
14+
* onUnLoad Callback will be triggered if the View failed to show or it closed.
15+
*/
16+
fun onUnload(reason: UnloadReasons)
17+
18+
/**
19+
* onShouldShowLoadingIndicator callback will be triggered if View starts processing.
20+
*/
21+
fun onShouldShowLoadingIndicator()
22+
23+
/**
24+
* onShouldHideLoadingIndicator callback will be triggered if View ends processing.
25+
*/
26+
fun onShouldHideLoadingIndicator()
27+
}
28+
29+
/**
30+
* Enum representing the reasons for unloading.
31+
*/
32+
enum class UnloadReasons {
33+
/**
34+
* Called when there are no offers to display so the view does not get loaded in.
35+
*/
36+
NO_OFFERS,
37+
38+
/**
39+
* View has been rendered and has been completed.
40+
*/
41+
FINISHED,
42+
43+
/**
44+
* Operation to fetch view took too long to resolve.
45+
*/
46+
TIMEOUT,
47+
48+
/**
49+
* Some error has occurred regarding the network.
50+
*/
51+
NETWORK_ERROR,
52+
53+
/**
54+
* View is empty.
55+
*/
56+
NO_WIDGET,
57+
58+
/**
59+
* Init request was not successful.
60+
*/
61+
INIT_FAILED,
62+
63+
/**
64+
* Placeholder string mismatch.
65+
*/
66+
UNKNOWN_PLACEHOLDER,
67+
68+
/**
69+
* Catch-all for all issues.
70+
*/
71+
UNKNOWN;
72+
73+
companion object {
74+
/**
75+
* Returns the enum constant matching the provided string.
76+
* If no match is found, UNKNOWN is returned.
77+
*
78+
* @param value the name of the enum constant to look up
79+
* @return the corresponding UnloadReasons constant or UNKNOWN if no match is found
80+
*/
81+
fun from(value: String): UnloadReasons {
82+
return try {
83+
valueOf(value)
84+
} catch (e: IllegalArgumentException) {
85+
UNKNOWN
86+
}
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)