@kontextso/sdk-react-native 3.3.0-rc.5 → 3.3.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.
- package/android/build.gradle +1 -0
- package/android/src/main/java/so/kontext/react/RNKontextModuleImpl.kt +34 -27
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +529 -534
- package/dist/index.mjs +507 -472
- package/package.json +2 -2
- package/src/NativeRNKontext.ts +1 -1
package/android/build.gradle
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
package so.kontext.react
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.bridge.Promise
|
|
4
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
3
|
import android.content.Context
|
|
6
|
-
import android.content.SharedPreferences
|
|
7
4
|
import android.media.AudioManager
|
|
8
|
-
import
|
|
5
|
+
import androidx.preference.PreferenceManager
|
|
6
|
+
import com.facebook.react.bridge.Arguments
|
|
7
|
+
import com.facebook.react.bridge.Promise
|
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
|
+
import com.facebook.react.bridge.WritableMap
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
class RNKontextModuleImpl(private val reactContext: ReactApplicationContext) {
|
|
13
|
+
|
|
11
14
|
fun isSoundOn(promise: Promise?) {
|
|
12
15
|
val audioManager = reactContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
|
13
16
|
val current = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
|
|
@@ -19,34 +22,38 @@ class RNKontextModuleImpl(private val reactContext: ReactApplicationContext) {
|
|
|
19
22
|
|
|
20
23
|
fun getTcfData(promise: Promise?) {
|
|
21
24
|
if (promise == null) return
|
|
22
|
-
|
|
25
|
+
|
|
23
26
|
try {
|
|
24
27
|
val prefs = PreferenceManager.getDefaultSharedPreferences(reactContext.applicationContext)
|
|
25
|
-
|
|
28
|
+
|
|
26
29
|
val tcString: String? = prefs.getString("IABTCF_TCString", null)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
|
|
31
|
+
val gdprAppliesRaw: Int? =
|
|
32
|
+
if (prefs.contains("IABTCF_gdprApplies")) {
|
|
33
|
+
try {
|
|
34
|
+
prefs.getInt("IABTCF_gdprApplies", 0)
|
|
35
|
+
} catch (_: Throwable) {
|
|
36
|
+
prefs.getString("IABTCF_gdprApplies", null)?.toIntOrNull()
|
|
37
|
+
}
|
|
38
|
+
} else null
|
|
39
|
+
|
|
40
|
+
val gdprApplies: Int? = when (gdprAppliesRaw) {
|
|
41
|
+
0 -> 0
|
|
42
|
+
1 -> 1
|
|
43
|
+
else -> null
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
val out =
|
|
44
|
-
|
|
45
|
-
out
|
|
46
|
-
|
|
45
|
+
|
|
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
|
+
|
|
51
|
+
promise.resolve(out)
|
|
52
|
+
} catch (_: Throwable) {
|
|
53
|
+
val out: WritableMap = Arguments.createMap()
|
|
54
|
+
out.putNull("tcString")
|
|
55
|
+
out.putNull("gdprApplies")
|
|
47
56
|
promise.resolve(out)
|
|
48
|
-
} catch (t: Throwable) {
|
|
49
|
-
promise.reject("TCF_ERROR", "Failed to read IABTCF TC data from SharedPreferences", t)
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
|
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 };
|