Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,13 @@ public void purchaseFinalized(@NonNull String placementId, @NonNull String catal
}
}

@Override
public void close() {
if (mKitManager != null) {
mKitManager.close();
}
}

static class CoreCallbacksImpl implements CoreCallbacks {
KitFrameworkWrapper mKitFrameworkWrapper;
ConfigManager mConfigManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ void execute(@NonNull String identifier,

void purchaseFinalized(@NonNull String placementId, @NonNull String catalogItemId, boolean status);

void close();

enum KitStatus {
NOT_CONFIGURED,
STOPPED,
Expand Down
6 changes: 6 additions & 0 deletions android-core/src/main/kotlin/com/mparticle/Rokt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ class Rokt internal constructor(
mKitManager.purchaseFinalized(placementId, catalogItemId, status)
}
}

fun close() {
if (mConfigManager.isEnabled) {
mKitManager.close()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -637,5 +637,7 @@ void execute(@NonNull String viewName,
void setWrapperSdkVersion(@NonNull WrapperSdkVersion wrapperSdkVersion);

void purchaseFinalized(@NonNull String placementId, @NonNull String catalogItemId, boolean status);

void close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1421,12 +1421,14 @@ public Flow<RoktEvent> events(@NonNull String identifier) {
for (KitIntegration provider : providers.values()) {
try {
if (provider instanceof KitIntegration.RoktListener && !provider.isDisabled()) {
Logger.verbose("Calling events for kit: " + provider.getName() + " with identifier: " + identifier);
return ((KitIntegration.RoktListener) provider).events(identifier);
}
} catch (Exception e) {
Logger.warning("Failed to call setWrapperSdkVersion for kit: " + provider.getName() + ": " + e.getMessage());
}
}
Logger.warning("No RoktListener found");
return flowOf();
}

Expand Down Expand Up @@ -1456,6 +1458,19 @@ public void purchaseFinalized(@NonNull String placementId, @NonNull String catal
}
}

@Override
public void close() {
for (final KitIntegration provider : providers.values()) {
try {
if (provider instanceof KitIntegration.RoktListener && !provider.isDisabled()) {
((KitIntegration.RoktListener) provider).close();
}
} catch (final Exception e) {
Logger.warning("Failed to call close for kit: " + provider.getName() + ": " + e.getMessage());
}
}
}

private void confirmEmail(
@Nullable String email,
@Nullable MParticleUser user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,10 @@ class KitManagerImplTest {
override fun purchaseFinalized(placementId: String, catalogItemId: String, status: Boolean) {
println("purchaseFinalized with placementId: $placementId catalogItemId : $catalogItemId status : $status ")
}

override fun close() {
println("close called")
}
}

internal inner class KitManagerEventCounter : MockKitManagerImpl() {
Expand Down
Loading