Skip to content

feat(ffi): Add ability to configure indexedb instead of sqlite for wasm platforms #5181

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

Closed
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
2 changes: 2 additions & 0 deletions bindings/matrix-sdk-ffi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Breaking changes:
- `RoomInfo` replaces its field `is_tombstoned: bool` with `tombstone: Option<RoomTombstoneInfo>`,
containing the data needed to implement the room migration UI, a message and the replacement room id.
([#5027](https://github.com/matrix-org/matrix-rust-sdk/pull/5027))
- Encapsulate the configuration of the sqlite system into a builder `SqliteSessionBuilder` to allow for
swapping with `IndexedDbSessionBuilder` on Wasm platforms.

Additions:

Expand Down
36 changes: 29 additions & 7 deletions bindings/matrix-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ publish = false
release = true

[lib]
crate-type = ["cdylib", "staticlib"]
crate-type = ["cdylib", "staticlib", "lib"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's related to what the patch says it does. Can you split this in another patch please?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this seems weird, what's the idea with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The uniffi bindings generator requires the library to be built as a "lib" so it can be included in a second generated-rust library that is fed through. But I will break that out into a second PR.


[features]
default = ["bundled-sqlite", "unstable-msc4274"]
bundled-sqlite = ["matrix-sdk/bundled-sqlite"]
unstable-msc4274 = ["matrix-sdk-ui/unstable-msc4274"]
cross-platform-api = []

[dependencies]
anyhow.workspace = true
as_variant.workspace = true
async-compat = "0.2.4"
extension-trait = "1.0.1"
eyeball-im.workspace = true
futures-util.workspace = true
Expand All @@ -36,21 +36,18 @@ matrix-sdk-ui = { workspace = true, features = ["uniffi"] }
mime = "0.3.16"
once_cell.workspace = true
ruma = { workspace = true, features = ["html", "unstable-unspecified", "unstable-msc3488", "compat-unset-avatar", "unstable-msc3245-v1-compat", "unstable-msc4278"] }
sentry-tracing = "0.36.0"
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
tracing.workspace = true
tracing-appender = { version = "0.2.2" }
tracing-core.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter"] }
uniffi = { workspace = true, features = ["tokio"] }
url.workspace = true
uuid = { version = "1.4.1", features = ["v4"] }
zeroize.workspace = true

[target.'cfg(not(target_os = "android"))'.dependencies.matrix-sdk]
[target.'cfg(all(not(target_os = "android"), not(target_family = "wasm")))'.dependencies.matrix-sdk]
workspace = true
features = [
"anyhow",
Expand All @@ -64,7 +61,7 @@ features = [
"uniffi",
]

[target.'cfg(not(target_os = "android"))'.dependencies.sentry]
[target.'cfg(all(not(target_os = "android"), not(target_family = "wasm")))'.dependencies.sentry]
version = "0.36.0"
default-features = false
features = [
Expand All @@ -77,6 +74,31 @@ features = [
"reqwest",
]

[target.'cfg(target_family = "wasm")'.dependencies]
matrix-sdk-ui = { workspace = true, features = ["js", "uniffi"] }
tokio = { workspace = true, features = ["sync", "macros"] }
uniffi = { workspace = true, features = [] }

[target.'cfg(target_family = "wasm")'.dependencies.matrix-sdk]
workspace = true
features = [
"anyhow",
"e2e-encryption",
"experimental-widgets",
"markdown",
"native-tls",
"socks",
"indexeddb",
"uniffi",
]

[target.'cfg(not(target_family = "wasm"))'.dependencies]
async-compat.workspace = true
matrix-sdk-ui = { workspace = true, features = ["uniffi"] }
sentry-tracing = "0.36.0"
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
uniffi = { workspace = true, features = ["tokio"] }

[target.'cfg(target_os = "android")'.dependencies]
paranoid-android = "0.2.1"

Expand Down
Loading
Loading