@kontextso/sdk-react-native 3.3.0-rc.6 → 3.3.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,10 +3,14 @@ package so.kontext.react
3
3
  import android.content.Context
4
4
  import android.media.AudioManager
5
5
  import androidx.preference.PreferenceManager
6
+ import com.facebook.react.bridge.Arguments
6
7
  import com.facebook.react.bridge.Promise
7
8
  import com.facebook.react.bridge.ReactApplicationContext
9
+ import com.facebook.react.bridge.WritableMap
10
+
8
11
 
9
12
  class RNKontextModuleImpl(private val reactContext: ReactApplicationContext) {
13
+
10
14
  fun isSoundOn(promise: Promise?) {
11
15
  val audioManager = reactContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
12
16
  val current = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
@@ -26,11 +30,9 @@ class RNKontextModuleImpl(private val reactContext: ReactApplicationContext) {
26
30
 
27
31
  val gdprAppliesRaw: Int? =
28
32
  if (prefs.contains("IABTCF_gdprApplies")) {
29
- // Most CMPs store as Int
30
33
  try {
31
34
  prefs.getInt("IABTCF_gdprApplies", 0)
32
35
  } catch (_: Throwable) {
33
- // Some CMPs might store as String
34
36
  prefs.getString("IABTCF_gdprApplies", null)?.toIntOrNull()
35
37
  }
36
38
  } else null
@@ -41,15 +43,16 @@ class RNKontextModuleImpl(private val reactContext: ReactApplicationContext) {
41
43
  else -> null
42
44
  }
43
45
 
44
- val out = HashMap<String, Any?>(2)
45
- out["tcString"] = tcString
46
- out["gdprApplies"] = gdprApplies
46
+ val out: WritableMap = Arguments.createMap()
47
+
48
+ if (tcString != null) out.putString("tcString", tcString) else out.putNull("tcString")
49
+ if (gdprApplies != null) out.putInt("gdprApplies", gdprApplies) else out.putNull("gdprApplies")
50
+
47
51
  promise.resolve(out)
48
52
  } catch (_: Throwable) {
49
- // Don’t break preload if reading fails
50
- val out = HashMap<String, Any?>(2)
51
- out["tcString"] = null
52
- out["gdprApplies"] = null
53
+ val out: WritableMap = Arguments.createMap()
54
+ out.putNull("tcString")
55
+ out.putNull("gdprApplies")
53
56
  promise.resolve(out)
54
57
  }
55
58
  }
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime'
2
- import { FormatProps, AdsProviderProps } from '@kontextso/sdk-react'
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { FormatProps, AdsProviderProps } from '@kontextso/sdk-react';
3
3
 
4
- declare const InlineAd: ({ code, messageId, wrapper, ...props }: FormatProps) => react_jsx_runtime.JSX.Element
4
+ declare const InlineAd: ({ code, messageId, wrapper, ...props }: FormatProps) => react_jsx_runtime.JSX.Element;
5
5
 
6
- declare const AdsProvider: (props: AdsProviderProps) => react_jsx_runtime.JSX.Element
6
+ declare const AdsProvider: (props: AdsProviderProps) => react_jsx_runtime.JSX.Element;
7
7
 
8
- export { AdsProvider, InlineAd }
8
+ export { AdsProvider, InlineAd };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime'
2
- import { FormatProps, AdsProviderProps } from '@kontextso/sdk-react'
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { FormatProps, AdsProviderProps } from '@kontextso/sdk-react';
3
3
 
4
- declare const InlineAd: ({ code, messageId, wrapper, ...props }: FormatProps) => react_jsx_runtime.JSX.Element
4
+ declare const InlineAd: ({ code, messageId, wrapper, ...props }: FormatProps) => react_jsx_runtime.JSX.Element;
5
5
 
6
- declare const AdsProvider: (props: AdsProviderProps) => react_jsx_runtime.JSX.Element
6
+ declare const AdsProvider: (props: AdsProviderProps) => react_jsx_runtime.JSX.Element;
7
7
 
8
- export { AdsProvider, InlineAd }
8
+ export { AdsProvider, InlineAd };