mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-26 08:02:34 +01:00
Merge branch 'soru/login-fixes' into 'main'
fix: Re-add login fixes with the new SDK See merge request famedly/fluffychat!491
This commit is contained in:
commit
980cd32aaf
@ -98,25 +98,20 @@ class LoginController extends State<Login> {
|
|||||||
setState(() => usernameError = null);
|
setState(() => usernameError = null);
|
||||||
if (!userId.isValidMatrixId) return;
|
if (!userId.isValidMatrixId) return;
|
||||||
try {
|
try {
|
||||||
final wellKnownInformations =
|
final oldHomeserver = Matrix.of(context).client.homeserver;
|
||||||
await Matrix.of(context).client.getWellknown();
|
var newDomain = Uri.https(userId.domain, '');
|
||||||
final newDomain = wellKnownInformations.mHomeserver?.baseUrl;
|
Matrix.of(context).client.homeserver = newDomain;
|
||||||
if ((newDomain?.toString()?.isNotEmpty ?? false) &&
|
DiscoveryInformation wellKnownInformation;
|
||||||
newDomain != Matrix.of(context).client.homeserver) {
|
try {
|
||||||
var jitsi = wellKnownInformations?.additionalProperties
|
wellKnownInformation = await Matrix.of(context).client.getWellknown();
|
||||||
?.tryGet<Map<String, dynamic>>('im.vector.riot.jitsi')
|
if (wellKnownInformation.mHomeserver?.baseUrl?.toString()?.isNotEmpty ??
|
||||||
?.tryGet<String>('preferredDomain');
|
false) {
|
||||||
if (jitsi != null) {
|
newDomain = wellKnownInformation.mHomeserver.baseUrl;
|
||||||
if (!jitsi.endsWith('/')) {
|
|
||||||
jitsi += '/';
|
|
||||||
}
|
|
||||||
Logs().v('Found custom jitsi instance $jitsi');
|
|
||||||
await Matrix.of(context)
|
|
||||||
.store
|
|
||||||
.setItem(SettingKeys.jitsiInstance, jitsi);
|
|
||||||
AppConfig.jitsiInstance = jitsi;
|
|
||||||
}
|
}
|
||||||
final oldHomeserver = Matrix.of(context).client.homeserver;
|
} catch (_) {
|
||||||
|
// do nothing, newDomain is already set to a reasonable fallback
|
||||||
|
}
|
||||||
|
if (newDomain != oldHomeserver) {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
// do nothing if we error, we'll handle it below
|
// do nothing if we error, we'll handle it below
|
||||||
@ -141,8 +136,22 @@ class LoginController extends State<Login> {
|
|||||||
setState(() => usernameError = null);
|
setState(() => usernameError = null);
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context, rootNavigator: false).pop();
|
Navigator.of(context, rootNavigator: false).pop();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var jitsi = wellKnownInformation?.additionalProperties
|
||||||
|
?.tryGet<Map<String, dynamic>>('im.vector.riot.jitsi')
|
||||||
|
?.tryGet<String>('preferredDomain');
|
||||||
|
if (jitsi != null) {
|
||||||
|
if (!jitsi.endsWith('/')) {
|
||||||
|
jitsi += '/';
|
||||||
|
}
|
||||||
|
Logs().v('Found custom jitsi instance $jitsi');
|
||||||
|
await Matrix.of(context)
|
||||||
|
.store
|
||||||
|
.setItem(SettingKeys.jitsiInstance, jitsi);
|
||||||
|
AppConfig.jitsiInstance = jitsi;
|
||||||
|
}
|
||||||
setState(() => usernameError = null);
|
setState(() => usernameError = null);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user