forked from Nexus/nexus
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
85ce14f193 |
|||
|
46474fbae6 |
|||
|
32fd54fd78 |
|||
|
d753dc2261 |
|||
| f84009e602 |
4 changed files with 62 additions and 73 deletions
|
|
@ -130,7 +130,7 @@ class SettingsSectionsController
|
|||
.watch(ClientController.provider.notifier)
|
||||
.setAccountData(
|
||||
.new(
|
||||
type: AccountData.invitePermissionConfigKey,
|
||||
type: InvitePermissionConfig.key,
|
||||
content: InvitePermissionConfig(
|
||||
defaultAction: value,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -15,21 +15,17 @@ abstract class AccountData with _$AccountData {
|
|||
IList<RecentEmoji> recentEmoji,
|
||||
) => {"recent_emoji": recentEmoji.map((emoji) => emoji.toJson()).toList()};
|
||||
|
||||
static const invitePermissionConfigKey = "m.invite_permission_config";
|
||||
static const directKey = "m.direct";
|
||||
static const recentEmojiKey = "m.recent_emoji";
|
||||
|
||||
const factory AccountData({
|
||||
@JsonKey(name: AccountData.invitePermissionConfigKey)
|
||||
@JsonKey(name: InvitePermissionConfig.key)
|
||||
@Default(InvitePermissionConfig())
|
||||
InvitePermissionConfig invitePermissionConfig,
|
||||
|
||||
@JsonKey(name: AccountData.directKey)
|
||||
@JsonKey(name: "m.direct")
|
||||
@Default(IMap.empty())
|
||||
IMap<String, IList<String>> directMessages,
|
||||
|
||||
@JsonKey(
|
||||
name: AccountData.recentEmojiKey,
|
||||
name: "m.recent_emoji",
|
||||
readValue: AccountData.readRecentEmojiValue,
|
||||
toJson: AccountData.recentEmojiToJson,
|
||||
)
|
||||
|
|
@ -43,6 +39,8 @@ abstract class AccountData with _$AccountData {
|
|||
|
||||
@freezed
|
||||
abstract class InvitePermissionConfig with _$InvitePermissionConfig {
|
||||
static const key = "m.invite_permission_config";
|
||||
|
||||
const factory InvitePermissionConfig({
|
||||
@JsonKey(unknownEnumValue: DefaultInviteAction.allow)
|
||||
@Default(DefaultInviteAction.allow)
|
||||
|
|
|
|||
|
|
@ -60,32 +60,27 @@ class SelectServerPage extends HookConsumerWidget {
|
|||
AppLinks().uriLinkStream.listen((encodedUri) async {
|
||||
final state = encodedUri.queryParameters["state"];
|
||||
if (state != codeResponse.state) return;
|
||||
isLoading.value = true;
|
||||
|
||||
try {
|
||||
final code = encodedUri.queryParameters["code"];
|
||||
final code = encodedUri.queryParameters["code"];
|
||||
|
||||
if (code != null) {
|
||||
await ref
|
||||
.watch(ClientController.provider.notifier)
|
||||
.exchangeToken(
|
||||
.new(
|
||||
homeserverUrl: newUrl,
|
||||
codeVerifier: codeResponse.codeVerifier,
|
||||
redirectUri: .new(
|
||||
scheme: "nexus.federated.nexus",
|
||||
path: "/",
|
||||
),
|
||||
code: code,
|
||||
clientId: await ref.watch(
|
||||
ClientIdController.provider(newUrl).future,
|
||||
),
|
||||
if (code != null) {
|
||||
await ref
|
||||
.watch(ClientController.provider.notifier)
|
||||
.exchangeToken(
|
||||
.new(
|
||||
homeserverUrl: newUrl,
|
||||
codeVerifier: codeResponse.codeVerifier,
|
||||
redirectUri: .new(
|
||||
scheme: "nexus.federated.nexus",
|
||||
path: "/",
|
||||
),
|
||||
)
|
||||
.onError(showError);
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
code: code,
|
||||
clientId: await ref.watch(
|
||||
ClientIdController.provider(newUrl).future,
|
||||
),
|
||||
),
|
||||
)
|
||||
.onError(showError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,52 +40,48 @@ class RoomAppbar extends ConsumerWidget implements PreferredSizeWidget {
|
|||
constraints: .loose(.fromWidth(400)),
|
||||
child: Padding(
|
||||
padding: .all(24),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: .min,
|
||||
crossAxisAlignment: .start,
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(
|
||||
spacing: 12,
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
if (room.metadata?.avatar != null)
|
||||
ExpandableImage(
|
||||
room.metadata?.avatar == null
|
||||
? null
|
||||
: .new(mxc: room.metadata!.avatar!),
|
||||
child: AvatarOrHash(
|
||||
room.metadata?.avatar,
|
||||
room.metadata?.name ?? "Unnamed Room",
|
||||
height: 64,
|
||||
fallback: Icon(Icons.numbers),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
child: Column(
|
||||
mainAxisSize: .min,
|
||||
crossAxisAlignment: .start,
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(
|
||||
spacing: 12,
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
if (room.metadata?.avatar != null)
|
||||
ExpandableImage(
|
||||
room.metadata?.avatar == null
|
||||
? null
|
||||
: .new(mxc: room.metadata!.avatar!),
|
||||
child: AvatarOrHash(
|
||||
room.metadata?.avatar,
|
||||
room.metadata?.name ?? "Unnamed Room",
|
||||
overflow: .ellipsis,
|
||||
maxLines: 3,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.headlineSmall,
|
||||
height: 64,
|
||||
fallback: Icon(Icons.numbers),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (room.metadata?.topic?.isNotEmpty == true)
|
||||
LinkifiedText(
|
||||
room.metadata!.topic!,
|
||||
style: Theme.of(context).textTheme.bodyLarge
|
||||
?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
room.metadata?.name ?? "Unnamed Room",
|
||||
overflow: .ellipsis,
|
||||
maxLines: 3,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (room.metadata?.topic?.isNotEmpty == true)
|
||||
LinkifiedText(
|
||||
room.metadata!.topic!,
|
||||
style: Theme.of(context).textTheme.bodyLarge
|
||||
?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue