Skip to content

Commit

Permalink
feat: Upgrade all dependencies, refactor flutter rust bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
4o3F committed Feb 25, 2024
1 parent cf14a90 commit bb4423a
Show file tree
Hide file tree
Showing 34 changed files with 1,432 additions and 1,950 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
.idea/
build/
.dart_tool/
rust_builder
rust_builder
logs
4 changes: 2 additions & 2 deletions flutter_rust_bridge.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rust_input: rust/src/api/**/*.rs
dart_output: lib/src/rust
rust_input: rust/src/**/api.rs
dart_output: lib/native
5 changes: 2 additions & 3 deletions integration_test/simple_test.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ascent/main.dart';
import 'package:ascent/src/rust/frb_generated.dart';
import 'package:ascent/native/frb_generated.dart';
import 'package:integration_test/integration_test.dart';

void main() {
if (kIsWeb) IntegrationTestWidgetsFlutterBinding.ensureInitialized();
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUpAll(() async => await RustLib.init());
testWidgets('Can call rust function', (WidgetTester tester) async {
await tester.pumpWidget(const MyApp());
Expand Down
22 changes: 0 additions & 22 deletions lib/ffi.dart

This file was deleted.

7 changes: 4 additions & 3 deletions lib/foreground/connect.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';
import 'dart:isolate';

import 'package:ascent/ffi.dart';
import 'package:ascent/native/api.dart' as api;
import 'package:ascent/global_state.dart';
import 'package:ascent/pages/connect/logic.dart';
import 'package:bruno/bruno.dart';
Expand Down Expand Up @@ -83,8 +84,8 @@ class ConnectTaskHandler extends TaskHandler {
api
.doConnect(port: port, dataFolder: GlobalState.dataDir.path)
.catchError((error) {
if (error is FrbAnyhowException) {
errorMessage = error.anyhow;
if (error is AnyhowException) {
errorMessage = error.message;
} else {
errorMessage = error.toString();
}
Expand Down
6 changes: 3 additions & 3 deletions lib/foreground/pair.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:io';
import 'dart:isolate';

import 'package:ascent/ffi.dart';
import 'package:ascent/native/api.dart' as api;
import 'package:ascent/global_state.dart';
import 'package:bruno/bruno.dart';
import 'package:easy_localization/easy_localization.dart';
Expand Down Expand Up @@ -91,8 +91,8 @@ class PairTaskHandler extends TaskHandler {
api
.doPair(port: port, code: code, dataFolder: GlobalState.dataDir.path)
.catchError((error) {
if (error is FrbAnyhowException) {
errorMessage = error.anyhow;
if (error is AnyhowException) {
errorMessage = error.message;
} else {
errorMessage = error.toString();
}
Expand Down
2 changes: 2 additions & 0 deletions lib/foreground/root_connect.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:isolate';

import 'package:ascent/global_state.dart';
import 'package:ascent/pages/connect/logic.dart';
import 'package:bruno/bruno.dart';
Expand Down

0 comments on commit bb4423a

Please sign in to comment.