react-native-instantpay-code-push 1.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.
Files changed (87) hide show
  1. package/InstantpayCodePush.podspec +20 -0
  2. package/LICENSE +20 -0
  3. package/README.md +158 -0
  4. package/android/build.gradle +91 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/instantpaycodepush/BundleFileStorageService.kt +835 -0
  8. package/android/src/main/java/com/instantpaycodepush/BundleMetadata.kt +249 -0
  9. package/android/src/main/java/com/instantpaycodepush/CommonHelper.kt +39 -0
  10. package/android/src/main/java/com/instantpaycodepush/DecompressService.kt +85 -0
  11. package/android/src/main/java/com/instantpaycodepush/DecompressionStrategy.kt +24 -0
  12. package/android/src/main/java/com/instantpaycodepush/FileManagerService.kt +105 -0
  13. package/android/src/main/java/com/instantpaycodepush/HashUtils.kt +50 -0
  14. package/android/src/main/java/com/instantpaycodepush/InstantpayCodePushModule.kt +182 -0
  15. package/android/src/main/java/com/instantpaycodepush/InstantpayCodePushPackage.kt +33 -0
  16. package/android/src/main/java/com/instantpaycodepush/IpayCodePush.kt +101 -0
  17. package/android/src/main/java/com/instantpaycodepush/IpayCodePushException.kt +135 -0
  18. package/android/src/main/java/com/instantpaycodepush/IpayCodePushImpl.kt +329 -0
  19. package/android/src/main/java/com/instantpaycodepush/OkHttpDownloadService.kt +283 -0
  20. package/android/src/main/java/com/instantpaycodepush/ReactIntegrationManager.kt +141 -0
  21. package/android/src/main/java/com/instantpaycodepush/ReactIntegrationManagerBase.kt +35 -0
  22. package/android/src/main/java/com/instantpaycodepush/SignatureVerifier.kt +354 -0
  23. package/android/src/main/java/com/instantpaycodepush/VersionedPreferencesService.kt +70 -0
  24. package/android/src/main/java/com/instantpaycodepush/ZipDecompressionStrategy.kt +198 -0
  25. package/ios/InstantpayCodePush.h +5 -0
  26. package/ios/InstantpayCodePush.mm +21 -0
  27. package/lib/module/DefaultResolver.js +34 -0
  28. package/lib/module/DefaultResolver.js.map +1 -0
  29. package/lib/module/NativeInstantpayCodePush.js +5 -0
  30. package/lib/module/NativeInstantpayCodePush.js.map +1 -0
  31. package/lib/module/checkForUpdate.js +68 -0
  32. package/lib/module/checkForUpdate.js.map +1 -0
  33. package/lib/module/error.js +137 -0
  34. package/lib/module/error.js.map +1 -0
  35. package/lib/module/fetchUpdateInfo.js +36 -0
  36. package/lib/module/fetchUpdateInfo.js.map +1 -0
  37. package/lib/module/global.d.js +8 -0
  38. package/lib/module/global.d.js.map +1 -0
  39. package/lib/module/hooks/useEventCallback.js +13 -0
  40. package/lib/module/hooks/useEventCallback.js.map +1 -0
  41. package/lib/module/index.js +291 -0
  42. package/lib/module/index.js.map +1 -0
  43. package/lib/module/native.js +233 -0
  44. package/lib/module/native.js.map +1 -0
  45. package/lib/module/package.json +1 -0
  46. package/lib/module/store.js +53 -0
  47. package/lib/module/store.js.map +1 -0
  48. package/lib/module/types.js +62 -0
  49. package/lib/module/types.js.map +1 -0
  50. package/lib/module/wrap.js +171 -0
  51. package/lib/module/wrap.js.map +1 -0
  52. package/lib/typescript/package.json +1 -0
  53. package/lib/typescript/src/DefaultResolver.d.ts +10 -0
  54. package/lib/typescript/src/DefaultResolver.d.ts.map +1 -0
  55. package/lib/typescript/src/NativeInstantpayCodePush.d.ts +100 -0
  56. package/lib/typescript/src/NativeInstantpayCodePush.d.ts.map +1 -0
  57. package/lib/typescript/src/checkForUpdate.d.ts +29 -0
  58. package/lib/typescript/src/checkForUpdate.d.ts.map +1 -0
  59. package/lib/typescript/src/error.d.ts +124 -0
  60. package/lib/typescript/src/error.d.ts.map +1 -0
  61. package/lib/typescript/src/fetchUpdateInfo.d.ts +8 -0
  62. package/lib/typescript/src/fetchUpdateInfo.d.ts.map +1 -0
  63. package/lib/typescript/src/hooks/useEventCallback.d.ts +5 -0
  64. package/lib/typescript/src/hooks/useEventCallback.d.ts.map +1 -0
  65. package/lib/typescript/src/index.d.ts +203 -0
  66. package/lib/typescript/src/index.d.ts.map +1 -0
  67. package/lib/typescript/src/native.d.ts +128 -0
  68. package/lib/typescript/src/native.d.ts.map +1 -0
  69. package/lib/typescript/src/store.d.ts +11 -0
  70. package/lib/typescript/src/store.d.ts.map +1 -0
  71. package/lib/typescript/src/types.d.ts +174 -0
  72. package/lib/typescript/src/types.d.ts.map +1 -0
  73. package/lib/typescript/src/wrap.d.ts +179 -0
  74. package/lib/typescript/src/wrap.d.ts.map +1 -0
  75. package/package.json +174 -0
  76. package/src/DefaultResolver.ts +36 -0
  77. package/src/NativeInstantpayCodePush.ts +111 -0
  78. package/src/checkForUpdate.ts +122 -0
  79. package/src/error.ts +159 -0
  80. package/src/fetchUpdateInfo.ts +47 -0
  81. package/src/global.d.ts +23 -0
  82. package/src/hooks/useEventCallback.ts +30 -0
  83. package/src/index.tsx +379 -0
  84. package/src/native.ts +280 -0
  85. package/src/store.ts +69 -0
  86. package/src/types.ts +227 -0
  87. package/src/wrap.tsx +384 -0
@@ -0,0 +1,20 @@
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 = "InstantpayCodePush"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/InstantPay/react-native-instantpay-code-push.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ install_modules_dependencies(s)
20
+ end
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dhananjay Kumar
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,158 @@
1
+ # react-native-instantpay-code-push
2
+
3
+ IpayCodePush is a self-hosted Over-The-Air (OTA) update solution for React Native applications. It allows you to instantly deploy JavaScript bundle updates to users without submitting new builds to the app stores, helping you fix bugs and ship improvements faster.
4
+
5
+ ## Installation
6
+
7
+
8
+ ```sh
9
+ npm install react-native-instantpay-code-push
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+
16
+ ```js
17
+ import { IpayCodePush } from 'react-native-instantpay-code-push';
18
+
19
+ function App() {
20
+ return (
21
+ <View>
22
+ <Text>Instantpay IpayCodePush</Text>
23
+ </View>
24
+ );
25
+ }
26
+
27
+ export default IpayCodePush.wrap({
28
+ baseURL: "",
29
+ updateStrategy: "appVersion", // or "fingerprint"
30
+ updateMode: "auto",
31
+ requestHeaders: {
32
+ },
33
+ onNotifyAppReady: (result) => {
34
+ console.log("App ready notified:", result);
35
+ },
36
+ onError: (error) => {
37
+ // Handle other errors
38
+ console.error("Update error:", error);
39
+ },
40
+ onUpdateProcessCompleted: ({ status, shouldForceUpdate, id, message }) => {
41
+ console.log("Bundle updated:", status, shouldForceUpdate, id, message);
42
+ },
43
+ fallbackComponent: ({ progress, status }) => (
44
+ <Modal transparent visible={true}>
45
+ <View
46
+ style={{
47
+ flex: 1,
48
+ padding: 20,
49
+ borderRadius: 10,
50
+ justifyContent: "center",
51
+ alignItems: "center",
52
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
53
+ }}
54
+ >
55
+ {/* You can put a splash image here. */}
56
+
57
+ <Text style={{ color: "white", fontSize: 20, fontWeight: "bold" }}>
58
+ {status === "UPDATING" ? "Updating..." : "Checking for Update..."}
59
+ </Text>
60
+ {progress > 0 ? (
61
+ <Text style={{ color: "white", fontSize: 20, fontWeight: "bold" }}>
62
+ {Math.round(progress * 100)}%
63
+ </Text>
64
+ ) : null}
65
+ </View>
66
+ </Modal>
67
+ ),
68
+ })(App);
69
+
70
+ ```
71
+
72
+ ## Configuration for Android
73
+
74
+ For React Native 0.82 and above, modify your ```MainApplication.kt```:
75
+
76
+ ```
77
+ import com.instantpaycodepush.IpayCodePush //👈 import this package
78
+
79
+ class MainApplication : Application(), ReactApplication {
80
+ ....
81
+
82
+ override val reactHost: ReactHost by lazy {
83
+ getDefaultReactHost(
84
+ context = applicationContext,
85
+ packageList =
86
+ PackageList(this).packages.apply {
87
+
88
+ },
89
+ jsBundleFilePath = IpayCodePush.getJSBundleFile(applicationContext), //👈 add this line
90
+ )
91
+ }
92
+
93
+ override fun onCreate() {
94
+ super.onCreate()
95
+ loadReactNative(this)
96
+ }
97
+
98
+ ....
99
+ }
100
+ ```
101
+
102
+ For others React Native version , modify your ```MainApplication.kt```:
103
+
104
+ ```
105
+ import com.instantpaycodepush.IpayCodePush //👈 import this package
106
+
107
+ class MainApplication : Application(), ReactApplication {
108
+ .....
109
+ override val reactNativeHost: ReactNativeHost =
110
+ object : DefaultReactNativeHost(this) {
111
+
112
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
113
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
114
+
115
+ override fun getJSBundleFile(): String? { //👈 add this method
116
+ return IpayCodePush.getJSBundleFile(applicationContext)
117
+ }
118
+ }
119
+ .....
120
+ }
121
+
122
+ ```
123
+
124
+ ## Configuration for iOS
125
+
126
+ Open modify your ```AppDelegate.swift:```
127
+
128
+ ```
129
+ import IpayCodePush //👈 import this package
130
+
131
+ @main
132
+ class AppDelegate: RCTAppDelegate {
133
+ ....
134
+
135
+ override func bundleURL() -> URL? {
136
+ #if DEBUG
137
+ RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
138
+ #else
139
+ Bundle.main.url(forResource: "main", withExtension: "jsbundle") //❌ remove this
140
+ IpayCodePush.bundleURL() //👈 add this
141
+ #endif
142
+ }
143
+
144
+ ....
145
+
146
+ }
147
+
148
+ ```
149
+
150
+
151
+
152
+ ## License
153
+
154
+ MIT
155
+
156
+ ---
157
+
158
+ Created By [Instantpay](https://www.instantpay.in)
@@ -0,0 +1,91 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['InstantpayCodePush_' + name]
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+
11
+ dependencies {
12
+ classpath "com.android.tools.build:gradle:8.7.2"
13
+ // noinspection DifferentKotlinGradleVersion
14
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
15
+ }
16
+ }
17
+
18
+
19
+ apply plugin: "com.android.library"
20
+ apply plugin: "kotlin-android"
21
+
22
+ apply plugin: "com.facebook.react"
23
+
24
+ def getExtOrIntegerDefault(name) {
25
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["InstantpayCodePush_" + name]).toInteger()
26
+ }
27
+
28
+ android {
29
+ namespace "com.instantpaycodepush"
30
+
31
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
32
+
33
+ defaultConfig {
34
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
36
+
37
+ buildConfigField "long", "BUILD_TIMESTAMP", "${System.currentTimeMillis()}L" //Added For IpayCodePush
38
+
39
+ //Added For IpayCodePush
40
+ def minBundleId = project.hasProperty("MIN_BUNDLE_ID") ? project.properties["MIN_BUNDLE_ID"] : null
41
+ buildConfigField "String", "MIN_BUNDLE_ID", minBundleId == null ? "\"null\"" : "\"${minBundleId}\""
42
+
43
+
44
+ }
45
+
46
+ buildFeatures {
47
+ buildConfig true
48
+ }
49
+
50
+ buildTypes {
51
+ release {
52
+ minifyEnabled false
53
+ }
54
+ }
55
+
56
+ lintOptions {
57
+ disable "GradleCompatible"
58
+ }
59
+
60
+ compileOptions {
61
+ sourceCompatibility JavaVersion.VERSION_1_8
62
+ targetCompatibility JavaVersion.VERSION_1_8
63
+ }
64
+
65
+ sourceSets {
66
+ main {
67
+ java.srcDirs += [
68
+ "generated/java",
69
+ "generated/jni"
70
+ ]
71
+ }
72
+ }
73
+ }
74
+
75
+ repositories {
76
+ mavenCentral()
77
+ google()
78
+ }
79
+
80
+ def kotlin_version = getExtOrDefault("kotlinVersion")
81
+
82
+ dependencies {
83
+ implementation "com.facebook.react:react-android"
84
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
85
+
86
+ implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
87
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
88
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
89
+ implementation "com.squareup.okhttp3:okhttp:4.12.0"
90
+ implementation "org.brotli:dec:0.1.2"
91
+ }
@@ -0,0 +1,5 @@
1
+ InstantpayCodePush_kotlinVersion=2.0.21
2
+ InstantpayCodePush_minSdkVersion=24
3
+ InstantpayCodePush_targetSdkVersion=34
4
+ InstantpayCodePush_compileSdkVersion=35
5
+ InstantpayCodePush_ndkVersion=27.1.12297006
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>