Skip to content

Commit 84174a9

Browse files
authored
Merge pull request #430 from qonversion/release/11.2.0
2 parents 5604c0a + 7706803 commit 84174a9

File tree

18 files changed

+130
-7
lines changed

18 files changed

+130
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 11.2.0
2+
- Faster screen loading — No-Code screens now preload images together with content, dramatically improving display speed. Don't forget to enable preloading in the screen settings in the No-Code builder.
3+
- Theme customization — Set your preferred appearance for No-Codes: system default, light, or dark mode. This currently styles the loading skeleton view, with full screen theming support coming soon in the No-Code builder.
4+
15
## 11.1.1
26
* Fixed bug when No-Codes screen on iOS was closing after the user canceled the purchase flow
37
* Small MacOS support fixes

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ android {
5151

5252
dependencies {
5353
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
54-
implementation "io.qonversion:sandwich:7.3.1"
54+
implementation "io.qonversion:sandwich:7.4.0"
5555
implementation 'com.google.code.gson:gson:2.9.0'
5656
}

android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/NoCodesPlugin.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,15 @@ class NoCodesPlugin(private val messenger: BinaryMessenger, private val context:
8181
val version = args["version"] as? String ?: return result.noNecessaryDataError()
8282
val source = args["source"] as? String ?: return result.noNecessaryDataError()
8383
val locale = args["locale"] as? String
84+
val theme = args["theme"] as? String
8485

8586
if (projectKey.isNotEmpty()) {
8687
// Initialize NoCodes Sandwich
8788
noCodesSandwich = NoCodesSandwich()
8889

8990
noCodesSandwich?.storeSdkInfo(context, source, version)
9091

91-
noCodesSandwich?.initialize(context, projectKey, null, null, null, locale)
92+
noCodesSandwich?.initialize(context, projectKey, null, null, null, locale, theme)
9293
noCodesSandwich?.setDelegate(this)
9394
result.success(null)
9495
} else {
@@ -124,6 +125,11 @@ class NoCodesPlugin(private val messenger: BinaryMessenger, private val context:
124125
result.success(null)
125126
}
126127

128+
fun setTheme(theme: String?, result: Result) {
129+
noCodesSandwich?.setTheme(theme)
130+
result.success(null)
131+
}
132+
127133
// MARK: - Purchase Delegate Methods
128134

129135
fun setPurchaseDelegate(result: Result) {

android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/QonversionPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
154154
"setScreenPresentationConfig" -> noCodesPlugin?.setScreenPresentationConfig(args["config"] as? Map<String, Any>, args["contextKey"] as? String, result)
155155
"showNoCodesScreen" -> noCodesPlugin?.showNoCodesScreen(args["contextKey"] as? String, result)
156156
"setNoCodesLocale" -> noCodesPlugin?.setLocale(args["locale"] as? String, result)
157+
"setNoCodesTheme" -> noCodesPlugin?.setTheme(args["theme"] as? String, result)
157158
// NoCodes Purchase Delegate methods
158159
"delegatedPurchaseFailed" -> noCodesPlugin?.delegatedPurchaseFailed(args["errorMessage"] as? String, result)
159160
"delegatedRestoreFailed" -> noCodesPlugin?.delegatedRestoreFailed(args["errorMessage"] as? String, result)

example/lib/screens/no_codes_screen.dart

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class _NoCodesScreenState extends State<NoCodesScreen> {
9292
bool _animated = true;
9393
bool _purchaseDelegateEnabled = false;
9494
SamplePurchaseDelegate? _purchaseDelegate;
95+
NoCodesTheme _selectedTheme = NoCodesTheme.auto;
9596

9697
@override
9798
void dispose() {
@@ -131,6 +132,8 @@ class _NoCodesScreenState extends State<NoCodesScreen> {
131132
const SizedBox(height: 16),
132133
_buildLocaleSection(),
133134
const SizedBox(height: 16),
135+
_buildThemeSection(),
136+
const SizedBox(height: 16),
134137
_buildActionsSection(),
135138
const SizedBox(height: 16),
136139
_buildEventsSection(appState),
@@ -346,6 +349,36 @@ class _NoCodesScreenState extends State<NoCodesScreen> {
346349
);
347350
}
348351

352+
Widget _buildThemeSection() {
353+
return SectionCard(
354+
title: 'Theme',
355+
child: Column(
356+
crossAxisAlignment: CrossAxisAlignment.stretch,
357+
children: [
358+
Text(
359+
'Select theme mode',
360+
style: TextStyle(
361+
fontSize: 13,
362+
fontWeight: FontWeight.w500,
363+
color: Colors.grey.shade700,
364+
),
365+
),
366+
const SizedBox(height: 8),
367+
...NoCodesTheme.values.map((theme) => _buildRadioTile(
368+
title: theme.name,
369+
value: theme,
370+
groupValue: _selectedTheme,
371+
onChanged: (value) {
372+
if (value != null) {
373+
_setTheme(value);
374+
}
375+
},
376+
)),
377+
],
378+
),
379+
);
380+
}
381+
349382
Widget _buildActionsSection() {
350383
return SectionCard(
351384
title: 'Actions',
@@ -507,6 +540,21 @@ class _NoCodesScreenState extends State<NoCodesScreen> {
507540
}
508541
}
509542

543+
void _setTheme(NoCodesTheme theme) async {
544+
try {
545+
debugPrint('🔄 [NoCodes] Setting theme: ${theme.name}');
546+
await NoCodes.getSharedInstance().setTheme(theme);
547+
setState(() {
548+
_selectedTheme = theme;
549+
});
550+
debugPrint('✅ [NoCodes] Theme set');
551+
_showSuccess('Theme set to: ${theme.name}');
552+
} catch (e) {
553+
debugPrint('❌ [NoCodes] Failed to set theme: $e');
554+
_showError('Failed to set theme: $e');
555+
}
556+
}
557+
510558
void _showSuccess(String message) {
511559
ScaffoldMessenger.of(context).showSnackBar(
512560
SnackBar(content: Text(message), backgroundColor: AppTheme.successColor),

ios/Classes/NoCodesPlugin.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public class NoCodesPlugin: NSObject {
9090

9191
let proxyUrl = args["proxyUrl"] as? String
9292
let locale = args["locale"] as? String
93-
noCodesSandwich?.initialize(projectKey: projectKey, proxyUrl: proxyUrl, locale: locale)
93+
let theme = args["theme"] as? String
94+
noCodesSandwich?.initialize(projectKey: projectKey, proxyUrl: proxyUrl, locale: locale, theme: theme)
9495
result(nil)
9596
}
9697

@@ -126,6 +127,11 @@ public class NoCodesPlugin: NSObject {
126127
result(nil)
127128
}
128129

130+
public func setTheme(_ theme: String?, _ result: @escaping FlutterResult) {
131+
noCodesSandwich?.setTheme(theme)
132+
result(nil)
133+
}
134+
129135
// MARK: - Purchase Delegate Methods
130136

131137
public func setPurchaseDelegate(_ result: @escaping FlutterResult) {

ios/Classes/SwiftQonversionPlugin.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
185185
noCodesPlugin?.setLocale(args["locale"] as? String, result)
186186
return
187187

188+
case "setNoCodesTheme":
189+
noCodesPlugin?.setTheme(args["theme"] as? String, result)
190+
return
191+
188192
case "delegatedPurchaseFailed":
189193
noCodesPlugin?.delegatedPurchaseFailed(args, result)
190194
return

ios/qonversion_flutter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
s.source_files = 'Classes/**/*'
1717
s.dependency 'Flutter'
1818
s.platform = :ios, '13.0'
19-
s.dependency "QonversionSandwich", "7.3.1"
19+
s.dependency "QonversionSandwich", "7.4.0"
2020

2121
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
2222
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }

lib/qonversion_flutter.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export 'src/dto/entitlements_cache_lifetime.dart';
88
export 'src/dto/environment.dart';
99
export 'src/dto/launch_mode.dart';
1010
export 'src/dto/nocodes_events.dart';
11+
export 'src/dto/nocodes_theme.dart';
1112
export 'src/dto/offerings.dart';
1213
export 'src/dto/presentation_config.dart';
1314
export 'src/dto/product.dart';

lib/src/dto/nocodes_theme.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// Theme mode for No-Code screens.
2+
/// Use this to control how screens adapt to light/dark themes.
3+
enum NoCodesTheme {
4+
/// Automatically follow the device's system appearance (default).
5+
/// The screen will use light theme in light mode and dark theme in dark mode.
6+
auto,
7+
8+
/// Force light theme regardless of device settings.
9+
light,
10+
11+
/// Force dark theme regardless of device settings.
12+
dark,
13+
}

0 commit comments

Comments
 (0)