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
2 changes: 1 addition & 1 deletion QonversionCapacitorPlugin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '14.0'
s.dependency 'Capacitor'
s.swift_version = '5.1'
s.dependency "QonversionSandwich", "7.11.0"
s.dependency "QonversionSandwich", "7.12.0"
end
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dependencies {
implementation project(':capacitor-android')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation 'androidx.core:core-ktx:1.13.1'
implementation "io.qonversion:sandwich:7.11.0"
implementation "io.qonversion:sandwich:7.12.0"
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ class QonversionPlugin : Plugin() {
}
}

@PluginMethod
fun invalidateRemoteConfigsCache(call: PluginCall) {
qonversionSandwich.invalidateRemoteConfigsCache()
call.resolve()
}

@PluginMethod
fun syncHistoricalData(call: PluginCall) {
qonversionSandwich.syncHistoricalData()
Expand Down
6 changes: 6 additions & 0 deletions ios/Sources/QonversionPlugin/QonversionPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class QonversionPlugin: CAPPlugin, CAPBridgedPlugin {
CAPPluginMethod(name: "checkEntitlements", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "remoteConfig", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "remoteConfigList", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "invalidateRemoteConfigsCache", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "userInfo", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "userProperties", returnType: CAPPluginReturnPromise),
CAPPluginMethod(name: "forceSendProperties", returnType: CAPPluginReturnPromise),
Expand Down Expand Up @@ -244,6 +245,11 @@ public class QonversionPlugin: CAPPlugin, CAPBridgedPlugin {
call.resolve()
}

@objc func invalidateRemoteConfigsCache(_ call: CAPPluginCall) {
qonversionSandwich?.invalidateRemoteConfigsCache()
call.resolve()
}

@objc func syncHistoricalData(_ call: CAPPluginCall) {
qonversionSandwich?.syncHistoricalData()
call.resolve()
Expand Down
25 changes: 25 additions & 0 deletions src/QonversionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,31 @@ export interface QonversionApi {
*/
remoteConfigListForContextKeys(contextKeys: Array<string>, includeEmptyContextKey: boolean): Promise<RemoteConfigList>

/**
* Invalidates the cache of remote configs so the next {@link remoteConfig} or
* {@link remoteConfigList} call fetches a fresh targeting evaluation from the
* server instead of returning the cached copy.
*
* 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 calls receive a fresh evaluation; an in-flight remoteConfigList
* completes with the evaluation it started with.
*
* 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
* {@link identify} — the SDK invalidates the cache on identity changes
* automatically.
*
* 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 after {@link Qonversion.initialize}: calling before initialization
* throws on Android and does nothing on iOS.
*/
invalidateRemoteConfigsCache(): void;

/**
* 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
2 changes: 2 additions & 0 deletions src/QonversionNativePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export interface QonversionNativePlugin {

remoteConfigList(params?: {contextKeys: string[], includeEmptyContextKey: boolean}): Promise<QRemoteConfigList>;

invalidateRemoteConfigsCache(): void;

attachUserToExperiment(params: {experimentId: string, groupId: string}): Promise<void>;

detachUserFromExperiment(params: {experimentId: string}): Promise<void>;
Expand Down
4 changes: 4 additions & 0 deletions src/internal/QonversionInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ export default class QonversionInternal implements QonversionApi {
return mappedRemoteConfigList;
}

invalidateRemoteConfigsCache() {
QonversionNative.invalidateRemoteConfigsCache();
}

async attachUserToExperiment(experimentId: string, groupId: string): Promise<void> {
await QonversionNative.attachUserToExperiment({experimentId, groupId});
return;
Expand Down
4 changes: 4 additions & 0 deletions src/internal/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export class QonversionWeb extends WebPlugin implements QonversionNativePlugin {
throw this.unimplemented("not implemented yet");
}

invalidateRemoteConfigsCache(): void {
throw this.unimplemented("not implemented yet");
}

restore(): Promise<Record<string, QEntitlement> | null | undefined> {
throw this.unimplemented("not implemented yet");
}
Expand Down
Loading