Skip to content

Commit

Permalink
chore: bump nitro to 0.7.0, patch rnscreens, java22 & gradle 8.8 (mar…
Browse files Browse the repository at this point in the history
  • Loading branch information
boorad authored Sep 8, 2024
1 parent de94007 commit 252758b
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
distribution: corretto
java-version: 22
cache: gradle

- name: Setup Android SDK
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
distribution: corretto
java-version: 22
cache: gradle

- name: Setup Android SDK
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,8 @@ lib/
# TypeScript
tsconfig.tsbuildinfo

# jenv
.java-version

# development stuffs
example0/
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Fri Aug 09 17:48:30 EDT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PODS:
- hermes-engine (0.74.5):
- hermes-engine/Pre-built (= 0.74.5)
- hermes-engine/Pre-built (0.74.5)
- NitroModules (0.4.0):
- NitroModules (0.7.0):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -29,7 +29,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- OpenSSL-Universal (3.2.2000)
- QuickCrypto (1.0.0-beta.2):
- QuickCrypto (1.0.0-beta.3):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1564,9 +1564,9 @@ SPEC CHECKSUMS:
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f
hermes-engine: 8c1577f3fdb849cbe7729c2e7b5abc4b845e88f8
NitroModules: da051fe7d5765063eb128f5fa920e0e3aa5b09b6
NitroModules: 7c4be57284deac5fbdfd23457cd1aaedfc810c98
OpenSSL-Universal: f8a9c4fdab7e21cb70bda471c269e86e9212439c
QuickCrypto: f7ee33fc626d3b924ef8314bead200e028370146
QuickCrypto: 744978daf1eb30c6dec0f68658de0c5726d9793b
RCT-Folly: 02617c592a293bd6d418e0a88ff4ee1f88329b47
RCTDeprecation: 3afceddffa65aee666dafd6f0116f1d975db1584
RCTRequired: ec1239bc9d8bf63e10fb92bd8b26171a9258e0c1
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"react": "^18.3.1",
"react-native": "^0.74.5",
"react-native-bouncy-checkbox": "4.0.1",
"react-native-nitro-modules": "0.4.0",
"react-native-nitro-modules": "0.7.0",
"react-native-quick-base64": "2.1.2",
"react-native-quick-crypto": "*",
"react-native-safe-area-context": "4.10.8",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@
}
}
}
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
}
26 changes: 18 additions & 8 deletions packages/react-native-quick-crypto/cpp/random/HybridRandom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,37 @@ namespace margelo::crypto {
using namespace margelo::nitro;
using namespace margelo::nitro::crypto;

std::future<std::shared_ptr<ArrayBuffer>> HybridRandom::randomFill(const std::shared_ptr<ArrayBuffer>& buffer, double dOffset,
double dSize) {
std::future<std::shared_ptr<ArrayBuffer>>
HybridRandom::randomFill(const std::shared_ptr<ArrayBuffer>& buffer,
double dOffset,
double dSize) {
size_t size = checkSize(dSize);
// copy the JSArrayBuffer that we do not own into a NativeArrayBuffer that we do own, before passing to sync function
// copy the JSArrayBuffer that we do not own into a NativeArrayBuffer that we
// do own, before passing to sync function
uint8_t* data = new uint8_t[size];
memcpy(data, buffer.get()->data(), size);
std::shared_ptr<ArrayBuffer> nativeBuffer = std::make_shared<NativeArrayBuffer>(data, size, false);
std::shared_ptr<ArrayBuffer> nativeBuffer =
std::make_shared<NativeArrayBuffer>(data, size, [=]() { delete[] data; });

return std::async(std::launch::async,
[this, nativeBuffer, dOffset, dSize]() { return this->randomFillSync(nativeBuffer, dOffset, dSize); });
[this, nativeBuffer, dOffset, dSize]() {
return this->randomFillSync(nativeBuffer, dOffset, dSize);
});
};

std::shared_ptr<ArrayBuffer> HybridRandom::randomFillSync(const std::shared_ptr<ArrayBuffer>& buffer, double dOffset, double dSize) {
std::shared_ptr<ArrayBuffer>
HybridRandom::randomFillSync(const std::shared_ptr<ArrayBuffer>& buffer,
double dOffset,
double dSize) {
size_t size = checkSize(dSize);
size_t offset = checkOffset(dSize, dOffset);
uint8_t* data = buffer.get()->data();

if (RAND_bytes(data + offset, (int)size) != 1) {
throw std::runtime_error("error calling RAND_bytes" + std::to_string(ERR_get_error()));
throw std::runtime_error("error calling RAND_bytes" +
std::to_string(ERR_get_error()));
}
return std::make_shared<NativeArrayBuffer>(data, size, false);
return std::make_shared<NativeArrayBuffer>(data, size, nullptr);
};

} // namespace margelo::crypto
6 changes: 3 additions & 3 deletions packages/react-native-quick-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"dependencies": {
"@craftzdog/react-native-buffer": "6.0.5",
"events": "3.3.0",
"react-native-nitro-modules": "0.4.0",
"react-native-nitro-modules": "0.7.0",
"react-native-quick-base64": "2.1.2",
"readable-stream": "4.5.2",
"string_decoder": "1.3.0",
Expand All @@ -84,11 +84,11 @@
"eslint": "9.9.0",
"eslint-plugin-react-native": "^4.1.0",
"jest": "29.7.0",
"nitro-codegen": "0.4.0",
"nitro-codegen": "0.7.0",
"prettier": "3.2.5",
"react": "18.3.1",
"react-native": "0.74.5",
"react-native-builder-bob": "0.29.1",
"react-native-builder-bob": "0.30.0",
"release-it": "17.6.0",
"typescript": "5.1.6",
"typescript-eslint": "^8.1.0"
Expand Down
26 changes: 26 additions & 0 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.h b/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.h
index 32d55119511f03fe94367fe81c672a7d83e1168e..3ede30c142f8e465fba41029b1d72ebc7a4268e3 100644
--- a/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.h
+++ b/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.h
@@ -20,7 +20,7 @@ class JSI_EXPORT RNSModalScreenShadowNode final
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;

- Point getContentOriginOffset() const override;
+ Point getContentOriginOffset() const;
static ShadowNodeTraits BaseTraits() {
auto traits = ConcreteViewShadowNode::BaseTraits();
traits.set(ShadowNodeTraits::Trait::RootNodeKind);
diff --git a/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h b/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h
index 0de3b2f32feee6a99c297291ee1d301822a18ad7..baa04882c66832b765123848ae1538c37bfb7fac 100644
--- a/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h
+++ b/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h
@@ -19,7 +19,7 @@ class JSI_EXPORT RNSScreenShadowNode final : public ConcreteViewShadowNode<
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;

- Point getContentOriginOffset() const override;
+ Point getContentOriginOffset() const;
};

} // namespace react

0 comments on commit 252758b

Please sign in to comment.