Implement well-known support
This commit is contained in:
parent
cf70aa37cf
commit
ac63607f4a
|
@ -3,6 +3,7 @@
|
||||||
- Implement image viewer
|
- Implement image viewer
|
||||||
- Implement room pills
|
- Implement room pills
|
||||||
- New chat appBar showing presences and room avatars
|
- New chat appBar showing presences and room avatars
|
||||||
|
- Implement well-known support
|
||||||
|
|
||||||
# Version 0.13.2 - 2020-05-13
|
# Version 0.13.2 - 2020-05-13
|
||||||
### Fixes:
|
### Fixes:
|
||||||
|
|
|
@ -395,10 +395,12 @@ class _ChatState extends State<_Chat> {
|
||||||
ChatDetails(room),
|
ChatDetails(room),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: Text(room.getLocalizedDisplayname(L10n.of(context)),maxLines: 1),
|
title: Text(room.getLocalizedDisplayname(L10n.of(context)),
|
||||||
|
maxLines: 1),
|
||||||
subtitle: typingText.isEmpty
|
subtitle: typingText.isEmpty
|
||||||
? Text(
|
? Text(
|
||||||
room.getLocalizedStatus(context),maxLines: 1,
|
room.getLocalizedStatus(context),
|
||||||
|
maxLines: 1,
|
||||||
)
|
)
|
||||||
: Row(
|
: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -407,7 +409,8 @@ class _ChatState extends State<_Chat> {
|
||||||
size: 13),
|
size: 13),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
typingText,maxLines: 1,
|
typingText,
|
||||||
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
|
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||||
import 'package:fluffychat/components/matrix.dart';
|
import 'package:fluffychat/components/matrix.dart';
|
||||||
import 'package:fluffychat/l10n/l10n.dart';
|
import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:fluffychat/utils/app_route.dart';
|
import 'package:fluffychat/utils/app_route.dart';
|
||||||
|
@ -70,6 +72,35 @@ class _LoginState extends State<Login> {
|
||||||
AppRoute.defaultRoute(context, ChatListView()), (r) => false);
|
AppRoute.defaultRoute(context, ChatListView()), (r) => false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer _coolDown;
|
||||||
|
|
||||||
|
void _checkWellKnownWithCoolDown(String userId, BuildContext context) async {
|
||||||
|
_coolDown?.cancel();
|
||||||
|
_coolDown = Timer(
|
||||||
|
Duration(seconds: 1),
|
||||||
|
() => _checkWellKnown(userId, context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _checkWellKnown(String userId, BuildContext context) async {
|
||||||
|
setState(() => usernameError = null);
|
||||||
|
if (!userId.isValidMatrixId) return;
|
||||||
|
try {
|
||||||
|
final wellKnownInformations = await Matrix.of(context)
|
||||||
|
.client
|
||||||
|
.getWellKnownInformationsByUserId(userId);
|
||||||
|
final newDomain = wellKnownInformations.mHomeserver?.baseUrl;
|
||||||
|
if ((newDomain?.isNotEmpty ?? false) &&
|
||||||
|
newDomain != Matrix.of(context).client.homeserver) {
|
||||||
|
await SimpleDialogs(context).tryRequestWithErrorToast(
|
||||||
|
Matrix.of(context).client.checkServer(newDomain));
|
||||||
|
setState(() => usernameError = null);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState(() => usernameError = e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -98,6 +129,7 @@ class _LoginState extends State<Login> {
|
||||||
readOnly: loading,
|
readOnly: loading,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
onChanged: (t) => _checkWellKnownWithCoolDown(t, context),
|
||||||
controller: usernameController,
|
controller: usernameController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText:
|
hintText:
|
||||||
|
|
|
@ -147,8 +147,8 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: e8436198bbf77ad6d13d852d13e73e745a5df0cf
|
ref: "7c0d84b27f59adadf47f73394d5d2b53d3d3e773"
|
||||||
resolved-ref: e8436198bbf77ad6d13d852d13e73e745a5df0cf
|
resolved-ref: "7c0d84b27f59adadf47f73394d5d2b53d3d3e773"
|
||||||
url: "https://gitlab.com/famedly/famedlysdk.git"
|
url: "https://gitlab.com/famedly/famedlysdk.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|
|
@ -27,7 +27,7 @@ dependencies:
|
||||||
famedlysdk:
|
famedlysdk:
|
||||||
git:
|
git:
|
||||||
url: https://gitlab.com/famedly/famedlysdk.git
|
url: https://gitlab.com/famedly/famedlysdk.git
|
||||||
ref: e8436198bbf77ad6d13d852d13e73e745a5df0cf
|
ref: 7c0d84b27f59adadf47f73394d5d2b53d3d3e773
|
||||||
|
|
||||||
localstorage: ^3.0.1+4
|
localstorage: ^3.0.1+4
|
||||||
bubble: ^1.1.9+1
|
bubble: ^1.1.9+1
|
||||||
|
|
Loading…
Reference in a new issue