Add account switcher

Fixes #146
This commit is contained in:
Henry Hiles 2026-11-02 17:00:54 -05:00
commit 641341ed90
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

26
lib/models/account.dart Normal file
View file

@ -0,0 +1,26 @@
import "package:freezed_annotation/freezed_annotation.dart";
part "account.freezed.dart";
part "account.g.dart";
/// An account slot, each with its own gomuks directories.
///
/// Everything but [id] is cached from the last time the account was active, so
/// the account switcher and push routing work while it isn't.
@Freezed(toJson: false, fromJson: false)
@JsonSerializable()
class const Account({
required final String id,
final String? userId,
final String? deviceId,
final String? displayName,
final Uri? avatar,
}) with _$Account {
/// The slot accounts from before account switching existed
static const String legacyId = "default";
Map<String, Object?> toJson() => _$AccountToJson(this);
factory Account.fromJson(Map<String, Object?> json) =>
_$AccountFromJson(json);
}