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