@saltware/fidbek-react-native 0.1.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/README.md +181 -0
- package/android/build.gradle +75 -0
- package/android/libs/fidbek-android.aar +0 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/fidbek/reactnative/FidbekBridge.kt +39 -0
- package/android/src/newarch/com/fidbek/reactnative/FidbekReactNativeModule.kt +28 -0
- package/android/src/newarch/com/fidbek/reactnative/FidbekReactNativePackage.kt +82 -0
- package/app.plugin.js +5 -0
- package/fidbek-react-native.podspec +30 -0
- package/ios/FidbekReactNative.h +10 -0
- package/ios/FidbekReactNative.mm +57 -0
- package/ios/FidbekReactNativeBridge.swift +20 -0
- package/ios/FidbekSDK.xcframework/Info.plist +44 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/FidbekSDK +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Info.plist +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios.abi.json +805 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios.package.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64/FidbekSDK.framework/Modules/module.modulemap +4 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/FidbekSDK +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Info.plist +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +805 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +805 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/FidbekSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +26 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/Modules/module.modulemap +4 -0
- package/ios/FidbekSDK.xcframework/ios-arm64_x86_64-simulator/FidbekSDK.framework/_CodeSignature/CodeResources +101 -0
- package/package.json +53 -0
- package/react-native.config.js +11 -0
- package/src/NativeFidbekReactNative.ts +10 -0
- package/src/NativeFidbekReactNativeModule.js +3 -0
- package/src/index.d.ts +17 -0
- package/src/index.js +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# @saltware/fidbek-react-native
|
|
2
|
+
|
|
3
|
+
Fidbek SDK bridge for React Native with TurboModule (New Architecture / JSI).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- React Native CLI support
|
|
8
|
+
- Expo support (development builds via `expo prebuild` / `expo run`)
|
|
9
|
+
- New Architecture only (TurboModule/JSI)
|
|
10
|
+
- API parity with native and Flutter wrappers:
|
|
11
|
+
- `configure({ token, shakeToOpenEnabled })`
|
|
12
|
+
- `open()`
|
|
13
|
+
- `shutdown()`
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @saltware/fidbek-react-native
|
|
19
|
+
# or
|
|
20
|
+
yarn add @saltware/fidbek-react-native
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Local Development (Package Path)
|
|
24
|
+
|
|
25
|
+
If your app uses a local package path (for example `file:../fidbek-react-native`), keep the import as:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import Fidbek from '@saltware/fidbek-react-native';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Do not import by file-system path in app code.
|
|
32
|
+
|
|
33
|
+
### React Native CLI local setup
|
|
34
|
+
|
|
35
|
+
1. Install from local path in your app `package.json`:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@saltware/fidbek-react-native": "file:../fidbek-react-native"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
2. Add Metro config (`metro.config.js`) so symlinked package resolution works:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const path = require('path');
|
|
49
|
+
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
|
|
50
|
+
|
|
51
|
+
const projectRoot = __dirname;
|
|
52
|
+
const packageRoot = path.resolve(projectRoot, '../fidbek-react-native');
|
|
53
|
+
|
|
54
|
+
const config = {
|
|
55
|
+
watchFolders: [packageRoot],
|
|
56
|
+
resolver: {
|
|
57
|
+
unstable_enableSymlinks: true,
|
|
58
|
+
nodeModulesPaths: [path.resolve(projectRoot, 'node_modules')],
|
|
59
|
+
extraNodeModules: {
|
|
60
|
+
'@saltware/fidbek-react-native': packageRoot,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
module.exports = mergeConfig(getDefaultConfig(projectRoot), config);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
3. If iOS build fails on `[CP] Embed Pods Frameworks` with symlink/codesign errors, patch your `ios/Podfile` `post_install` to replace `--links` with `--copy-links` in `Pods-<App>-frameworks.sh`:
|
|
69
|
+
|
|
70
|
+
```rb
|
|
71
|
+
post_install do |installer|
|
|
72
|
+
react_native_post_install(installer, config[:reactNativePath], :mac_catalyst_enabled => false)
|
|
73
|
+
|
|
74
|
+
frameworks_script_path = File.join(
|
|
75
|
+
installer.sandbox.root,
|
|
76
|
+
'Target Support Files',
|
|
77
|
+
'Pods-YourAppName',
|
|
78
|
+
'Pods-YourAppName-frameworks.sh'
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
if File.exist?(frameworks_script_path)
|
|
82
|
+
content = File.read(frameworks_script_path)
|
|
83
|
+
patched = content.gsub('--links --filter "- CVS/"', '--copy-links --filter "- CVS/"')
|
|
84
|
+
File.write(frameworks_script_path, patched) if patched != content
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Expo local setup
|
|
90
|
+
|
|
91
|
+
1. Install from local path in your Expo app:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"dependencies": {
|
|
96
|
+
"@saltware/fidbek-react-native": "file:../fidbek-react-native"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
2. Add Metro config (`metro.config.js`) for local package resolution:
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
const path = require('path');
|
|
105
|
+
const { getDefaultConfig } = require('expo/metro-config');
|
|
106
|
+
|
|
107
|
+
const projectRoot = __dirname;
|
|
108
|
+
const packageRoot = path.resolve(projectRoot, '../fidbek-react-native');
|
|
109
|
+
|
|
110
|
+
const config = getDefaultConfig(projectRoot);
|
|
111
|
+
|
|
112
|
+
config.watchFolders = [packageRoot];
|
|
113
|
+
config.resolver.unstable_enableSymlinks = true;
|
|
114
|
+
config.resolver.nodeModulesPaths = [path.resolve(projectRoot, 'node_modules')];
|
|
115
|
+
config.resolver.extraNodeModules = {
|
|
116
|
+
...(config.resolver.extraNodeModules || {}),
|
|
117
|
+
'@saltware/fidbek-react-native': packageRoot,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
module.exports = config;
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Architecture Support
|
|
124
|
+
|
|
125
|
+
- Supported: React Native New Architecture (`newArchEnabled=true`)
|
|
126
|
+
- Not supported: Old Architecture (legacy bridge)
|
|
127
|
+
|
|
128
|
+
## React Native CLI
|
|
129
|
+
|
|
130
|
+
### iOS
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
cd ios && pod install
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Android
|
|
137
|
+
|
|
138
|
+
No manual step is required after autolinking.
|
|
139
|
+
|
|
140
|
+
## Expo
|
|
141
|
+
|
|
142
|
+
This package contains custom native code. Use an Expo development build:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npx expo prebuild
|
|
146
|
+
npx expo run:ios
|
|
147
|
+
npx expo run:android
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`Expo Go` is not supported because the module includes native binaries.
|
|
151
|
+
|
|
152
|
+
Optional `app.json` plugin entry:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"expo": {
|
|
157
|
+
"plugins": ["@saltware/fidbek-react-native"]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Usage
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import Fidbek from '@saltware/fidbek-react-native';
|
|
166
|
+
|
|
167
|
+
await Fidbek.configure({
|
|
168
|
+
token: 'YOUR_PUBLIC_TOKEN',
|
|
169
|
+
shakeToOpenEnabled: true,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
await Fidbek.open();
|
|
173
|
+
|
|
174
|
+
await Fidbek.shutdown();
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Requirements
|
|
178
|
+
|
|
179
|
+
- iOS 13+
|
|
180
|
+
- Android minSdk 24+
|
|
181
|
+
- React Native 0.75+ with New Architecture enabled
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.kotlin_version = "1.9.24"
|
|
3
|
+
repositories {
|
|
4
|
+
google()
|
|
5
|
+
mavenCentral()
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
dependencies {
|
|
9
|
+
classpath "com.android.tools.build:gradle:8.5.2"
|
|
10
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
def safeExtGet(prop, fallback) {
|
|
15
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def isNewArchitectureEnabled() {
|
|
19
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!isNewArchitectureEnabled()) {
|
|
23
|
+
throw new GradleException(
|
|
24
|
+
"@saltware/fidbek-react-native requires React Native New Architecture. " +
|
|
25
|
+
"Set newArchEnabled=true in android/gradle.properties."
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
apply plugin: "com.android.library"
|
|
30
|
+
apply plugin: "kotlin-android"
|
|
31
|
+
apply plugin: "com.facebook.react"
|
|
32
|
+
|
|
33
|
+
android {
|
|
34
|
+
namespace "com.fidbek.reactnative"
|
|
35
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
36
|
+
|
|
37
|
+
defaultConfig {
|
|
38
|
+
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
sourceSets {
|
|
42
|
+
main {
|
|
43
|
+
java.srcDirs += ["src/main/java", "src/newarch"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
compileOptions {
|
|
48
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
49
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
kotlinOptions {
|
|
53
|
+
jvmTarget = "17"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
repositories {
|
|
58
|
+
google()
|
|
59
|
+
mavenCentral()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
dependencies {
|
|
63
|
+
implementation files("libs/fidbek-android.aar")
|
|
64
|
+
implementation "com.facebook.react:react-android"
|
|
65
|
+
implementation "androidx.core:core-ktx:1.13.1"
|
|
66
|
+
implementation "androidx.appcompat:appcompat:1.7.0"
|
|
67
|
+
implementation "com.google.android.material:material:1.12.0"
|
|
68
|
+
implementation "com.squareup.okhttp3:okhttp:4.12.0"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
react {
|
|
72
|
+
jsRootDir = file("../")
|
|
73
|
+
libraryName = "FidbekReactNative"
|
|
74
|
+
codegenJavaPackageName = "com.fidbek.reactnative"
|
|
75
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package com.fidbek.reactnative
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.fidbek.sdk.Fidbek
|
|
7
|
+
|
|
8
|
+
internal object FidbekBridge {
|
|
9
|
+
fun configure(
|
|
10
|
+
reactContext: ReactApplicationContext,
|
|
11
|
+
token: String,
|
|
12
|
+
shakeToOpenEnabled: Boolean,
|
|
13
|
+
promise: Promise
|
|
14
|
+
) {
|
|
15
|
+
if (token.isBlank()) {
|
|
16
|
+
promise.reject("ERR_INVALID_ARGUMENT", "token is required")
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
val application = reactContext.applicationContext as? Application
|
|
21
|
+
if (application == null) {
|
|
22
|
+
promise.reject("ERR_NO_APPLICATION", "Application context is unavailable")
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Fidbek.initialize(application, token, shakeToOpenEnabled)
|
|
27
|
+
promise.resolve(null)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
fun open(promise: Promise) {
|
|
31
|
+
Fidbek.open()
|
|
32
|
+
promise.resolve(null)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fun shutdown(promise: Promise) {
|
|
36
|
+
Fidbek.shutdown()
|
|
37
|
+
promise.resolve(null)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.fidbek.reactnative
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
6
|
+
|
|
7
|
+
@ReactModule(name = FidbekReactNativeModule.NAME)
|
|
8
|
+
class FidbekReactNativeModule(
|
|
9
|
+
private val reactContext: ReactApplicationContext
|
|
10
|
+
) : NativeFidbekReactNativeSpec(reactContext) {
|
|
11
|
+
override fun getName(): String = NAME
|
|
12
|
+
|
|
13
|
+
override fun configure(token: String, shakeToOpenEnabled: Boolean, promise: Promise) {
|
|
14
|
+
FidbekBridge.configure(reactContext, token, shakeToOpenEnabled, promise)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override fun open(promise: Promise) {
|
|
18
|
+
FidbekBridge.open(promise)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun shutdown(promise: Promise) {
|
|
22
|
+
FidbekBridge.shutdown(promise)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
companion object {
|
|
26
|
+
const val NAME = "FidbekReactNative"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
package com.fidbek.reactnative
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.TurboReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
|
|
9
|
+
class FidbekReactNativePackage : TurboReactPackage() {
|
|
10
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
11
|
+
return if (name == FidbekReactNativeModule.NAME) {
|
|
12
|
+
FidbekReactNativeModule(reactContext)
|
|
13
|
+
} else {
|
|
14
|
+
null
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
19
|
+
return ReactModuleInfoProvider {
|
|
20
|
+
val moduleInfos = HashMap<String, ReactModuleInfo>()
|
|
21
|
+
moduleInfos[FidbekReactNativeModule.NAME] = createReactModuleInfo(
|
|
22
|
+
name = FidbekReactNativeModule.NAME,
|
|
23
|
+
className = FidbekReactNativeModule::class.java.name,
|
|
24
|
+
canOverrideExistingModule = false,
|
|
25
|
+
needsEagerInit = false,
|
|
26
|
+
hasConstants = false,
|
|
27
|
+
isCxxModule = false,
|
|
28
|
+
isTurboModule = true
|
|
29
|
+
)
|
|
30
|
+
moduleInfos
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private fun createReactModuleInfo(
|
|
35
|
+
name: String,
|
|
36
|
+
className: String,
|
|
37
|
+
canOverrideExistingModule: Boolean,
|
|
38
|
+
needsEagerInit: Boolean,
|
|
39
|
+
hasConstants: Boolean,
|
|
40
|
+
isCxxModule: Boolean,
|
|
41
|
+
isTurboModule: Boolean
|
|
42
|
+
): ReactModuleInfo {
|
|
43
|
+
return try {
|
|
44
|
+
val constructor = ReactModuleInfo::class.java.getDeclaredConstructor(
|
|
45
|
+
String::class.java,
|
|
46
|
+
String::class.java,
|
|
47
|
+
Boolean::class.javaPrimitiveType,
|
|
48
|
+
Boolean::class.javaPrimitiveType,
|
|
49
|
+
Boolean::class.javaPrimitiveType,
|
|
50
|
+
Boolean::class.javaPrimitiveType,
|
|
51
|
+
Boolean::class.javaPrimitiveType
|
|
52
|
+
)
|
|
53
|
+
constructor.newInstance(
|
|
54
|
+
name,
|
|
55
|
+
className,
|
|
56
|
+
canOverrideExistingModule,
|
|
57
|
+
needsEagerInit,
|
|
58
|
+
hasConstants,
|
|
59
|
+
isCxxModule,
|
|
60
|
+
isTurboModule
|
|
61
|
+
)
|
|
62
|
+
} catch (_: NoSuchMethodException) {
|
|
63
|
+
val constructor = ReactModuleInfo::class.java.getDeclaredConstructor(
|
|
64
|
+
String::class.java,
|
|
65
|
+
String::class.java,
|
|
66
|
+
Boolean::class.javaPrimitiveType,
|
|
67
|
+
Boolean::class.javaPrimitiveType,
|
|
68
|
+
Boolean::class.javaPrimitiveType,
|
|
69
|
+
Boolean::class.javaPrimitiveType
|
|
70
|
+
)
|
|
71
|
+
@Suppress("DEPRECATION")
|
|
72
|
+
constructor.newInstance(
|
|
73
|
+
name,
|
|
74
|
+
className,
|
|
75
|
+
canOverrideExistingModule,
|
|
76
|
+
needsEagerInit,
|
|
77
|
+
isCxxModule,
|
|
78
|
+
isTurboModule
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "fidbek-react-native"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = "UNLICENSED"
|
|
11
|
+
s.authors = { "Fidbek" => "support@fidbek.com" }
|
|
12
|
+
s.source = { :git => package.dig("repository", "url"), :tag => s.version }
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => "13.0" }
|
|
15
|
+
s.swift_version = "5.9"
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
|
|
18
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
19
|
+
s.vendored_frameworks = "ios/FidbekSDK.xcframework"
|
|
20
|
+
|
|
21
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
22
|
+
install_modules_dependencies(s)
|
|
23
|
+
else
|
|
24
|
+
s.dependency "React-Core"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
s.pod_target_xcconfig = {
|
|
28
|
+
"DEFINES_MODULE" => "YES"
|
|
29
|
+
}
|
|
30
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
#import "RNFidbekReactNativeSpec.h"
|
|
5
|
+
@interface FidbekReactNative : NSObject <NativeFidbekReactNativeSpec>
|
|
6
|
+
#else
|
|
7
|
+
@interface FidbekReactNative : NSObject <RCTBridgeModule>
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
@end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#import "FidbekReactNative.h"
|
|
2
|
+
#import <memory>
|
|
3
|
+
|
|
4
|
+
#if __has_include(<fidbek_react_native/fidbek_react_native-Swift.h>)
|
|
5
|
+
#import <fidbek_react_native/fidbek_react_native-Swift.h>
|
|
6
|
+
#else
|
|
7
|
+
#import "fidbek_react_native-Swift.h"
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
|
11
|
+
#error "@saltware/fidbek-react-native requires React Native New Architecture (TurboModules)."
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
@implementation FidbekReactNative
|
|
15
|
+
|
|
16
|
+
RCT_EXPORT_MODULE()
|
|
17
|
+
|
|
18
|
+
+ (BOOL)requiresMainQueueSetup
|
|
19
|
+
{
|
|
20
|
+
return NO;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
RCT_EXPORT_METHOD(configure:(NSString *)token
|
|
24
|
+
shakeToOpenEnabled:(BOOL)shakeToOpenEnabled
|
|
25
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
26
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
27
|
+
{
|
|
28
|
+
if (token == nil || token.length == 0) {
|
|
29
|
+
reject(@"ERR_INVALID_ARGUMENT", @"token is required", nil);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[FidbekReactNativeBridge configureWithToken:token shakeToOpenEnabled:shakeToOpenEnabled];
|
|
34
|
+
resolve(nil);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
RCT_EXPORT_METHOD(open:(RCTPromiseResolveBlock)resolve
|
|
38
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
39
|
+
{
|
|
40
|
+
[FidbekReactNativeBridge presentWidget];
|
|
41
|
+
resolve(nil);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
RCT_EXPORT_METHOD(shutdown:(RCTPromiseResolveBlock)resolve
|
|
45
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
46
|
+
{
|
|
47
|
+
[FidbekReactNativeBridge stopWidget];
|
|
48
|
+
resolve(nil);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
52
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
53
|
+
{
|
|
54
|
+
return std::make_shared<facebook::react::NativeFidbekReactNativeSpecJSI>(params);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import FidbekSDK
|
|
3
|
+
|
|
4
|
+
@objc(FidbekReactNativeBridge)
|
|
5
|
+
public final class FidbekReactNativeBridge: NSObject {
|
|
6
|
+
@objc
|
|
7
|
+
public static func configure(token: String, shakeToOpenEnabled: Bool) {
|
|
8
|
+
Fidbek.shared.configure(token: token, shakeToOpenEnabled: shakeToOpenEnabled)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc
|
|
12
|
+
public static func presentWidget() {
|
|
13
|
+
Fidbek.shared.present()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@objc
|
|
17
|
+
public static func stopWidget() {
|
|
18
|
+
Fidbek.shared.stop()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>FidbekSDK.framework/FidbekSDK</string>
|
|
10
|
+
<key>LibraryIdentifier</key>
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
|
+
<key>LibraryPath</key>
|
|
13
|
+
<string>FidbekSDK.framework</string>
|
|
14
|
+
<key>SupportedArchitectures</key>
|
|
15
|
+
<array>
|
|
16
|
+
<string>arm64</string>
|
|
17
|
+
</array>
|
|
18
|
+
<key>SupportedPlatform</key>
|
|
19
|
+
<string>ios</string>
|
|
20
|
+
</dict>
|
|
21
|
+
<dict>
|
|
22
|
+
<key>BinaryPath</key>
|
|
23
|
+
<string>FidbekSDK.framework/FidbekSDK</string>
|
|
24
|
+
<key>LibraryIdentifier</key>
|
|
25
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
26
|
+
<key>LibraryPath</key>
|
|
27
|
+
<string>FidbekSDK.framework</string>
|
|
28
|
+
<key>SupportedArchitectures</key>
|
|
29
|
+
<array>
|
|
30
|
+
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
32
|
+
</array>
|
|
33
|
+
<key>SupportedPlatform</key>
|
|
34
|
+
<string>ios</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
37
|
+
</dict>
|
|
38
|
+
</array>
|
|
39
|
+
<key>CFBundlePackageType</key>
|
|
40
|
+
<string>XFWK</string>
|
|
41
|
+
<key>XCFrameworkFormatVersion</key>
|
|
42
|
+
<string>1.0</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</plist>
|