forked from Henry-Hiles/nexus
shows room but not really
This commit is contained in:
parent
85d96b80bc
commit
a28bced44d
23 changed files with 885 additions and 805 deletions
24
lib/controllers/header_controller.dart
Normal file
24
lib/controllers/header_controller.dart
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import "package:ffi/ffi.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/controllers/client_controller.dart";
|
||||
import "package:nexus/src/third_party/gomuks.g.dart";
|
||||
|
||||
class HeaderController extends AsyncNotifier<Map<String, String>> {
|
||||
@override
|
||||
Future<Map<String, String>> build() async {
|
||||
final handle = await ref.watch(ClientController.provider.future);
|
||||
final info = GomuksGetAccountInfo(handle);
|
||||
final headers = {
|
||||
"authorization":
|
||||
"Bearer ${info.access_token.cast<Utf8>().toDartString()}",
|
||||
};
|
||||
|
||||
GomuksFreeAccountInfo(info);
|
||||
return headers;
|
||||
}
|
||||
|
||||
static final provider =
|
||||
AsyncNotifierProvider<HeaderController, Map<String, String>>(
|
||||
HeaderController.new,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue