use new access token thingy

This commit is contained in:
Henry Hiles 2026-02-08 12:30:54 -05:00
commit e8de3985a9
No known key found for this signature in database
3 changed files with 12 additions and 17 deletions

View file

@ -1,23 +1,11 @@
import "dart:ffi";
import "dart:isolate";
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 = await Isolate.run(() => GomuksGetAccountInfo(handle));
final headers = {
if (info.access_token != nullptr)
"authorization":
"Bearer ${info.access_token.cast<Utf8>().toDartString()}",
};
await Isolate.run(() => GomuksFreeAccountInfo(info));
return headers;
final client = ref.watch(ClientController.provider.notifier);
return {"authorization": "Bearer ${await client.getAccessToken()}"};
}
static final provider =