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
4 changes: 2 additions & 2 deletions Editor/QonversionDependencies.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="io.qonversion:sandwich:7.11.0" />
<androidPackage spec="io.qonversion:sandwich:7.12.0" />
<androidPackage spec="com.fasterxml.jackson.core:jackson-databind:2.11.1" />
<androidPackage spec="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61" />
</androidPackages>
<iosPods>
<iosPod name="QonversionSandwich" version="7.11.0" />
<iosPod name="QonversionSandwich" version="7.12.0" />
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public static synchronized void syncHistoricalData() {
qonversionSandwich.syncHistoricalData();
}

public static synchronized void invalidateRemoteConfigsCache() {
qonversionSandwich.invalidateRemoteConfigsCache();
}

public static synchronized void syncPurchases() {
qonversionSandwich.syncPurchases();
}
Expand Down
5 changes: 5 additions & 0 deletions Runtime/Android/QonversionWrapperAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public void SyncHistoricalData()
CallQonversion("syncHistoricalData");
}

public void InvalidateRemoteConfigsCache()
{
CallQonversion("invalidateRemoteConfigsCache");
}

public void SyncStoreKit2Purchases()
{
}
Expand Down
25 changes: 25 additions & 0 deletions Runtime/Scripts/IQonversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,31 @@ public interface IQonversion
/// <see href="https://documentation.qonversion.io/docs/remote-config">Remote Configs</see>
public void RemoteConfigList(string[] contextKeys, bool includeEmptyContextKey, Qonversion.OnRemoteConfigListReceived callback);

/// <summary>
/// Invalidates the cache of remote configs so the next <see cref="RemoteConfig(Qonversion.OnRemoteConfigReceived)"/> or
/// <see cref="RemoteConfigList(Qonversion.OnRemoteConfigListReceived)"/> call fetches
/// a fresh targeting evaluation from the server instead of returning the cached copy.
/// </summary>
/// <remarks>
/// This method performs no network request itself — it only marks the
/// cached values as stale. An in-flight RemoteConfig load is re-issued
/// once so its waiting callbacks receive a fresh evaluation; an
/// in-flight RemoteConfigList completes with the evaluation it started
/// with. If the re-issued load fails, the previously received evaluation
/// is delivered instead of an error — the call never degrades below the
/// pre-invalidation result.
///
/// Call it when the targeting inputs changed and you need the change
/// reflected immediately, for example after setting a batch of user
/// properties your remote config targeting depends on. You do NOT need
/// to call it after <see cref="Identify(string)"/> — the SDK invalidates the
/// cache on identity changes automatically. Call it after
/// <see cref="Qonversion.Initialize"/>: calling before initialization
/// throws.
/// </remarks>
/// <see href="https://documentation.qonversion.io/docs/remote-config">Remote Configs</see>
public void InvalidateRemoteConfigsCache();

/// <summary>
/// This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
/// Use this function to attach the user to the experiment.
Expand Down
6 changes: 6 additions & 0 deletions Runtime/Scripts/Internal/QonversionInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ public void RemoteConfigList(string[] contextKeys, bool includeEmptyContextKey,
instance.RemoteConfigList(contextKeysJson, includeEmptyContextKey, OnRemoteConfigListForContextKeysMethodName);
}

public void InvalidateRemoteConfigsCache()
{
IQonversionWrapper instance = GetNativeWrapper();
instance.InvalidateRemoteConfigsCache();
}

public void AttachUserToExperiment(string experimentId, string groupId, Qonversion.OnAttachUserResponseReceived callback)
{
AttachUserCallback = callback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal interface IQonversionWrapper
void RemoteConfig([CanBeNull] string contextKey, string callbackName);
void RemoteConfigList(string callbackName);
void RemoteConfigList(string contextKeysJson, bool includeEmptyContextKey, string callbackName);
void InvalidateRemoteConfigsCache();
void AttachUserToExperiment(string experimentId, string groupId, string callbackName);
void DetachUserFromExperiment(string experimentId, string callbackName);
void AttachUserToRemoteConfiguration(string remoteConfigurationId, string callbackName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public void RemoteConfigList(string contextKeysJson, bool includeEmptyContextKey
{
}

public void InvalidateRemoteConfigsCache()
{
}

public void AttachUserToExperiment(string experimentId, string groupId, string callbackName)
{
}
Expand Down
4 changes: 4 additions & 0 deletions Runtime/iOS/Plugins/QonversionBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ void _syncHistoricalData() {
[qonversionSandwich syncHistoricalData];
}

void _invalidateRemoteConfigsCache() {
[qonversionSandwich invalidateRemoteConfigsCache];
}

void _syncStoreKit2Purchases() {
[qonversionSandwich syncStoreKit2Purchases];
}
Expand Down
10 changes: 10 additions & 0 deletions Runtime/iOS/QonversionWrapperIOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ internal class QonversionWrapperIOS : IQonversionWrapper
[DllImport("__Internal")]
private static extern void _syncHistoricalData();

[DllImport("__Internal")]
private static extern void _invalidateRemoteConfigsCache();

[DllImport("__Internal")]
private static extern void _syncStoreKit2Purchases();

Expand Down Expand Up @@ -156,6 +159,13 @@ public void SyncHistoricalData()
#endif
}

public void InvalidateRemoteConfigsCache()
{
#if UNITY_IOS
_invalidateRemoteConfigsCache();
#endif
}

public void SyncStoreKit2Purchases()
{
#if UNITY_IOS
Expand Down