From 700b16da9dd82af231e476d08dbc2ca93f31fc62 Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Tue, 27 Jan 2026 14:56:48 +0300 Subject: [PATCH 1/3] Theming support and images preloading --- QonversionCapacitorPlugin.podspec | 2 +- android/build.gradle | 2 +- .../io/qonversion/capacitor/NoCodesPlugin.kt | 10 ++- example/android/capacitor.settings.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/ios/App/App.xcodeproj/project.pbxproj | 8 +-- example/ios/App/Podfile | 4 +- example/ios/App/Podfile.lock | 42 +++++------ example/src/app/screens/NoCodesScreen.ts | 69 +++++++++++++++++++ .../QonversionPlugin/NoCodesPlugin.swift | 10 ++- src/NoCodesApi.ts | 13 ++++ src/NoCodesConfig.ts | 6 +- src/NoCodesConfigBuilder.ts | 18 ++++- src/NoCodesNativePlugin.ts | 3 + src/dto/enums.ts | 22 ++++++ src/internal/NoCodesInternal.ts | 7 +- 16 files changed, 184 insertions(+), 36 deletions(-) diff --git a/QonversionCapacitorPlugin.podspec b/QonversionCapacitorPlugin.podspec index 7dbd5ddd..253274ea 100644 --- a/QonversionCapacitorPlugin.podspec +++ b/QonversionCapacitorPlugin.podspec @@ -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.3.1" + s.dependency "QonversionSandwich", "7.4.0" end diff --git a/android/build.gradle b/android/build.gradle index 421c0cfe..2006fccc 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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.3.1" + implementation "io.qonversion:sandwich:7.4.0" testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" diff --git a/android/src/main/java/io/qonversion/capacitor/NoCodesPlugin.kt b/android/src/main/java/io/qonversion/capacitor/NoCodesPlugin.kt index deb11107..0b5526e1 100644 --- a/android/src/main/java/io/qonversion/capacitor/NoCodesPlugin.kt +++ b/android/src/main/java/io/qonversion/capacitor/NoCodesPlugin.kt @@ -52,8 +52,9 @@ class NoCodesPlugin : Plugin() { val proxyUrl = call.getString("proxyUrl") val locale = call.getString("locale") + val theme = call.getString("theme") - noCodesSandwich.initialize(context, projectKey, proxyUrl, locale = locale) + noCodesSandwich.initialize(context, projectKey, proxyUrl, locale = locale, theme = theme) noCodesSandwich.setDelegate(noCodesEventListener) val source = call.getString("source") @@ -97,6 +98,13 @@ class NoCodesPlugin : Plugin() { call.resolve() } + @PluginMethod + fun setTheme(call: PluginCall) { + val theme = call.getString("theme") + noCodesSandwich.setTheme(theme) + call.resolve() + } + @PluginMethod fun setPurchaseDelegate(call: PluginCall) { noCodesSandwich.setPurchaseDelegate(purchaseDelegateBridge) diff --git a/example/android/capacitor.settings.gradle b/example/android/capacitor.settings.gradle index cef3a840..7d4d5da9 100644 --- a/example/android/capacitor.settings.gradle +++ b/example/android/capacitor.settings.gradle @@ -9,4 +9,4 @@ include ':capacitor-splash-screen' project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android') include ':qonversion-capacitor-plugin' -project(':qonversion-capacitor-plugin').projectDir = new File('../node_modules/@qonversion/capacitor-plugin/android') +project(':qonversion-capacitor-plugin').projectDir = new File('../../android') diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index c747538f..e7646dea 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/example/ios/App/App.xcodeproj/project.pbxproj b/example/ios/App/App.xcodeproj/project.pbxproj index 64fa3fdd..3ba7b155 100644 --- a/example/ios/App/App.xcodeproj/project.pbxproj +++ b/example/ios/App/App.xcodeproj/project.pbxproj @@ -283,7 +283,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -334,7 +334,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -351,7 +351,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 5ZBNSPDUJ2; INFOPLIST_FILE = App/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 1.0; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; @@ -372,7 +372,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 5ZBNSPDUJ2; INFOPLIST_FILE = App/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = io.qonversion.sample; diff --git a/example/ios/App/Podfile b/example/ios/App/Podfile index 562dbc86..96b2fd60 100644 --- a/example/ios/App/Podfile +++ b/example/ios/App/Podfile @@ -1,6 +1,6 @@ require_relative '../../node_modules/@capacitor/ios/scripts/pods_helpers' -platform :ios, '14.0' +platform :ios, '15.0' use_frameworks! # workaround to avoid Xcode caching of Pods that requires @@ -13,7 +13,7 @@ def capacitor_pods pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera' pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' - pod 'QonversionCapacitorPlugin', :path => '../../node_modules/@qonversion/capacitor-plugin' + pod 'QonversionCapacitorPlugin', :path => '../../..' end target 'App' do diff --git a/example/ios/App/Podfile.lock b/example/ios/App/Podfile.lock index d684b0eb..8af5001d 100644 --- a/example/ios/App/Podfile.lock +++ b/example/ios/App/Podfile.lock @@ -1,26 +1,26 @@ PODS: - - Capacitor (7.3.0): + - Capacitor (8.0.1): - CapacitorCordova - - CapacitorCamera (7.0.1): + - CapacitorCamera (8.0.0): - Capacitor - - CapacitorCordova (7.3.0) - - CapacitorSplashScreen (7.0.1): + - CapacitorCordova (8.0.1) + - CapacitorSplashScreen (8.0.0): - Capacitor - - Qonversion (6.3.1): - - Qonversion/Main (= 6.3.1) - - Qonversion/Main (6.3.1) - - QonversionCapacitorPlugin (0.3.1): + - Qonversion (6.4.0): + - Qonversion/Main (= 6.4.0) + - Qonversion/Main (6.4.0) + - QonversionCapacitorPlugin (1.0.0): - Capacitor - - QonversionSandwich (= 7.3.1) - - QonversionSandwich (7.3.1): - - Qonversion (= 6.3.1) + - QonversionSandwich (= 7.4.0) + - QonversionSandwich (7.4.0): + - Qonversion (= 6.4.0) DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" - "CapacitorCamera (from `../../node_modules/@capacitor/camera`)" - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)" - "CapacitorSplashScreen (from `../../node_modules/@capacitor/splash-screen`)" - - "QonversionCapacitorPlugin (from `../../node_modules/@qonversion/capacitor-plugin`)" + - QonversionCapacitorPlugin (from `../../..`) SPEC REPOS: trunk: @@ -37,17 +37,17 @@ EXTERNAL SOURCES: CapacitorSplashScreen: :path: "../../node_modules/@capacitor/splash-screen" QonversionCapacitorPlugin: - :path: "../../node_modules/@qonversion/capacitor-plugin" + :path: "../../.." SPEC CHECKSUMS: - Capacitor: fbd134fa28e503720559ecddb5ab6b41d69de347 - CapacitorCamera: eb8687d8687fed853598ec9460d94bcd5e16babe - CapacitorCordova: 2685f5c43675793b5f06dfd66b3b26268f003b97 - CapacitorSplashScreen: 19cd3573e57507e02d6f34597a8c421e00931487 - Qonversion: 48d745b4ada2b50c57bf58d82c14822675ef3535 - QonversionCapacitorPlugin: 79081868e54201f0319bdd66575f6ae136a2f44e - QonversionSandwich: d3e6fd4882ac0778b8e9708248117d36a51000c0 + Capacitor: 2d8b1a05870ddb600b0e1e32b83fcf0890c244e1 + CapacitorCamera: 05ac5bd4499ed4b8cf5358d1b4a874b385de7b4d + CapacitorCordova: 0d65b9bb74e995dcecb9463f34f1af2aba6f955c + CapacitorSplashScreen: 4b78177a21f0f73ccc1c78dd93b2a94854ac4b83 + Qonversion: f7620e1cc3b03541b9cf4a0ed357a5646d123fe3 + QonversionCapacitorPlugin: 1d8ef7c70cdc188e8aa62f7db46080b722c48096 + QonversionSandwich: 58a58f43664d2ddb755b315b51adfe9392ede3f9 -PODFILE CHECKSUM: afe3f9454c98dc22ff3619593d5dcbd43e1499e8 +PODFILE CHECKSUM: 997ea9e24aadc2907f2351506e72f75dadd36129 COCOAPODS: 1.16.2 diff --git a/example/src/app/screens/NoCodesScreen.ts b/example/src/app/screens/NoCodesScreen.ts index 22eccfb0..f0f62587 100644 --- a/example/src/app/screens/NoCodesScreen.ts +++ b/example/src/app/screens/NoCodesScreen.ts @@ -3,6 +3,7 @@ import { NoCodesConfigBuilder, ScreenPresentationConfig, ScreenPresentationStyle, + NoCodesTheme, Qonversion, type NoCodesAction, type NoCodesError, @@ -102,6 +103,26 @@ export function renderNoCodesScreen(): string { +
+
+

Theme

+

+ Set the theme mode for No-Code screens. Controls how screens adapt to light/dark themes. +

+
+ + + +
+
+
+