Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update ubrn and adapt android codegen path #11

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,7 @@ npm i @unomed/react-native-matrix-sdk
yarn add @unomed/react-native-matrix-sdk
```

You also have to install [uniffi-bindgen-react-native]. This will only be necessary until its
Pod has been released. Make sure that the SHA matches the release of react-native-matrix-sdk.

```sh
npm add https://github.com/jhugman/uniffi-bindgen-react-native#$sha
yarn add uniffi-bindgen-react-native@https://github.com/jhugman/uniffi-bindgen-react-native#$sha
```

Afterwards add the Pod and run `pod install`.

```
target 'MyAwesomeApp' do
pod 'uniffi-bindgen-react-native', :path => '../node_modules/uniffi-bindgen-react-native'
...
end
```
Make sure to run `pod install` after installing the package.

### Installation from local checkout

Expand Down
2,472 changes: 1,838 additions & 634 deletions cpp/generated/matrix_sdk_ffi.cpp

Large diffs are not rendered by default.

289 changes: 212 additions & 77 deletions cpp/generated/matrix_sdk_ffi.hpp

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ target 'ReactNativeMatrixSdkExample' do
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

# TODO: Remove once the pod has been published
pod 'uniffi-bindgen-react-native', :path => '../../node_modules/uniffi-bindgen-react-native'

target 'ReactNativeMatrixSdkExampleTests' do
inherit! :complete
# Pods for testing
Expand Down
17 changes: 8 additions & 9 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1510,8 +1510,8 @@ PODS:
- React-perflogger (= 0.76.1)
- React-utils (= 0.76.1)
- SocketRocket (0.7.1)
- uniffi-bindgen-react-native (0.28.2-0):
- React
- uniffi-bindgen-react-native (0.28.3-1):
- React-Core
- unomed-react-native-matrix-sdk (0.2.0):
- DoubleConversion
- glog
Expand All @@ -1532,6 +1532,7 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- uniffi-bindgen-react-native (= 0.28.3-1)
- Yoga
- Yoga (0.0.0)

Expand Down Expand Up @@ -1600,13 +1601,13 @@ DEPENDENCIES:
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- uniffi-bindgen-react-native (from `../../node_modules/uniffi-bindgen-react-native`)
- unomed-react-native-matrix-sdk (from `../..`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
trunk:
- SocketRocket
- uniffi-bindgen-react-native

EXTERNAL SOURCES:
boost:
Expand Down Expand Up @@ -1734,8 +1735,6 @@ EXTERNAL SOURCES:
:path: build/generated/ios
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
uniffi-bindgen-react-native:
:path: "../../node_modules/uniffi-bindgen-react-native"
unomed-react-native-matrix-sdk:
:path: "../.."
Yoga:
Expand Down Expand Up @@ -1805,10 +1804,10 @@ SPEC CHECKSUMS:
ReactCodegen: 865bafc5c17ec2181620ced1a32c39c38ab2951d
ReactCommon: 422e364463f33e336fc4db196aeb50fd801d90d6
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
uniffi-bindgen-react-native: caa3b0ec0a5c904fbc334fc63144146079ce3934
unomed-react-native-matrix-sdk: 2fa5156929998a85e7437549cd0ed5f2d3df8eb7
uniffi-bindgen-react-native: 29959d30509f56394fca1cbce568000ab0de8642
unomed-react-native-matrix-sdk: aa21710f20ddb6126c435e9632727b27282a98d4
Yoga: db69236006b8b1c6d55ab453390c882306cbf219

PODFILE CHECKSUM: 49b187f74553462550d36ec0be911b8ed042c199
PODFILE CHECKSUM: f31d96f710b5116b3170327449261b387e616e6d

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"ubrn:ios:build": "ubrn build ios --config ubrn.yaml",
"ubrn:ios:build:release": "yarn ubrn:ios:build --release",
"ubrn:checkout": "ubrn checkout --config ubrn.yaml",
"ubrn:clean": "rm -Rf cpp/ android/src/main/java ios/ src/Native* src/generated/ src/index.ts*",
"ubrn:clean": "del-cli cpp android/src/main/java ios \"src/Native*\" src/generated \"src/index.ts*\"",
"ubrn:generate": "ubrn generate all --config ubrn.yaml build/RnMatrixRustSdk.xcframework/ios-arm64/libmatrix_sdk_ffi.a",
"generate": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android && yarn ubrn:ios",
"generate:release": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android:build:release && yarn ubrn:ios:build:release && yarn ubrn:generate && (cd example/ios && pod install)",
Expand Down Expand Up @@ -96,7 +96,7 @@
"release-it": "^15.0.0",
"turbo": "^1.10.7",
"typescript": "^5.2.2",
"uniffi-bindgen-react-native": "https://github.com/jhugman/uniffi-bindgen-react-native#c6f21855628db57719cb31fb0a4c5316a6d0c9b7"
"uniffi-bindgen-react-native": "^0.28.3-1"
},
"resolutions": {
"@types/react": "^18.2.44"
Expand Down
7 changes: 6 additions & 1 deletion src/generated/matrix_sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ import {

// Get converters from the other files, if any.

const uniffiIsDebug = process.env.uniffiIsDebug !== 'production' || false;
const uniffiIsDebug =
// @ts-ignore -- The process global might not be defined
typeof process !== 'object' ||
// @ts-ignore -- The process global might not be defined
process?.env?.NODE_ENV !== 'production' ||
false;
// Public interface members begin here.

/**
Expand Down
7 changes: 6 additions & 1 deletion src/generated/matrix_sdk_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ import {

// Get converters from the other files, if any.

const uniffiIsDebug = process.env.uniffiIsDebug !== 'production' || false;
const uniffiIsDebug =
// @ts-ignore -- The process global might not be defined
typeof process !== 'object' ||
// @ts-ignore -- The process global might not be defined
process?.env?.NODE_ENV !== 'production' ||
false;
// Public interface members begin here.

const stringToArrayBuffer = (s: string): ArrayBuffer =>
Expand Down
7 changes: 6 additions & 1 deletion src/generated/matrix_sdk_common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ import {

// Get converters from the other files, if any.

const uniffiIsDebug = process.env.uniffiIsDebug !== 'production' || false;
const uniffiIsDebug =
// @ts-ignore -- The process global might not be defined
typeof process !== 'object' ||
// @ts-ignore -- The process global might not be defined
process?.env?.NODE_ENV !== 'production' ||
false;
// Public interface members begin here.

const stringToArrayBuffer = (s: string): ArrayBuffer =>
Expand Down
87 changes: 81 additions & 6 deletions src/generated/matrix_sdk_crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ import {

// Get converters from the other files, if any.

const uniffiIsDebug = process.env.uniffiIsDebug !== 'production' || false;
const uniffiIsDebug =
// @ts-ignore -- The process global might not be defined
typeof process !== 'object' ||
// @ts-ignore -- The process global might not be defined
process?.env?.NODE_ENV !== 'production' ||
false;
// Public interface members begin here.

/**
Expand Down Expand Up @@ -903,10 +908,56 @@ export enum UtdCause {
*/
Unknown,
/**
* This event was sent when we were not a member of the room (or invited),
* so it is impossible to decrypt (without MSC3061).
* We are missing the keys for this event, and the event was sent when we
* were not a member of the room (or invited).
*/
Membership,
SentBeforeWeJoined,
/**
* The message was sent by a user identity we have not verified, but the
* user was previously verified.
*/
VerificationViolation,
/**
* The [`crate::TrustRequirement`] requires that the sending device be
* signed by its owner, and it was not.
*/
UnsignedDevice,
/**
* The [`crate::TrustRequirement`] requires that the sending device be
* signed by its owner, and we were unable to securely find the device.
*
* This could be because the device has since been deleted, because we
* haven't yet downloaded it from the server, or because the session
* data was obtained from an insecure source (imported from a file,
* obtained from a legacy (asymmetric) backup, unsafe key forward, etc.)
*/
UnknownDevice,
/**
* We are missing the keys for this event, but it is a "device-historical"
* message and no backup is accessible or usable.
*
* Device-historical means that the message was sent before the current
* device existed (but the current user was probably a member of the room
* at the time the message was sent). Not to
* be confused with pre-join or pre-invite messages (see
* [`UtdCause::SentBeforeWeJoined`] for that).
*/
HistoricalMessage,
/**
* The keys for this event are intentionally withheld.
*
* The sender has refused to share the key because our device does not meet
* the sender's security requirements.
*/
WithheldForUnverifiedOrInsecureDevice,
/**
* The keys for this event are missing, likely because the sender was
* unable to share them (e.g., failure to establish an Olm 1:1
* channel). Alternatively, the sender may have deliberately excluded
* this device by cherry-picking and blocking it, in which case, no action
* can be taken on our side.
*/
WithheldBySender,
}

const FfiConverterTypeUtdCause = (() => {
Expand All @@ -918,7 +969,19 @@ const FfiConverterTypeUtdCause = (() => {
case 1:
return UtdCause.Unknown;
case 2:
return UtdCause.Membership;
return UtdCause.SentBeforeWeJoined;
case 3:
return UtdCause.VerificationViolation;
case 4:
return UtdCause.UnsignedDevice;
case 5:
return UtdCause.UnknownDevice;
case 6:
return UtdCause.HistoricalMessage;
case 7:
return UtdCause.WithheldForUnverifiedOrInsecureDevice;
case 8:
return UtdCause.WithheldBySender;
default:
throw new UniffiInternalError.UnexpectedEnumCase();
}
Expand All @@ -927,8 +990,20 @@ const FfiConverterTypeUtdCause = (() => {
switch (value) {
case UtdCause.Unknown:
return ordinalConverter.write(1, into);
case UtdCause.Membership:
case UtdCause.SentBeforeWeJoined:
return ordinalConverter.write(2, into);
case UtdCause.VerificationViolation:
return ordinalConverter.write(3, into);
case UtdCause.UnsignedDevice:
return ordinalConverter.write(4, into);
case UtdCause.UnknownDevice:
return ordinalConverter.write(5, into);
case UtdCause.HistoricalMessage:
return ordinalConverter.write(6, into);
case UtdCause.WithheldForUnverifiedOrInsecureDevice:
return ordinalConverter.write(7, into);
case UtdCause.WithheldBySender:
return ordinalConverter.write(8, into);
}
}
allocationSize(value: TypeName): number {
Expand Down
Loading
Loading