Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

mob integrate

Manav Rathi67003ca0b75d
diff --git a/mobile/apps/photos/integration_test/rust_bridge_test.dart b/mobile/apps/photos/integration_test/rust_bridge_test.dart
new file mode 100644
index 0000000000..ea1ce23ef9
--- /dev/null
+++ b/mobile/apps/photos/integration_test/rust_bridge_test.dart
@@ -0,0 +1,18 @@
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:photos/src/rust/api/urls.dart';
+import 'package:photos/src/rust/frb_generated.dart';
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ setUp(() async {
+ await RustLib.init();
+ });
+
+ test('file_download_url integration smoke test', () {
+ final url =
+ fileDownloadUrl(apiBaseUrl: 'https://api.ente.io', fileId: 12345);
+ expect(url, equals('https://files.ente.io/?fileID=12345'));
+ });
+}
diff --git a/mobile/apps/photos/rust/Cargo.lock b/mobile/apps/photos/rust/Cargo.lock
index a0e6572782..cabf13488d 100644
--- a/mobile/apps/photos/rust/Cargo.lock
+++ b/mobile/apps/photos/rust/Cargo.lock
@@ -309,6 +309,10 @@ dependencies = [
"crypto-common",
]
+[[package]]
+name = "ente-core"
+version = "0.0.1"
+
[[package]]
name = "env_filter"
version = "0.1.3"
@@ -710,6 +714,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
name = "rust_lib_photos"
version = "0.1.0"
dependencies = [
+ "ente-core",
"flutter_rust_bridge",
"usearch",
]
diff --git a/mobile/apps/photos/rust/Cargo.toml b/mobile/apps/photos/rust/Cargo.toml
index caa0946da5..87abbb5c51 100644
--- a/mobile/apps/photos/rust/Cargo.toml
+++ b/mobile/apps/photos/rust/Cargo.toml
@@ -9,6 +9,7 @@ crate-type = ["cdylib", "staticlib"]
[dependencies]
flutter_rust_bridge = "=2.11.1"
usearch = "2.21.3"
+ente-core = { path = "../../../../rust/core" }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
diff --git a/mobile/apps/photos/rust/src/api/mod.rs b/mobile/apps/photos/rust/src/api/mod.rs
index 3f601e97bc..8d2e90eb29 100644
--- a/mobile/apps/photos/rust/src/api/mod.rs
+++ b/mobile/apps/photos/rust/src/api/mod.rs
@@ -1,2 +1,3 @@
pub mod simple;
-pub mod usearch_api;
\ No newline at end of file
+pub mod urls;
+pub mod usearch_api;
diff --git a/mobile/apps/photos/rust/src/api/urls.rs b/mobile/apps/photos/rust/src/api/urls.rs
new file mode 100644
index 0000000000..00e4acd55f
--- /dev/null
+++ b/mobile/apps/photos/rust/src/api/urls.rs
@@ -0,0 +1,6 @@
+use flutter_rust_bridge::frb;
+
+#[frb(sync)]
+pub fn file_download_url(api_base_url: String, file_id: i64) -> String {
+ ente_core::urls::file_download_url(&api_base_url, file_id)
+}