airborne-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/AirborneReact.podspec +39 -0
- package/LICENSE +20 -0
- package/README.md +98 -0
- package/android/build.gradle +124 -0
- package/android/gradle.properties +19 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/in/juspay/airborneplugin/Airborne.kt +125 -0
- package/android/src/main/java/in/juspay/airborneplugin/AirborneInterface.kt +29 -0
- package/android/src/main/java/in/juspay/airborneplugin/AirborneModule.kt +37 -0
- package/android/src/main/java/in/juspay/airborneplugin/AirborneModuleImpl.kt +71 -0
- package/android/src/main/java/in/juspay/airborneplugin/AirbornePackage.kt +39 -0
- package/android/src/main/java/in/juspay/airborneplugin/AirborneTurboModule.kt +32 -0
- package/ios/Airborne.h +17 -0
- package/ios/Airborne.mm +99 -0
- package/ios/AirborneiOS.h +26 -0
- package/ios/AirborneiOS.m +128 -0
- package/lib/module/NativeAirborne.js +19 -0
- package/lib/module/NativeAirborne.js.map +1 -0
- package/lib/module/index.js +41 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/ExampleOldArch/App.d.ts +4 -0
- package/lib/typescript/ExampleOldArch/App.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeAirborne.d.ts +9 -0
- package/lib/typescript/src/NativeAirborne.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +164 -0
- package/src/NativeAirborne.ts +24 -0
- package/src/index.tsx +53 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Copyright 2025 Juspay Technologies
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require "json"
|
|
16
|
+
|
|
17
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
18
|
+
|
|
19
|
+
Pod::Spec.new do |s|
|
|
20
|
+
s.name = "AirborneReact"
|
|
21
|
+
s.requires_arc = true
|
|
22
|
+
s.module_name = "AirborneReact"
|
|
23
|
+
s.version = package["version"]
|
|
24
|
+
s.summary = package["description"]
|
|
25
|
+
s.homepage = package["homepage"]
|
|
26
|
+
s.license = package["license"]
|
|
27
|
+
s.authors = package["author"]
|
|
28
|
+
|
|
29
|
+
s.platforms = { :ios => "12.0"}
|
|
30
|
+
s.source = { :git => "https://github.com/juspay/airborne.git", :tag => "#{s.version}" }
|
|
31
|
+
s.resource_bundles = {
|
|
32
|
+
'AirborneReactResources' => ['ios/**/*.{xib,storyboard,xcassets,json}']
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
36
|
+
s.private_header_files = "ios/**/*.h"
|
|
37
|
+
|
|
38
|
+
install_modules_dependencies(s)
|
|
39
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 juspay
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# airborne-react-native
|
|
2
|
+
|
|
3
|
+
airborne
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install airborne-react-native
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
# React Native Airborne Implementation Summary
|
|
12
|
+
|
|
13
|
+
This implementation provides a React Native module for Airborne that:
|
|
14
|
+
1. Initializes Airborne in native code (iOS/Android)
|
|
15
|
+
2. Provides React Native methods to access the native Airborne instance
|
|
16
|
+
3. Is compatible with both old and new React Native architectures
|
|
17
|
+
|
|
18
|
+
## Key Features
|
|
19
|
+
|
|
20
|
+
### Native Initialization
|
|
21
|
+
- Airborne should be initialized once in native code when the app starts
|
|
22
|
+
- The instance should be created before React Native initializes
|
|
23
|
+
- This ensures the Airborne instance is ready when React Native needs it
|
|
24
|
+
|
|
25
|
+
### Architecture Compatibility
|
|
26
|
+
- **Old Architecture**: Uses traditional React Native bridge (`AirborneModule`)
|
|
27
|
+
- **New Architecture**: Uses TurboModules with JSI (`AirborneTurboModule`)
|
|
28
|
+
- Automatically detects and uses the appropriate implementation
|
|
29
|
+
|
|
30
|
+
### Shared Implementation
|
|
31
|
+
- Android uses `AirborneModuleImpl` to share logic between architectures
|
|
32
|
+
- iOS uses `AirborneiOS` wrapper to manage the native instance
|
|
33
|
+
- Both platforms follow the same initialization pattern
|
|
34
|
+
|
|
35
|
+
## File Structure
|
|
36
|
+
|
|
37
|
+
### Android
|
|
38
|
+
- `Airborne.kt` - Integration class for Airborne SDK
|
|
39
|
+
- `AirborneInterface.kt` - The interface that has to be implemented by the consumer for providing all the necessary integration params.
|
|
40
|
+
- `AirborneModuleImpl.kt` - Shared implementation logic
|
|
41
|
+
- `AirborneModule.kt` - Old architecture module
|
|
42
|
+
- `AirborneTurboModule.kt` - New architecture module
|
|
43
|
+
- `NativeAirborneSpec.java` - TurboModule spec
|
|
44
|
+
|
|
45
|
+
### iOS
|
|
46
|
+
- `AirborneiOS.h/m` - Integration class for Airborne SDK
|
|
47
|
+
- `Airborne.h/mm` - React Native module implementation
|
|
48
|
+
- Supports both architectures with conditional compilation
|
|
49
|
+
|
|
50
|
+
### JavaScript/TypeScript
|
|
51
|
+
- `NativeAirborne.ts` - TurboModule TypeScript spec
|
|
52
|
+
- `index.tsx` - Module exports with architecture detection
|
|
53
|
+
|
|
54
|
+
## API Methods
|
|
55
|
+
|
|
56
|
+
1. **readReleaseConfig()** - Returns the release configuration as a stringified JSON
|
|
57
|
+
2. **getFileContent(filePath)** - Reads content from a file in the OTA bundle
|
|
58
|
+
3. **getBundlePath()** - Returns the path to the JavaScript bundle
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
### Native Initialization
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### React Native Usage
|
|
67
|
+
```typescript
|
|
68
|
+
import { readReleaseConfig, getFileContent, getBundlePath } from 'airborne-react-native';
|
|
69
|
+
|
|
70
|
+
// Read configuration
|
|
71
|
+
const config = await readReleaseConfig();
|
|
72
|
+
|
|
73
|
+
// Get file content
|
|
74
|
+
const content = await getFileContent('path/to/file.json');
|
|
75
|
+
|
|
76
|
+
// Get bundle path
|
|
77
|
+
const bundlePath = await getBundlePath();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Implementation Notes
|
|
81
|
+
|
|
82
|
+
1. **Thread Safety**: Both Android and iOS implementations are thread-safe
|
|
83
|
+
2. **Error Handling**: All methods return promises that reject with descriptive errors
|
|
84
|
+
3. **Placeholder Implementation**: The iOS implementation includes placeholders for the actual Airborne SDK integration
|
|
85
|
+
|
|
86
|
+
## Next Steps
|
|
87
|
+
|
|
88
|
+
To complete the integration:
|
|
89
|
+
1. Implement additional Airborne features as needed
|
|
90
|
+
2. Add event emitters for callbacks if required
|
|
91
|
+
|
|
92
|
+
## Testing
|
|
93
|
+
|
|
94
|
+
The example app demonstrates:
|
|
95
|
+
- Native initialization in MainApplication/AppDelegate
|
|
96
|
+
- Using all three API methods
|
|
97
|
+
- Status indicator showing initialization state
|
|
98
|
+
- Error handling for failed operations
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Copyright 2025 Juspay Technologies
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import com.android.Version
|
|
16
|
+
|
|
17
|
+
buildscript {
|
|
18
|
+
ext.getExtOrDefault = { name ->
|
|
19
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Airborne_' + name]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
repositories {
|
|
23
|
+
google()
|
|
24
|
+
mavenCentral()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
dependencies {
|
|
28
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
29
|
+
// noinspection DifferentKotlinGradleVersion
|
|
30
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
def isNewArchitectureEnabled() {
|
|
35
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
apply plugin: "com.android.library"
|
|
39
|
+
apply plugin: "kotlin-android"
|
|
40
|
+
|
|
41
|
+
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
42
|
+
|
|
43
|
+
apply plugin: "com.facebook.react"
|
|
44
|
+
|
|
45
|
+
def getExtOrDefault(name) {
|
|
46
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Airborne_' + name]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def getExtOrIntegerDefault(name) {
|
|
50
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Airborne_" + name]).toInteger()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
android {
|
|
54
|
+
|
|
55
|
+
def agpVersion = Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
56
|
+
// Check AGP version for backward compatibility w/react-native versions still on gradle plugin 6
|
|
57
|
+
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
|
|
58
|
+
namespace = "in.juspay.airborneplugin"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
|
+
|
|
63
|
+
defaultConfig {
|
|
64
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
+
|
|
67
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
buildFeatures {
|
|
71
|
+
buildConfig true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
buildTypes {
|
|
75
|
+
debug {
|
|
76
|
+
initWith release
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
release {
|
|
80
|
+
minifyEnabled false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
lintOptions {
|
|
85
|
+
disable "GradleCompatible"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
compileOptions {
|
|
89
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
90
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
sourceSets {
|
|
94
|
+
main {
|
|
95
|
+
java.srcDirs += [
|
|
96
|
+
"generated/java",
|
|
97
|
+
"generated/jni"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
repositories {
|
|
104
|
+
mavenLocal()
|
|
105
|
+
mavenCentral()
|
|
106
|
+
google()
|
|
107
|
+
maven { url "https://maven.juspay.in/hyper-sdk/" }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
111
|
+
|
|
112
|
+
dependencies {
|
|
113
|
+
implementation "com.facebook.react:react-android"
|
|
114
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
115
|
+
|
|
116
|
+
// Airborne SDK dependency
|
|
117
|
+
api "in.juspay:airborne:0.0.1-xota.15"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
react {
|
|
121
|
+
jsRootDir = file("../src/")
|
|
122
|
+
libraryName = "AirbornePlugin"
|
|
123
|
+
codegenJavaPackageName = "in.juspay.airborneplugin"
|
|
124
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 Juspay Technologies
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
Airborne_kotlinVersion=2.0.21
|
|
16
|
+
Airborne_minSdkVersion=24
|
|
17
|
+
Airborne_targetSdkVersion=34
|
|
18
|
+
Airborne_compileSdkVersion=35
|
|
19
|
+
Airborne_ndkVersion=27.1.12297006
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
package `in`.juspay.airborneplugin
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import androidx.annotation.Keep
|
|
5
|
+
import `in`.juspay.airborne.HyperOTAServices
|
|
6
|
+
import `in`.juspay.airborne.LazyDownloadCallback
|
|
7
|
+
import `in`.juspay.airborne.TrackerCallback
|
|
8
|
+
import `in`.juspay.airborne.constants.LogLevel
|
|
9
|
+
import org.json.JSONObject
|
|
10
|
+
|
|
11
|
+
@Keep
|
|
12
|
+
class Airborne (
|
|
13
|
+
context: Context,
|
|
14
|
+
releaseConfigUrl: String,
|
|
15
|
+
private val airborneInterface: AirborneInterface
|
|
16
|
+
) {
|
|
17
|
+
|
|
18
|
+
constructor(context: Context, releaseConfigUrl: String) : this(context, releaseConfigUrl, object : AirborneInterface() {})
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default no-op TrackerCallback.
|
|
22
|
+
*/
|
|
23
|
+
private val trackerCallback = object : TrackerCallback() {
|
|
24
|
+
|
|
25
|
+
override fun track(
|
|
26
|
+
category: String,
|
|
27
|
+
subCategory: String,
|
|
28
|
+
level: String,
|
|
29
|
+
label: String,
|
|
30
|
+
key: String,
|
|
31
|
+
value: JSONObject
|
|
32
|
+
) {
|
|
33
|
+
airborneInterface.onEvent(level, label, key, value, category, subCategory)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun trackException(
|
|
37
|
+
category: String,
|
|
38
|
+
subCategory: String,
|
|
39
|
+
label: String,
|
|
40
|
+
description: String,
|
|
41
|
+
e: Throwable
|
|
42
|
+
) {
|
|
43
|
+
airborneInterface.onEvent(LogLevel.EXCEPTION, label, description, JSONObject().put("throwable", e), category, subCategory)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private val hyperOTAServices = HyperOTAServices(
|
|
48
|
+
context,
|
|
49
|
+
airborneInterface.getNamespace(),
|
|
50
|
+
"",
|
|
51
|
+
releaseConfigUrl,
|
|
52
|
+
trackerCallback,
|
|
53
|
+
airborneInterface::onBootComplete
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
private val applicationManager = hyperOTAServices.createApplicationManager(airborneInterface.getDimensions())
|
|
57
|
+
|
|
58
|
+
init {
|
|
59
|
+
initializer = { this }
|
|
60
|
+
applicationManager.loadApplication(airborneInterface.getNamespace(), airborneInterface.getLazyDownloadCallback())
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @return The path of the index bundle, or asset path fallback if empty.
|
|
65
|
+
*/
|
|
66
|
+
@Keep
|
|
67
|
+
fun getBundlePath(): String {
|
|
68
|
+
val filePath = applicationManager.getIndexBundlePath()
|
|
69
|
+
return filePath.ifEmpty { "assets://${airborneInterface.getIndexBundlePath()}" }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Reads the content of the given file.
|
|
74
|
+
* @param filePath The relative path of the file.
|
|
75
|
+
* @return The content of the file as String.
|
|
76
|
+
*/
|
|
77
|
+
@Keep
|
|
78
|
+
fun getFileContent(filePath: String): String {
|
|
79
|
+
return applicationManager.readSplit(filePath)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @return Stringified JSON of the release config.
|
|
84
|
+
*/
|
|
85
|
+
@Keep
|
|
86
|
+
fun getReleaseConfig(): String {
|
|
87
|
+
return applicationManager.readReleaseConfig()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
companion object {
|
|
91
|
+
private var initializer: (() -> Airborne)? = null
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Lazily initialized singleton instance.
|
|
95
|
+
*/
|
|
96
|
+
@JvmStatic
|
|
97
|
+
val instance: Airborne by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
|
98
|
+
initializer?.invoke()
|
|
99
|
+
?: throw IllegalStateException("Airborne initializer not set. Call init() first.")
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Default LazyDownloadCallback implementation.
|
|
104
|
+
*/
|
|
105
|
+
val defaultLazyCallback = object : LazyDownloadCallback {
|
|
106
|
+
override fun fileInstalled(filePath: String, success: Boolean) {
|
|
107
|
+
// Default implementation: log the file installation status
|
|
108
|
+
if (success) {
|
|
109
|
+
println("HyperOTAReact: File installed successfully: $filePath")
|
|
110
|
+
} else {
|
|
111
|
+
println("HyperOTAReact: File installation failed: $filePath")
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
override fun lazySplitsInstalled(success: Boolean) {
|
|
116
|
+
// Default implementation: log the lazy splits installation status
|
|
117
|
+
if (success) {
|
|
118
|
+
println("HyperOTAReact: Lazy splits installed successfully")
|
|
119
|
+
} else {
|
|
120
|
+
println("HyperOTAReact: Lazy splits installation failed")
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package `in`.juspay.airborneplugin
|
|
2
|
+
|
|
3
|
+
import `in`.juspay.airborne.LazyDownloadCallback
|
|
4
|
+
import `in`.juspay.airborneplugin.Airborne.Companion.defaultLazyCallback
|
|
5
|
+
import org.json.JSONObject
|
|
6
|
+
|
|
7
|
+
abstract class AirborneInterface {
|
|
8
|
+
open fun getNamespace(): String {
|
|
9
|
+
return "default"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
open fun getIndexBundlePath(): String {
|
|
13
|
+
return "index.android.bundle"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
open fun getDimensions(): HashMap<String, String> {
|
|
17
|
+
return hashMapOf()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
open fun onBootComplete(indexPath: String) {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
open fun onEvent(level: String, label: String, key: String, value: JSONObject, category: String, subCategory: String) {
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
open fun getLazyDownloadCallback(): LazyDownloadCallback {
|
|
27
|
+
return defaultLazyCallback
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
package `in`.juspay.airborneplugin
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
5
|
+
import com.facebook.react.bridge.ReactMethod
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
8
|
+
|
|
9
|
+
@ReactModule(name = AirborneModule.NAME)
|
|
10
|
+
class AirborneModule(reactContext: ReactApplicationContext) :
|
|
11
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
12
|
+
|
|
13
|
+
private val implementation = AirborneModuleImpl(reactContext)
|
|
14
|
+
|
|
15
|
+
override fun getName(): String {
|
|
16
|
+
return NAME
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@ReactMethod
|
|
20
|
+
fun readReleaseConfig(promise: Promise) {
|
|
21
|
+
implementation.readReleaseConfig(promise)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@ReactMethod
|
|
25
|
+
fun getFileContent(filePath: String, promise: Promise) {
|
|
26
|
+
implementation.getFileContent(filePath, promise)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@ReactMethod
|
|
30
|
+
fun getBundlePath(promise: Promise) {
|
|
31
|
+
implementation.getBundlePath(promise)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
companion object {
|
|
35
|
+
const val NAME = "Airborne"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
package `in`.juspay.airborneplugin
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Implementation class that handles the actual Airborne operations.
|
|
8
|
+
* This class is shared between old and new architecture modules.
|
|
9
|
+
*/
|
|
10
|
+
class AirborneModuleImpl(private val reactContext: ReactApplicationContext) {
|
|
11
|
+
|
|
12
|
+
companion object {
|
|
13
|
+
// private var isInitialized = false
|
|
14
|
+
|
|
15
|
+
// /**
|
|
16
|
+
// * Initialize Airborne from native code (typically from MainApplication)
|
|
17
|
+
// */
|
|
18
|
+
// @JvmStatic
|
|
19
|
+
// fun initializeHyperOTA(
|
|
20
|
+
// context: Context,
|
|
21
|
+
// appId: String,
|
|
22
|
+
// indexFileName: String,
|
|
23
|
+
// appVersion: String,
|
|
24
|
+
// releaseConfigTemplateUrl: String,
|
|
25
|
+
// headers: Map<String, String>? = null,
|
|
26
|
+
// lazyDownloadCallback: LazyDownloadCallback? = null,
|
|
27
|
+
// trackerCallback: TrackerCallback? = null
|
|
28
|
+
// ) {
|
|
29
|
+
// if (!isInitialized) {
|
|
30
|
+
// Airborne.init(
|
|
31
|
+
// context,
|
|
32
|
+
// appId,
|
|
33
|
+
// indexFileName,
|
|
34
|
+
// appVersion,
|
|
35
|
+
// releaseConfigTemplateUrl,
|
|
36
|
+
// headers,
|
|
37
|
+
// lazyDownloadCallback,
|
|
38
|
+
// trackerCallback
|
|
39
|
+
// )
|
|
40
|
+
// isInitialized = true
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fun readReleaseConfig(promise: Promise) {
|
|
46
|
+
try {
|
|
47
|
+
val config = Airborne.instance.getReleaseConfig()
|
|
48
|
+
promise.resolve(config)
|
|
49
|
+
} catch (e: Exception) {
|
|
50
|
+
promise.reject("AIRBORNE_ERROR", "Failed to read release config: ${e.message}", e)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
fun getFileContent(filePath: String, promise: Promise) {
|
|
55
|
+
try {
|
|
56
|
+
val content = Airborne.instance.getFileContent(filePath)
|
|
57
|
+
promise.resolve(content)
|
|
58
|
+
} catch (e: Exception) {
|
|
59
|
+
promise.reject("AIRBORNE_ERROR", "Failed to read file content: ${e.message}", e)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fun getBundlePath(promise: Promise) {
|
|
64
|
+
try {
|
|
65
|
+
val path = Airborne.instance.getBundlePath()
|
|
66
|
+
promise.resolve(path)
|
|
67
|
+
} catch (e: Exception) {
|
|
68
|
+
promise.reject("AIRBORNE_ERROR", "Failed to get bundle path: ${e.message}", e)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package `in`.juspay.airborneplugin
|
|
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
|
+
import java.util.HashMap
|
|
9
|
+
|
|
10
|
+
class AirbornePackage : TurboReactPackage() {
|
|
11
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
+
return if (name == AirborneModule.NAME) {
|
|
13
|
+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
14
|
+
AirborneTurboModule(reactContext)
|
|
15
|
+
} else {
|
|
16
|
+
AirborneModule(reactContext)
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
null
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
24
|
+
return ReactModuleInfoProvider {
|
|
25
|
+
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
26
|
+
val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
27
|
+
moduleInfos[AirborneModule.NAME] = ReactModuleInfo(
|
|
28
|
+
AirborneModule.NAME,
|
|
29
|
+
if (isTurboModule) AirborneTurboModule::class.java.name else AirborneModule::class.java.name,
|
|
30
|
+
false, // canOverrideExistingModule
|
|
31
|
+
false, // needsEagerInit
|
|
32
|
+
true, // hasConstants
|
|
33
|
+
false, // isCxxModule
|
|
34
|
+
isTurboModule // isTurboModule
|
|
35
|
+
)
|
|
36
|
+
moduleInfos
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package `in`.juspay.airborneplugin
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
5
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
6
|
+
|
|
7
|
+
@ReactModule(name = AirborneTurboModule.NAME)
|
|
8
|
+
class AirborneTurboModule(reactContext: ReactApplicationContext) :
|
|
9
|
+
NativeAirborneSpec(reactContext) {
|
|
10
|
+
|
|
11
|
+
private val implementation = AirborneModuleImpl(reactContext)
|
|
12
|
+
|
|
13
|
+
override fun getName(): String {
|
|
14
|
+
return NAME
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override fun readReleaseConfig(promise: Promise) {
|
|
18
|
+
implementation.readReleaseConfig(promise)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun getFileContent(filePath: String, promise: Promise) {
|
|
22
|
+
implementation.getFileContent(filePath, promise)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun getBundlePath(promise: Promise) {
|
|
26
|
+
implementation.getBundlePath(promise)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
companion object {
|
|
30
|
+
const val NAME = "HyperOta"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/ios/Airborne.h
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
#import <AirborneSpec/AirborneSpec.h>
|
|
3
|
+
|
|
4
|
+
@interface Airborne : NSObject <NativeAirborneSpec>
|
|
5
|
+
#else
|
|
6
|
+
#import <React/RCTBridgeModule.h>
|
|
7
|
+
|
|
8
|
+
@interface Airborne : NSObject <RCTBridgeModule>
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
+ (void)initializeAirborneWithAppId:(NSString *)appId
|
|
12
|
+
indexFileName:(NSString *)indexFileName
|
|
13
|
+
appVersion:(NSString *)appVersion
|
|
14
|
+
releaseConfigTemplateUrl:(NSString *)releaseConfigTemplateUrl
|
|
15
|
+
headers:(nullable NSDictionary<NSString *, NSString *> *)headers;
|
|
16
|
+
|
|
17
|
+
@end
|
package/ios/Airborne.mm
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#import "Airborne.h"
|
|
2
|
+
#import "AirborneiOS.h"
|
|
3
|
+
#import <React/RCTLog.h>
|
|
4
|
+
|
|
5
|
+
@implementation Airborne
|
|
6
|
+
|
|
7
|
+
RCT_EXPORT_MODULE(Airborne)
|
|
8
|
+
|
|
9
|
+
+ (void)initializeAirborneWithAppId:(NSString *)appId
|
|
10
|
+
indexFileName:(NSString *)indexFileName
|
|
11
|
+
appVersion:(NSString *)appVersion
|
|
12
|
+
releaseConfigTemplateUrl:(NSString *)releaseConfigTemplateUrl
|
|
13
|
+
headers:(nullable NSDictionary<NSString *, NSString *> *)headers {
|
|
14
|
+
[[AirborneiOS sharedInstance] initializeWithAppId:appId
|
|
15
|
+
indexFileName:indexFileName
|
|
16
|
+
appVersion:appVersion
|
|
17
|
+
releaseConfigTemplateUrl:releaseConfigTemplateUrl
|
|
18
|
+
headers:headers
|
|
19
|
+
lazyDownloadCallback:^(NSString *filePath, BOOL success) {
|
|
20
|
+
RCTLogInfo(@"Airborne: File %@ - %@", filePath, success ? @"installed" : @"failed");
|
|
21
|
+
}
|
|
22
|
+
lazySplitsCallback:^(BOOL success) {
|
|
23
|
+
RCTLogInfo(@"Airborne: Lazy splits - %@", success ? @"installed" : @"failed");
|
|
24
|
+
}];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
28
|
+
- (void)readReleaseConfig:(RCTPromiseResolveBlock)resolve
|
|
29
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
30
|
+
@try {
|
|
31
|
+
NSString *config = [[AirborneiOS sharedInstance] getReleaseConfig];
|
|
32
|
+
resolve(config);
|
|
33
|
+
} @catch (NSException *exception) {
|
|
34
|
+
reject(@"AIRBORNE_ERROR", exception.reason, nil);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)getFileContent:(NSString *)filePath
|
|
39
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
40
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
41
|
+
@try {
|
|
42
|
+
NSString *content = [[AirborneiOS sharedInstance] getFileContent:filePath];
|
|
43
|
+
resolve(content);
|
|
44
|
+
} @catch (NSException *exception) {
|
|
45
|
+
reject(@"AIRBORNE_ERROR", exception.reason, nil);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (void)getBundlePath:(RCTPromiseResolveBlock)resolve
|
|
50
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
51
|
+
@try {
|
|
52
|
+
NSString *bundlePath = [[AirborneiOS sharedInstance] getBundlePath];
|
|
53
|
+
resolve(bundlePath);
|
|
54
|
+
} @catch (NSException *exception) {
|
|
55
|
+
reject(@"AIRBORNE_ERROR", exception.reason, nil);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
#else
|
|
59
|
+
RCT_EXPORT_METHOD(readReleaseConfig:(RCTPromiseResolveBlock)resolve
|
|
60
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
61
|
+
@try {
|
|
62
|
+
NSString *config = [[AirborneiOS sharedInstance] getReleaseConfig];
|
|
63
|
+
resolve(config);
|
|
64
|
+
} @catch (NSException *exception) {
|
|
65
|
+
reject(@"AIRBORNE_ERROR", exception.reason, nil);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
RCT_EXPORT_METHOD(getFileContent:(NSString *)filePath
|
|
70
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
71
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
72
|
+
@try {
|
|
73
|
+
NSString *content = [[AirborneiOS sharedInstance] getFileContent:filePath];
|
|
74
|
+
resolve(content);
|
|
75
|
+
} @catch (NSException *exception) {
|
|
76
|
+
reject(@"AIRBORNE_ERROR", exception.reason, nil);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
RCT_EXPORT_METHOD(getBundlePath:(RCTPromiseResolveBlock)resolve
|
|
81
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
82
|
+
@try {
|
|
83
|
+
NSString *bundlePath = [[AirborneiOS sharedInstance] getBundlePath];
|
|
84
|
+
resolve(bundlePath);
|
|
85
|
+
} @catch (NSException *exception) {
|
|
86
|
+
reject(@"AIRBORNE_ERROR", exception.reason, nil);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
92
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
93
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
94
|
+
{
|
|
95
|
+
return std::make_shared<facebook::react::NativeAirborneSpecJSI>(params);
|
|
96
|
+
}
|
|
97
|
+
#endif
|
|
98
|
+
|
|
99
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
+
|
|
5
|
+
typedef void (^HyperOTALazyDownloadCallback)(NSString *filePath, BOOL success);
|
|
6
|
+
typedef void (^HyperOTALazySplitsCallback)(BOOL success);
|
|
7
|
+
|
|
8
|
+
@interface AirborneiOS : NSObject
|
|
9
|
+
|
|
10
|
+
+ (instancetype)sharedInstance;
|
|
11
|
+
|
|
12
|
+
- (void)initializeWithAppId:(NSString *)appId
|
|
13
|
+
indexFileName:(NSString *)indexFileName
|
|
14
|
+
appVersion:(NSString *)appVersion
|
|
15
|
+
releaseConfigTemplateUrl:(NSString *)releaseConfigTemplateUrl
|
|
16
|
+
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
|
|
17
|
+
lazyDownloadCallback:(nullable HyperOTALazyDownloadCallback)lazyDownloadCallback
|
|
18
|
+
lazySplitsCallback:(nullable HyperOTALazySplitsCallback)lazySplitsCallback;
|
|
19
|
+
|
|
20
|
+
- (NSString *)getBundlePath;
|
|
21
|
+
- (NSString *)getFileContent:(NSString *)filePath;
|
|
22
|
+
- (NSString *)getReleaseConfig;
|
|
23
|
+
|
|
24
|
+
@end
|
|
25
|
+
|
|
26
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#import "AirborneiOS.h"
|
|
2
|
+
|
|
3
|
+
@interface AirborneiOS ()
|
|
4
|
+
@property (nonatomic, assign) BOOL isInitialized;
|
|
5
|
+
@property (nonatomic, strong) NSString *indexFileName;
|
|
6
|
+
// In a real implementation, you would have references to the actual Airborne SDK objects here
|
|
7
|
+
@end
|
|
8
|
+
|
|
9
|
+
@implementation AirborneiOS
|
|
10
|
+
|
|
11
|
+
+ (instancetype)sharedInstance {
|
|
12
|
+
static AirborneiOS *sharedInstance = nil;
|
|
13
|
+
static dispatch_once_t onceToken;
|
|
14
|
+
dispatch_once(&onceToken, ^{
|
|
15
|
+
sharedInstance = [[self alloc] init];
|
|
16
|
+
});
|
|
17
|
+
return sharedInstance;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (instancetype)init {
|
|
21
|
+
self = [super init];
|
|
22
|
+
if (self) {
|
|
23
|
+
_isInitialized = NO;
|
|
24
|
+
}
|
|
25
|
+
return self;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (void)initializeWithAppId:(NSString *)appId
|
|
29
|
+
indexFileName:(NSString *)indexFileName
|
|
30
|
+
appVersion:(NSString *)appVersion
|
|
31
|
+
releaseConfigTemplateUrl:(NSString *)releaseConfigTemplateUrl
|
|
32
|
+
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
|
|
33
|
+
lazyDownloadCallback:(nullable HyperOTALazyDownloadCallback)lazyDownloadCallback
|
|
34
|
+
lazySplitsCallback:(nullable HyperOTALazySplitsCallback)lazySplitsCallback {
|
|
35
|
+
|
|
36
|
+
if (self.isInitialized) {
|
|
37
|
+
NSLog(@"AirborneiOS: Already initialized");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
self.indexFileName = indexFileName;
|
|
42
|
+
|
|
43
|
+
// TODO: Initialize the actual Airborne SDK here
|
|
44
|
+
// This is a placeholder implementation
|
|
45
|
+
// In a real implementation, you would:
|
|
46
|
+
// 1. Import the HyperOTA iOS SDK
|
|
47
|
+
// 2. Initialize HyperOTAServices with the provided parameters
|
|
48
|
+
// 3. Create an ApplicationManager
|
|
49
|
+
// 4. Load the application
|
|
50
|
+
|
|
51
|
+
NSLog(@"AirborneiOS: Initializing with appId: %@, indexFileName: %@, appVersion: %@",
|
|
52
|
+
appId, indexFileName, appVersion);
|
|
53
|
+
|
|
54
|
+
self.isInitialized = YES;
|
|
55
|
+
|
|
56
|
+
// Simulate callbacks for demo purposes
|
|
57
|
+
if (lazyDownloadCallback) {
|
|
58
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
59
|
+
lazyDownloadCallback(@"demo/file.js", YES);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (lazySplitsCallback) {
|
|
64
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
65
|
+
lazySplitsCallback(YES);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (NSString *)getBundlePath {
|
|
71
|
+
// if (!self.isInitialized) {
|
|
72
|
+
// @throw [NSException exceptionWithName:@"HyperOTANotInitialized"
|
|
73
|
+
// reason:@"HyperOTA is not initialized. Call initialize first."
|
|
74
|
+
// userInfo:nil];
|
|
75
|
+
// }
|
|
76
|
+
//
|
|
77
|
+
// // TODO: Get the actual bundle path from HyperOTA SDK //
|
|
78
|
+
// // This is a placeholder implementation
|
|
79
|
+
// NSString *bundlePath = [[NSBundle mainBundle] pathForResource:self.indexFileName ofType:nil];
|
|
80
|
+
// if (!bundlePath) {
|
|
81
|
+
// bundlePath = [NSString stringWithFormat:@"assets://%@", self.indexFileName];
|
|
82
|
+
// }
|
|
83
|
+
//
|
|
84
|
+
// return bundlePath;
|
|
85
|
+
return @"";
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
- (NSString *)getFileContent:(NSString *)filePath {
|
|
89
|
+
// if (!self.isInitialized) {
|
|
90
|
+
// @throw [NSException exceptionWithName:@"HyperOTANotInitialized"
|
|
91
|
+
// reason:@"HyperOTA is not initialized. Call initialize first."
|
|
92
|
+
// userInfo:nil];
|
|
93
|
+
// }
|
|
94
|
+
//
|
|
95
|
+
// // TODO: Read the actual file content from HyperOTA SDK //
|
|
96
|
+
// // This is a placeholder implementation
|
|
97
|
+
// return [NSString stringWithFormat:@"File content for: %@", filePath];
|
|
98
|
+
return @"";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
- (NSString *)getReleaseConfig {
|
|
102
|
+
// if (!self.isInitialized) {
|
|
103
|
+
// @throw [NSException exceptionWithName:@"HyperOTANotInitialized"
|
|
104
|
+
// reason:@"HyperOTA is not initialized. Call initialize first."
|
|
105
|
+
// userInfo:nil];
|
|
106
|
+
// }
|
|
107
|
+
//
|
|
108
|
+
// // TODO: Get the actual release config from HyperOTA SDK //
|
|
109
|
+
// // This is a placeholder implementation
|
|
110
|
+
// NSDictionary *config = @{
|
|
111
|
+
// @"version": @"1.0.0",
|
|
112
|
+
// @"environment": @"production",
|
|
113
|
+
// @"features": @{
|
|
114
|
+
// @"featureA": @YES,
|
|
115
|
+
// @"featureB": @NO
|
|
116
|
+
// }
|
|
117
|
+
// };
|
|
118
|
+
//
|
|
119
|
+
// NSError *error;
|
|
120
|
+
// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:config options:0 error:&error];
|
|
121
|
+
// if (jsonData) {
|
|
122
|
+
// return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
123
|
+
// }
|
|
124
|
+
|
|
125
|
+
return @"{}";
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Copyright 2025 Juspay Technologies
|
|
4
|
+
//
|
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
// you may not use this file except in compliance with the License.
|
|
7
|
+
// You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
// See the License for the specific language governing permissions and
|
|
15
|
+
// limitations under the License.
|
|
16
|
+
|
|
17
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
18
|
+
export default TurboModuleRegistry.getEnforcing('Airborne');
|
|
19
|
+
//# sourceMappingURL=NativeAirborne.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAirborne.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,mBAAmB,QAAQ,cAAc;AAQlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,UAAU,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Copyright 2025 Juspay Technologies
|
|
4
|
+
//
|
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
// you may not use this file except in compliance with the License.
|
|
7
|
+
// You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
// See the License for the specific language governing permissions and
|
|
15
|
+
// limitations under the License.
|
|
16
|
+
|
|
17
|
+
import { NativeModules, Platform } from 'react-native';
|
|
18
|
+
const LINKING_ERROR = `The package 'airborne-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
19
|
+
ios: "- You have run 'pod install'\n",
|
|
20
|
+
default: ''
|
|
21
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
22
|
+
|
|
23
|
+
// @ts-expect-error
|
|
24
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
25
|
+
const AirborneModule = isTurboModuleEnabled ? require('./NativeAirborne').default : NativeModules.Airborne;
|
|
26
|
+
const Airborne = AirborneModule ? AirborneModule : new Proxy({}, {
|
|
27
|
+
get() {
|
|
28
|
+
throw new Error(LINKING_ERROR);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export function readReleaseConfig() {
|
|
32
|
+
return Airborne.readReleaseConfig();
|
|
33
|
+
}
|
|
34
|
+
export function getFileContent(filePath) {
|
|
35
|
+
return Airborne.getFileContent(filePath);
|
|
36
|
+
}
|
|
37
|
+
export function getBundlePath() {
|
|
38
|
+
return Airborne.getBundlePath();
|
|
39
|
+
}
|
|
40
|
+
export default Airborne;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","AirborneModule","require","Airborne","Proxy","get","Error","readReleaseConfig","getFileContent","filePath","getBundlePath"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,gFAAgF,GAChFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,cAAc,GAAGH,oBAAoB,GACvCI,OAAO,CAAC,kBAAkB,CAAC,CAACL,OAAO,GACnCL,aAAa,CAACW,QAAQ;AAE1B,MAAMA,QAAQ,GAAGF,cAAc,GAC3BA,cAAc,GACd,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,SAASa,iBAAiBA,CAAA,EAAoB;EACnD,OAAOJ,QAAQ,CAACI,iBAAiB,CAAC,CAAC;AACrC;AAEA,OAAO,SAASC,cAAcA,CAACC,QAAgB,EAAmB;EAChE,OAAON,QAAQ,CAACK,cAAc,CAACC,QAAQ,CAAC;AAC1C;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAoB;EAC/C,OAAOP,QAAQ,CAACO,aAAa,CAAC,CAAC;AACjC;AAEA,eAAeP,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../ExampleOldArch/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAYnD,iBAAS,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAuFhC;AA+ED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
readReleaseConfig(): Promise<string>;
|
|
4
|
+
getFileContent(filePath: string): Promise<string>;
|
|
5
|
+
getBundlePath(): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: Spec;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=NativeAirborne.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeAirborne.d.ts","sourceRoot":"","sources":["../../../src/NativeAirborne.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAClC;;AAED,wBAAkE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const Airborne: any;
|
|
2
|
+
export declare function readReleaseConfig(): Promise<string>;
|
|
3
|
+
export declare function getFileContent(filePath: string): Promise<string>;
|
|
4
|
+
export declare function getBundlePath(): Promise<string>;
|
|
5
|
+
export default Airborne;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AA6BA,QAAA,MAAM,QAAQ,KAST,CAAC;AAEN,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEnD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhE;AAED,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAE/C;AAED,eAAe,QAAQ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "airborne-react-native",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Airborne",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace airborne-react-native-example",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"typecheck": "tsc",
|
|
38
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
39
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
40
|
+
"prepare": "bob build",
|
|
41
|
+
"release": "release-it --only-version"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"ios",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/juspay/airborne.git"
|
|
51
|
+
},
|
|
52
|
+
"author": "juspay <kuntimaddi.manideep@juspay.in> (https://github.com/juspay)",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/juspay/airborne/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/juspay/airborne#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://registry.npmjs.org/"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
63
|
+
"@eslint/compat": "^1.2.7",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
65
|
+
"@eslint/js": "^9.22.0",
|
|
66
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
67
|
+
"@react-native-community/cli": "15.0.0-alpha.2",
|
|
68
|
+
"@react-native/babel-preset": "0.79.2",
|
|
69
|
+
"@react-native/eslint-config": "^0.78.0",
|
|
70
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
71
|
+
"@types/jest": "^29.5.5",
|
|
72
|
+
"@types/react": "^19.0.0",
|
|
73
|
+
"commitlint": "^19.6.1",
|
|
74
|
+
"del-cli": "^5.1.0",
|
|
75
|
+
"eslint": "^9.22.0",
|
|
76
|
+
"eslint-config-prettier": "^10.1.1",
|
|
77
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
78
|
+
"jest": "^29.7.0",
|
|
79
|
+
"prettier": "^3.0.3",
|
|
80
|
+
"react": "19.0.0",
|
|
81
|
+
"react-native": "0.79.2",
|
|
82
|
+
"react-native-builder-bob": "^0.40.11",
|
|
83
|
+
"release-it": "^17.10.0",
|
|
84
|
+
"turbo": "^1.10.7",
|
|
85
|
+
"typescript": "^5.8.3"
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"react": "*",
|
|
89
|
+
"react-native": "*"
|
|
90
|
+
},
|
|
91
|
+
"workspaces": [
|
|
92
|
+
"example"
|
|
93
|
+
],
|
|
94
|
+
"packageManager": "yarn@3.6.1",
|
|
95
|
+
"jest": {
|
|
96
|
+
"preset": "react-native",
|
|
97
|
+
"modulePathIgnorePatterns": [
|
|
98
|
+
"<rootDir>/example/node_modules",
|
|
99
|
+
"<rootDir>/lib/"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"commitlint": {
|
|
103
|
+
"extends": [
|
|
104
|
+
"@commitlint/config-conventional"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"release-it": {
|
|
108
|
+
"git": {
|
|
109
|
+
"commitMessage": "chore: release ${version}",
|
|
110
|
+
"tagName": "v${version}"
|
|
111
|
+
},
|
|
112
|
+
"npm": {
|
|
113
|
+
"publish": true
|
|
114
|
+
},
|
|
115
|
+
"github": {
|
|
116
|
+
"release": true
|
|
117
|
+
},
|
|
118
|
+
"plugins": {
|
|
119
|
+
"@release-it/conventional-changelog": {
|
|
120
|
+
"preset": {
|
|
121
|
+
"name": "angular"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"prettier": {
|
|
127
|
+
"quoteProps": "consistent",
|
|
128
|
+
"singleQuote": true,
|
|
129
|
+
"tabWidth": 2,
|
|
130
|
+
"trailingComma": "es5",
|
|
131
|
+
"useTabs": false
|
|
132
|
+
},
|
|
133
|
+
"react-native-builder-bob": {
|
|
134
|
+
"source": "src",
|
|
135
|
+
"output": "lib",
|
|
136
|
+
"targets": [
|
|
137
|
+
[
|
|
138
|
+
"module",
|
|
139
|
+
{
|
|
140
|
+
"esm": true
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"typescript",
|
|
145
|
+
{
|
|
146
|
+
"project": "tsconfig.build.json"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"codegenConfig": {
|
|
152
|
+
"name": "AirborneSpec",
|
|
153
|
+
"type": "modules",
|
|
154
|
+
"jsSrcsDir": "src",
|
|
155
|
+
"android": {
|
|
156
|
+
"javaPackageName": "in.juspay.airborneplugin"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"create-react-native-library": {
|
|
160
|
+
"languages": "kotlin-objc",
|
|
161
|
+
"type": "turbo-module",
|
|
162
|
+
"version": "0.50.3"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright 2025 Juspay Technologies
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import type { TurboModule } from 'react-native';
|
|
16
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
17
|
+
|
|
18
|
+
export interface Spec extends TurboModule {
|
|
19
|
+
readReleaseConfig(): Promise<string>;
|
|
20
|
+
getFileContent(filePath: string): Promise<string>;
|
|
21
|
+
getBundlePath(): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('Airborne');
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright 2025 Juspay Technologies
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import { NativeModules, Platform } from 'react-native';
|
|
16
|
+
|
|
17
|
+
const LINKING_ERROR =
|
|
18
|
+
`The package 'airborne-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
19
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
20
|
+
'- You rebuilt the app after installing the package\n' +
|
|
21
|
+
'- You are not using Expo Go\n';
|
|
22
|
+
|
|
23
|
+
// @ts-expect-error
|
|
24
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
25
|
+
|
|
26
|
+
const AirborneModule = isTurboModuleEnabled
|
|
27
|
+
? require('./NativeAirborne').default
|
|
28
|
+
: NativeModules.Airborne;
|
|
29
|
+
|
|
30
|
+
const Airborne = AirborneModule
|
|
31
|
+
? AirborneModule
|
|
32
|
+
: new Proxy(
|
|
33
|
+
{},
|
|
34
|
+
{
|
|
35
|
+
get() {
|
|
36
|
+
throw new Error(LINKING_ERROR);
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export function readReleaseConfig(): Promise<string> {
|
|
42
|
+
return Airborne.readReleaseConfig();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getFileContent(filePath: string): Promise<string> {
|
|
46
|
+
return Airborne.getFileContent(filePath);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getBundlePath(): Promise<string> {
|
|
50
|
+
return Airborne.getBundlePath();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default Airborne;
|