ROOMS
This commit is contained in:
parent
65028a1231
commit
aaeee8e355
10 changed files with 527 additions and 164 deletions
|
|
@ -1,7 +1,10 @@
|
|||
import "dart:io";
|
||||
|
||||
import "package:flutter/foundation.dart";
|
||||
import "package:matrix/matrix.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:path/path.dart";
|
||||
import "package:path_provider/path_provider.dart";
|
||||
import "package:sqflite_common_ffi/sqflite_ffi.dart";
|
||||
|
||||
class ClientController extends AsyncNotifier<Client> {
|
||||
|
|
@ -9,18 +12,27 @@ class ClientController extends AsyncNotifier<Client> {
|
|||
Future<Client> build() async {
|
||||
final client = Client(
|
||||
"nexus",
|
||||
logLevel: kReleaseMode ? Level.warning : Level.verbose,
|
||||
importantStateEvents: {"im.ponies.room_emotes"},
|
||||
database: await MatrixSdkDatabase.init(
|
||||
"nexus",
|
||||
database: await databaseFactoryFfi.openDatabase("./test.db"),
|
||||
database: await databaseFactoryFfi.openDatabase(
|
||||
join((await getApplicationSupportDirectory()).path, "database.db"),
|
||||
),
|
||||
),
|
||||
);
|
||||
//mxc
|
||||
await client.checkHomeserver(Uri.https("federated.nexus"));
|
||||
await client.login(
|
||||
LoginType.mLoginPassword,
|
||||
identifier: AuthenticationUserIdentifier(user: "quadradical"),
|
||||
password: File("./password.txt").readAsStringSync(),
|
||||
);
|
||||
|
||||
// TODO: Save info
|
||||
if (client.homeserver == null) {
|
||||
await client.checkHomeserver(Uri.https("federated.nexus"));
|
||||
}
|
||||
if (client.accessToken == null) {
|
||||
await client.login(
|
||||
LoginType.mLoginPassword,
|
||||
identifier: AuthenticationUserIdentifier(user: "quadradical"),
|
||||
password: File("./password.txt").readAsStringSync(),
|
||||
);
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue