diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 4c62776..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index a443522..2ab6778 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ doc/api/ *.js_ *.js.deps *.js.map + +**/.DS_Store +.DS_Store \ No newline at end of file diff --git a/example/lib/pages/login_page.dart b/example/lib/pages/login_page.dart index 09e2f82..a9785db 100644 --- a/example/lib/pages/login_page.dart +++ b/example/lib/pages/login_page.dart @@ -28,11 +28,6 @@ class LoginPage extends HookWidget { @override Widget build(BuildContext context) { useListenable(wallet); - session.addListener(() { - if (session.initialized) { - context.goNamed('home'); - } - }); return Scaffold( body: Container( padding: const EdgeInsets.all(16), diff --git a/example/lib/session/foreground_session.dart b/example/lib/session/foreground_session.dart index 159f90c..68e1a92 100644 --- a/example/lib/session/foreground_session.dart +++ b/example/lib/session/foreground_session.dart @@ -126,12 +126,13 @@ class ForegroundSession extends ChangeNotifier { var prefs = await SharedPreferences.getInstance(); var api = createApi(); var client = await xmtp.Client.createFromWallet(api, wallet); - await prefs.setString("xmtp.keys", client.keys.writeToJson()); - await XmtpIsolate.spawn(client.keys); - me = client.keys.wallet; // Update the wallet address initialized = true; // Update the session state + await prefs.setString("xmtp.keys", client.keys.writeToJson()); + await XmtpIsolate.spawn(client.keys); + notifyListeners(); + return true; } catch (err) { return false; diff --git a/example/test/test_from_key.dart b/example/test/test_from_key.dart deleted file mode 100644 index 51c8b54..0000000 --- a/example/test/test_from_key.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:web3dart/web3dart.dart'; -import 'package:xmtp/xmtp.dart' as xmtp; -import 'package:example/session/foreground_session.dart'; -import "dart:math"; - -void main() { - - test('Test wallet authorization', () async { - var wallet = EthPrivateKey.fromHex('953bcdf6bbb41880dcc2f78d7a29b922aff84b4278ff6f5126e99e35417cf720').asSigner(); - print('Wallet address: ${await wallet.address}'); - // Uncomment this to clear the DB on startup - // await session.clear(); - //var api = xmtp.Api.create(); - var api = xmtp.Api.create(host: 'dev.xmtp.network'); - var client = await xmtp.Client.createFromWallet(api, wallet); - - //Random - var credentials1 = EthPrivateKey.createRandom(Random.secure()); - var wallet1 = credentials1.asSigner(); - print('Wallet address: ${await wallet1.address}'); - var api1 = xmtp.Api.create(host: 'dev.xmtp.network'); - var client1 = await xmtp.Client.createFromWallet(api1, wallet1); - }); -} \ No newline at end of file diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart deleted file mode 100644 index 092d222..0000000 --- a/example/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:example/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -}