Skip to content

Commit bf715ff

Browse files
authored
Merge pull request #412 from qonversion/release/10.2.0
2 parents 5fd4106 + 9706174 commit bf715ff

File tree

16 files changed

+135
-25
lines changed

16 files changed

+135
-25
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
node-version: '22.x'
2727
registry-url: 'https://registry.npmjs.org'
2828

29+
- name: Upgrade npm
30+
run: npm install -g [email protected]
31+
2932
- name: Build
3033
run: |
3134
yarn

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
8080
dependencies {
8181
implementation "com.facebook.react:react-android"
8282
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
83-
implementation "io.qonversion:sandwich:7.3.1"
83+
implementation "io.qonversion:sandwich:7.4.0"
8484
}
8585

8686
if (isNewArchitectureEnabled()) {

android/src/main/java/com/qonversion/reactnativesdk/NoCodesModule.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class NoCodesModule(private val reactContext: ReactApplicationContext) : NativeN
4343
}
4444

4545
@ReactMethod
46-
override fun initialize(projectKey: String, source: String, version: String, proxyUrl: String?, locale: String?) {
46+
override fun initialize(projectKey: String, source: String, version: String, proxyUrl: String?, locale: String?, theme: String?) {
4747
noCodesSandwich.storeSdkInfo(reactContext, source, version)
48-
noCodesSandwich.initialize(reactContext, projectKey, null, null, proxyUrl, locale)
48+
noCodesSandwich.initialize(reactContext, projectKey, null, null, proxyUrl, locale, theme)
4949
noCodesSandwich.setDelegate(noCodesEventListener)
5050
noCodesSandwich.setScreenCustomizationDelegate()
5151
}
@@ -111,6 +111,11 @@ class NoCodesModule(private val reactContext: ReactApplicationContext) : NativeN
111111
noCodesSandwich.setLocale(locale)
112112
}
113113

114+
@ReactMethod
115+
override fun setTheme(theme: String?) {
116+
noCodesSandwich.setTheme(theme)
117+
}
118+
114119
companion object {
115120
const val NAME = "RNNoCodes"
116121
}

example/ios/Podfile.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ PODS:
88
- hermes-engine (0.80.1):
99
- hermes-engine/Pre-built (= 0.80.1)
1010
- hermes-engine/Pre-built (0.80.1)
11-
- Qonversion (6.3.0):
12-
- Qonversion/Main (= 6.3.0)
13-
- qonversion-react-native-sdk (10.0.2):
11+
- Qonversion (6.4.0):
12+
- Qonversion/Main (= 6.4.0)
13+
- qonversion-react-native-sdk (10.1.1):
1414
- boost
1515
- DoubleConversion
1616
- fast_float
1717
- fmt
1818
- glog
1919
- hermes-engine
20-
- QonversionSandwich (= 7.3.0)
20+
- QonversionSandwich (= 7.4.0)
2121
- RCT-Folly
2222
- RCT-Folly/Fabric
2323
- RCTRequired
@@ -40,9 +40,9 @@ PODS:
4040
- ReactCommon/turbomodule/core
4141
- SocketRocket
4242
- Yoga
43-
- Qonversion/Main (6.3.0)
44-
- QonversionSandwich (7.3.0):
45-
- Qonversion (= 6.3.0)
43+
- Qonversion/Main (6.4.0)
44+
- QonversionSandwich (7.4.0):
45+
- Qonversion (= 6.4.0)
4646
- RCT-Folly (2024.11.18.00):
4747
- boost
4848
- DoubleConversion
@@ -2437,9 +2437,9 @@ SPEC CHECKSUMS:
24372437
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
24382438
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
24392439
hermes-engine: 4f07404533b808de66cf48ac4200463068d0e95a
2440-
Qonversion: 8f8fb604e2b9fb442eeb6a7aefcbc6bd73c3b55a
2441-
qonversion-react-native-sdk: a11f2ab3bb7f7a89d8c16523e8b7b90985358455
2442-
QonversionSandwich: 046f2896c41037f3f58df63e4f22bd351312eeef
2440+
Qonversion: f7620e1cc3b03541b9cf4a0ed357a5646d123fe3
2441+
qonversion-react-native-sdk: a0520e74e9840f14b110f806dd1e7cbd3d093fae
2442+
QonversionSandwich: 58a58f43664d2ddb755b315b51adfe9392ede3f9
24432443
RCT-Folly: 59ec0ac1f2f39672a0c6e6cecdd39383b764646f
24442444
RCTDeprecation: efa5010912100e944a7ac9a93a157e1def1988fe
24452445
RCTRequired: bbc4cf999ddc4a4b076e076c74dd1d39d0254630

example/src/screens/NoCodesScreen/index.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Qonversion, {
1515
ScreenPresentationConfig,
1616
NoCodes,
1717
NoCodesError,
18+
NoCodesTheme,
1819
type PurchaseDelegate,
1920
Product
2021
} from '@qonversion/react-native-sdk';
@@ -35,6 +36,7 @@ const NoCodesScreen: React.FC = () => {
3536
);
3637
const [animated, setAnimated] = useState(false);
3738
const [locale, setLocale] = useState('');
39+
const [theme, setTheme] = useState<NoCodesTheme>(NoCodesTheme.AUTO);
3840

3941
useEffect(() => {
4042
// Initialize No-Codes SDK once
@@ -216,6 +218,22 @@ const NoCodesScreen: React.FC = () => {
216218
}
217219
};
218220

221+
const applyTheme = (selectedTheme: NoCodesTheme) => {
222+
try {
223+
console.log('🔄 [NoCodes] Setting theme to:', selectedTheme);
224+
setTheme(selectedTheme);
225+
NoCodes.getSharedInstance().setTheme(selectedTheme);
226+
console.log('✅ [NoCodes] setTheme() call successful');
227+
Snackbar.show({
228+
text: `Theme set to: ${selectedTheme}`,
229+
duration: Snackbar.LENGTH_SHORT,
230+
});
231+
} catch (error: any) {
232+
console.error('❌ [NoCodes] setTheme() call failed:', error);
233+
Alert.alert('Error', error.message);
234+
}
235+
};
236+
219237
return (
220238
<ScrollView
221239
style={styles.container}
@@ -283,6 +301,23 @@ const NoCodesScreen: React.FC = () => {
283301
</TouchableOpacity>
284302
</View>
285303

304+
<View style={styles.inputContainer}>
305+
<Text style={styles.sectionTitle}>Theme</Text>
306+
<Text style={styles.inputLabel}>Select theme mode:</Text>
307+
{Object.values(NoCodesTheme).map((themeOption) => (
308+
<TouchableOpacity
309+
key={themeOption}
310+
style={[
311+
styles.radioButton,
312+
theme === themeOption && styles.radioButtonSelected,
313+
]}
314+
onPress={() => applyTheme(themeOption)}
315+
>
316+
<Text style={styles.radioButtonText}>{themeOption}</Text>
317+
</TouchableOpacity>
318+
))}
319+
</View>
320+
286321
<TouchableOpacity style={styles.button} onPress={close}>
287322
<Text style={styles.buttonText}>Close</Text>
288323
</TouchableOpacity>

ios/RNNoCodes.mm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ - (void)initialize:(NSString *)projectKey
2626
source:(NSString *)source
2727
version:(NSString *)version
2828
proxyUrl:(NSString *)proxyUrl
29-
locale:(NSString *)locale {
30-
[self.impl initializeWithProjectKey:projectKey source:source version:version proxyUrl:proxyUrl locale:locale];
29+
locale:(NSString *)locale
30+
theme:(NSString *)theme {
31+
[self.impl initializeWithProjectKey:projectKey source:source version:version proxyUrl:proxyUrl locale:locale theme:theme];
3132
}
3233

3334
- (void)setScreenPresentationConfig:(NSDictionary *)configData
@@ -76,6 +77,10 @@ - (void)setLocale:(NSString *)locale {
7677
[self.impl setLocale:locale];
7778
}
7879

80+
- (void)setTheme:(NSString *)theme {
81+
[self.impl setTheme:theme];
82+
}
83+
7984
#pragma mark - NoCodesEventDelegate
8085

8186
- (void)noCodesDidTriggerWithEvent:(NSString * _Nonnull)event payload:(NSDictionary<NSString *,id> * _Nullable)payload {

ios/RNNoCodesImpl.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public class RNNoCodesImpl: NSObject {
6565
}
6666

6767
@objc
68-
public func initialize(projectKey: String, source: String, version: String, proxyUrl: String?, locale: String?) {
68+
public func initialize(projectKey: String, source: String, version: String, proxyUrl: String?, locale: String?, theme: String?) {
6969
// Ignore source and version, because it's taken from the Qonversion SDK.
70-
noCodesSandwich?.initialize(projectKey: projectKey, proxyUrl: proxyUrl, locale: locale)
70+
noCodesSandwich?.initialize(projectKey: projectKey, proxyUrl: proxyUrl, locale: locale, theme: theme)
7171
}
7272

7373
@MainActor @objc
@@ -121,4 +121,9 @@ public class RNNoCodesImpl: NSObject {
121121
public func setLocale(_ locale: String?) {
122122
noCodesSandwich?.setLocale(locale)
123123
}
124+
125+
@objc
126+
public func setTheme(_ theme: String?) {
127+
noCodesSandwich?.setTheme(theme)
128+
}
124129
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@qonversion/react-native-sdk",
33
"title": "React Native Qonversion",
4-
"version": "10.1.1",
4+
"version": "10.2.0",
55
"description": "Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and content using our StoreKit wrapper and Google Play Billing wrapper.",
66
"main": "./lib/module/index.js",
77
"types": "./lib/typescript/src/index.d.ts",

qonversion-react-native-sdk.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ Pod::Spec.new do |s|
1616
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
1717
s.private_header_files = "ios/**/*.h"
1818

19-
s.dependency "QonversionSandwich", "7.3.1"
19+
s.dependency "QonversionSandwich", "7.4.0"
2020
install_modules_dependencies(s)
2121
end

src/NoCodesApi.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ScreenPresentationConfig from './dto/ScreenPresentationConfig';
2+
import type { NoCodesTheme } from './dto/enums';
23

34
export default interface NoCodesApi {
45
/**
@@ -28,4 +29,13 @@ export default interface NoCodesApi {
2829
* @param locale the locale to use (e.g. "en", "de", "fr"), or null to reset to device default.
2930
*/
3031
setLocale(locale: string | null): void;
32+
33+
/**
34+
* Set the theme mode for No-Code screens.
35+
* Controls how screens adapt to light/dark themes.
36+
*
37+
* @param theme the desired theme mode. Use {@link NoCodesTheme.AUTO} to follow device settings,
38+
* {@link NoCodesTheme.LIGHT} to force light theme, or {@link NoCodesTheme.DARK} to force dark theme.
39+
*/
40+
setTheme(theme: NoCodesTheme): void;
3141
}

0 commit comments

Comments
 (0)