Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
77f440b
chore: stallion production release
Thor963 Mar 15, 2025
29a8aae
chore: base merged changelog
Thor963 Mar 15, 2025
f888820
fix: modifed event emitter init, added fallback for mounting prod bun…
Thor963 Mar 17, 2025
63a4527
chore(release): 2.0.1-alpha.1
Mar 17, 2025
ab3f0d4
fix: removed stallion enabled script reading logic from native, enabl…
Thor963 Mar 26, 2025
9a2197c
chore(release): 2.0.1-alpha.2
Mar 26, 2025
62cadf0
Alpha: Sync[iOS] & Restart + UI Changes (#38)
Thor963 Apr 22, 2025
c1a0316
chore: back merged main
Thor963 Apr 22, 2025
70b8067
feat: restart logic, ui revamp v0, ios sync and other bugfixes
Thor963 Apr 22, 2025
9cc9656
chore(release): 2.1.0-alpha.1
Apr 22, 2025
0620f85
chore: ios typo fix (#41)
Apr 29, 2025
c0c9bdb
fix: ios stage event typo
Thor963 Apr 29, 2025
bf9b787
chore(release): 2.1.0-alpha.2
Apr 29, 2025
3636acd
feat: added stream downloading for android (#42)
Thor963 May 11, 2025
df0d0d8
chore(release): 2.1.0-alpha.3
May 11, 2025
1471b57
feat: resume download android
Thor963 May 11, 2025
628eaca
chore(release): 2.2.0-alpha.1
May 11, 2025
d4d8433
feat: bundle signing (#44)
Thor963 Jun 6, 2025
1110e51
chore(release): 2.2.0-alpha.2
Jun 6, 2025
b16b74d
feat: bundle signing 2.3.0, back merge
Thor963 Jun 6, 2025
9e1117f
chore(release): 2.3.0-alpha.1
Jun 6, 2025
f0d454f
fix: exception handling ios newarch (#53)
Thor963 Jun 18, 2025
f36e6cd
chore: lockfile update
Thor963 Jun 18, 2025
f02c4f7
chore: node upgrade
Thor963 Jun 18, 2025
225085e
chore: node upgrade 20
Thor963 Jun 18, 2025
00bb17c
chore(release): 2.3.0-alpha.2
Jun 18, 2025
979640a
fix: removeEventListener exported
Thor963 Jun 18, 2025
c96c438
Merge branch 'alpha' of github.com-Thor963:stallion-tech/react-native…
Thor963 Jun 18, 2025
0f50efb
chore(release): 2.3.0-alpha.3
Jun 18, 2025
6c8202f
fix: android sdk token expriy logic fixed (#66)
Thor963 Jun 25, 2025
aebbe3e
chore(release): 2.3.0-alpha.4
Jun 25, 2025
044a5ad
fix: release v2.3.0-alpha.5 (#75)
Thor963 Nov 26, 2025
1093587
chore(release): 2.3.0-alpha.5
Nov 26, 2025
e7b9443
fix: js error boundary, exception handler safety checks (#86)
Thor963 Dec 16, 2025
3269c88
chore(release): 2.3.0-alpha.6
Dec 16, 2025
03cf350
chore: package stable update
Dec 17, 2025
c92e6cd
fix: android 16kb, removed react codegen block (#91)
Thor963 Dec 30, 2025
5e8c51f
chore(release): 2.3.0-alpha.7
Dec 30, 2025
e431d97
fix: alpha 2.3.1 16kb support
Thor963 Dec 30, 2025
5d0f551
Revert "fix: alpha 2.3.1 16kb support"
Thor963 Dec 30, 2025
5890a27
fix: alpha 2.3.1 release
Thor963 Dec 30, 2025
c0d576d
chore(release): 2.3.0-alpha.8
Dec 30, 2025
44a53b2
chore: back merged main
Dec 30, 2025
1b212c7
chore(release): 2.4.0-alpha.1
Dec 30, 2025
0147989
chore: back merge main
Jan 2, 2026
8d071c0
chore(release): 2.4.0-alpha.2
Jan 2, 2026
0cdde47
fix: ios precompiled deps fix pod deps installation (#93)
Thor963 Jan 3, 2026
7c1076c
chore(release): 2.4.0-alpha.3
Jan 3, 2026
3430975
feat: 2.4.0 alpha (#96)
Thor963 Jan 14, 2026
64035c3
chore(release): 2.4.0-alpha.4
Jan 14, 2026
bb51fa5
fix: getActiveBundleHash function added (#101)
Thor963 Feb 13, 2026
7cee360
chore(release): 2.4.0-alpha.5
Feb 13, 2026
1d26cd0
chore: back merged main
Thor963 Mar 5, 2026
017e79a
fix: added 16kb support for bspatch lib also (#114)
Thor963 Apr 24, 2026
27439a3
chore(release): 2.4.0-alpha.6
Apr 24, 2026
cb5e74e
chore: updated stable sdk version
Thor963 May 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ lib/

sdk-package

ios/main/StallionVersion.h
ios/main/StallionVersion.h
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
## [2.3.2](https://github.com/stallion-tech/react-native-stallion/compare/v2.3.1...v2.3.2) (2026-01-13)
# [2.4.0-alpha.6](https://github.com/stallion-tech/react-native-stallion/compare/v2.4.0-alpha.5...v2.4.0-alpha.6) (2026-04-24)


### Bug Fixes

* added 16kb support for bspatch lib also ([#114](https://github.com/stallion-tech/react-native-stallion/issues/114)) ([017e79a](https://github.com/stallion-tech/react-native-stallion/commit/017e79a124f0043c54cab302a47b1e1833927b16))
* ios podspec precompiled deps support ([#94](https://github.com/stallion-tech/react-native-stallion/issues/94)) ([35f255f](https://github.com/stallion-tech/react-native-stallion/commit/35f255f74644f993a67d4e727dc751f31d4f08a0))

# [2.4.0-alpha.5](https://github.com/stallion-tech/react-native-stallion/compare/v2.4.0-alpha.4...v2.4.0-alpha.5) (2026-02-13)


### Bug Fixes

* getActiveBundleHash function added ([#101](https://github.com/stallion-tech/react-native-stallion/issues/101)) ([bb51fa5](https://github.com/stallion-tech/react-native-stallion/commit/bb51fa551b05b6eb3d4996e2db0d4c9b895a64d8))

# [2.4.0-alpha.4](https://github.com/stallion-tech/react-native-stallion/compare/v2.4.0-alpha.3...v2.4.0-alpha.4) (2026-01-14)


### Features

* 2.4.0 alpha ([#96](https://github.com/stallion-tech/react-native-stallion/issues/96)) ([3430975](https://github.com/stallion-tech/react-native-stallion/commit/3430975b038b0d82f1549d104d7277ce2d540020))

# [2.4.0-alpha.3](https://github.com/stallion-tech/react-native-stallion/compare/v2.4.0-alpha.2...v2.4.0-alpha.3) (2026-01-03)


Expand All @@ -19,6 +34,8 @@

* android 16kb page size fix, new arch codegen removed ([#92](https://github.com/stallion-tech/react-native-stallion/issues/92)) ([9b2f91a](https://github.com/stallion-tech/react-native-stallion/commit/9b2f91a71dc603c58653fd1c924221be7b81ee5b))

## [2.3.2](https://github.com/stallion-tech/react-native-stallion/compare/v2.3.1...v2.3.2) (2026-01-13)

## [2.3.1](https://github.com/stallion-tech/react-native-stallion/compare/v2.3.0...v2.3.1) (2025-12-31)

### Bug Fixes
Expand Down
45 changes: 45 additions & 0 deletions android/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ add_library(
stallion_signal_handler.cpp
)

# Build bzip2 as a static library
# Using the same bzip2 that works in iOS and CLI
add_library(
bzip2_static
STATIC
bzip2/blocksort.c
bzip2/huffman.c
bzip2/crctable.c
bzip2/randtable.c
bzip2/compress.c
bzip2/decompress.c
bzip2/bzlib.c
)

# Include bzip2 headers
target_include_directories(
bzip2_static
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/bzip2
)

add_library(
stallion-bspatch
SHARED
bspatch_bridge.c
stallion_bspatch_jni.cpp
)

find_library(
log-lib
log
Expand All @@ -18,8 +46,25 @@ target_link_libraries(
${log-lib}
)

target_link_libraries(
stallion-bspatch
${log-lib}
bzip2_static
)

# Include bzip2 headers for bspatch
target_include_directories(
stallion-bspatch
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/bzip2
)

# Fix for 16KB page size compatibility (required for Android 15+)
# This ensures LOAD segments are aligned at 16KB boundaries
set_target_properties(stallion-crash PROPERTIES
LINK_FLAGS "-Wl,-z,max-page-size=16384"
)

set_target_properties(stallion-bspatch PROPERTIES
LINK_FLAGS "-Wl,-z,max-page-size=16384"
)
268 changes: 268 additions & 0 deletions android/src/main/cpp/bspatch_bridge.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
//
// bspatch_bridge.c
// react-native-stallion
//
// Bridge implementation for Android - adapts shared bspatch.c to function interface
//

#include "bspatch_bridge.h"
#include <bzlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>

// Error codes (negative)
#define BSPATCH_ERR_OPEN_OLD -1
#define BSPATCH_ERR_OPEN_NEW -2
#define BSPATCH_ERR_OPEN_PATCH -3
#define BSPATCH_ERR_READ_HDR -4
#define BSPATCH_ERR_BAD_MAGIC -5
#define BSPATCH_ERR_READ_CTRL -6
#define BSPATCH_ERR_READ_DIFF -7
#define BSPATCH_ERR_READ_EXTRA -8
#define BSPATCH_ERR_SEEK_OLD -9
#define BSPATCH_ERR_WRITE_NEW -10
#define BSPATCH_ERR_BZ2_ERROR -11
#define BSPATCH_ERR_OVERFLOW -12

/* Type compatibility */
#ifndef u_char
#define u_char unsigned char
#endif

static off_t offtin(u_char *buf)
{
off_t y;

y=buf[7]&0x7F;
y=y*256;y+=buf[6];
y=y*256;y+=buf[5];
y=y*256;y+=buf[4];
y=y*256;y+=buf[3];
y=y*256;y+=buf[2];
y=y*256;y+=buf[1];
y=y*256;y+=buf[0];

if(buf[7]&0x80) y=-y;

return y;
}

int bspatch_apply(const char *oldPath, const char *newPath, const char *patchPath) {
FILE * f = NULL, * cpf = NULL, * dpf = NULL, * epf = NULL;
BZFILE * cpfbz2 = NULL, * dpfbz2 = NULL, * epfbz2 = NULL;
int cbz2err, dbz2err, ebz2err;
int fd = -1;
ssize_t oldsize,newsize;
ssize_t bzctrllen,bzdatalen;
u_char header[32],buf[8];
u_char *old = NULL, *new = NULL;
off_t oldpos,newpos;
off_t ctrl[3];
off_t lenread;
off_t i;
int ret = 0;

/*
File format:
0 8 "BSDIFF40"
8 8 X
16 8 Y
24 8 sizeof(newfile)
32 X bzip2(control block)
32+X Y bzip2(diff block)
32+X+Y ??? bzip2(extra block)
with control block a set of triples (x,y,z) meaning "add x bytes
from oldfile to x bytes from the diff block; copy y bytes from the
extra block; seek forwards in oldfile by z bytes".
*/

/* Open patch file */
if ((f = fopen(patchPath, "rb")) == NULL) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}

/* Read header */
if (fread(header, 1, 32, f) < 32) {
ret = BSPATCH_ERR_READ_HDR;
goto cleanup;
}

/* Check for appropriate magic */
if (memcmp(header, "BSDIFF40", 8) != 0) {
ret = BSPATCH_ERR_BAD_MAGIC;
goto cleanup;
}

/* Read lengths from header */
bzctrllen=offtin(header+8);
bzdatalen=offtin(header+16);
newsize=offtin(header+24);
if((bzctrllen<0) || (bzdatalen<0) || (newsize<0)) {
ret = BSPATCH_ERR_OVERFLOW;
goto cleanup;
}

/* Close patch file and re-open it via libbzip2 at the right places */
if (fclose(f)) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}
f = NULL;

/* Open control stream */
if ((cpf = fopen(patchPath, "rb")) == NULL) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}
if (fseeko(cpf, 32, SEEK_SET)) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}
if ((cpfbz2 = BZ2_bzReadOpen(&cbz2err, cpf, 0, 0, NULL, 0)) == NULL) {
ret = BSPATCH_ERR_BZ2_ERROR;
goto cleanup;
}

/* Open diff stream */
if ((dpf = fopen(patchPath, "rb")) == NULL) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}
if (fseeko(dpf, 32 + bzctrllen, SEEK_SET)) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}
if ((dpfbz2 = BZ2_bzReadOpen(&dbz2err, dpf, 0, 0, NULL, 0)) == NULL) {
ret = BSPATCH_ERR_BZ2_ERROR;
goto cleanup;
}

/* Open extra stream */
if ((epf = fopen(patchPath, "rb")) == NULL) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}
if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET)) {
ret = BSPATCH_ERR_OPEN_PATCH;
goto cleanup;
}
if ((epfbz2 = BZ2_bzReadOpen(&ebz2err, epf, 0, 0, NULL, 0)) == NULL) {
ret = BSPATCH_ERR_BZ2_ERROR;
goto cleanup;
}

/* Load old file into memory */
if(((fd=open(oldPath,O_RDONLY,0))<0) ||
((oldsize=lseek(fd,0,SEEK_END))==-1) ||
((old=malloc(oldsize+1))==NULL) ||
(lseek(fd,0,SEEK_SET)!=0) ||
(read(fd,old,oldsize)!=oldsize) ||
(close(fd)==-1)) {
if (fd >= 0) close(fd);
fd = -1;
ret = BSPATCH_ERR_OPEN_OLD;
goto cleanup;
}
fd = -1;

/* Allocate memory for new file */
if((new=malloc(newsize+1))==NULL) {
ret = BSPATCH_ERR_OVERFLOW;
goto cleanup;
}

oldpos=0;newpos=0;
while(newpos<newsize) {
/* Read control data */
for(i=0;i<=2;i++) {
lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8);
if ((lenread < 8) || ((cbz2err != BZ_OK) &&
(cbz2err != BZ_STREAM_END))) {
ret = BSPATCH_ERR_READ_CTRL;
goto cleanup;
}
ctrl[i]=offtin(buf);
};

/* Sanity-check */
if(newpos+ctrl[0]>newsize) {
ret = BSPATCH_ERR_OVERFLOW;
goto cleanup;
}

/* Read diff string */
lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]);
if ((lenread < ctrl[0]) ||
((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END))) {
ret = BSPATCH_ERR_READ_DIFF;
goto cleanup;
}

/* Add old data to diff string */
for(i=0;i<ctrl[0];i++)
if((oldpos+i>=0) && (oldpos+i<oldsize))
new[newpos+i]+=old[oldpos+i];

/* Adjust pointers */
newpos+=ctrl[0];
oldpos+=ctrl[0];

/* Sanity-check */
if(newpos+ctrl[1]>newsize) {
ret = BSPATCH_ERR_OVERFLOW;
goto cleanup;
}

/* Read extra string */
lenread = BZ2_bzRead(&ebz2err, epfbz2, new + newpos, ctrl[1]);
if ((lenread < ctrl[1]) ||
((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END))) {
ret = BSPATCH_ERR_READ_EXTRA;
goto cleanup;
}

/* Adjust pointers */
newpos+=ctrl[1];
oldpos+=ctrl[2];
};

/* Clean up the bzip2 reads */
BZ2_bzReadClose(&cbz2err, cpfbz2);
cpfbz2 = NULL;
BZ2_bzReadClose(&dbz2err, dpfbz2);
dpfbz2 = NULL;
BZ2_bzReadClose(&ebz2err, epfbz2);
epfbz2 = NULL;

/* Write the new file */
if(((fd=open(newPath,O_CREAT|O_TRUNC|O_WRONLY,0666))<0) ||
(write(fd,new,newsize)!=newsize) || (close(fd)==-1)) {
if (fd >= 0) close(fd);
fd = -1;
ret = BSPATCH_ERR_WRITE_NEW;
goto cleanup;
}
fd = -1;

ret = 0;

cleanup:
if (cpfbz2) BZ2_bzReadClose(&cbz2err, cpfbz2);
if (dpfbz2) BZ2_bzReadClose(&dbz2err, dpfbz2);
if (epfbz2) BZ2_bzReadClose(&ebz2err, epfbz2);
if (f) fclose(f);
if (cpf) fclose(cpf);
if (dpf) fclose(dpf);
if (epf) fclose(epf);
if (fd >= 0) close(fd);
if (new) free(new);
if (old) free(old);

return ret;
}
26 changes: 26 additions & 0 deletions android/src/main/cpp/bspatch_bridge.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// bspatch_bridge.h
// react-native-stallion
//
// Bridge header for Android JNI
//

#ifndef BSPATCH_BRIDGE_H
#define BSPATCH_BRIDGE_H

#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

// Apply a bsdiff patch file to oldPath, writing the result to newPath.
// Returns 0 on success, negative values on error.
int bspatch_apply(const char *oldPath, const char *newPath, const char *patchPath);

#ifdef __cplusplus
}
#endif

#endif /* BSPATCH_BRIDGE_H */

Loading
Loading