Fix web registration

This commit is contained in:
Christian Pauly 2020-02-17 14:07:57 +01:00
parent 8afa93e805
commit 604ed00592
2 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,8 @@
import 'package:fluffychat/components/matrix.dart'; import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart'; import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
class AuthWebView extends StatelessWidget { class AuthWebView extends StatelessWidget {
@ -14,6 +16,7 @@ class AuthWebView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final String url = Matrix.of(context).client.homeserver + final String url = Matrix.of(context).client.homeserver +
"/_matrix/client/r0/auth/$authType/fallback/web?session=$session"; "/_matrix/client/r0/auth/$authType/fallback/web?session=$session";
if (kIsWeb) launch(url);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(I18n.of(context).authentication), title: Text(I18n.of(context).authentication),
@ -29,10 +32,12 @@ class AuthWebView extends StatelessWidget {
children: <Widget>[ children: <Widget>[
LinearProgressIndicator(), LinearProgressIndicator(),
Expanded( Expanded(
child: WebView( child: kIsWeb
initialUrl: url, ? Center(child: Icon(Icons.link))
javascriptMode: JavascriptMode.unrestricted, : WebView(
), initialUrl: url,
javascriptMode: JavascriptMode.unrestricted,
),
), ),
], ],
), ),

View File

@ -124,8 +124,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "806f6449fcbd6735d62fd5ab7333607512557803" ref: b7dea7c6a5634f68816be9323ce78669b7d0ff0f
resolved-ref: "806f6449fcbd6735d62fd5ab7333607512557803" resolved-ref: b7dea7c6a5634f68816be9323ce78669b7d0ff0f
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"
@ -274,7 +274,7 @@ packages:
name: intl name: intl
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.1" version: "0.16.0"
intl_translation: intl_translation:
dependency: "direct main" dependency: "direct main"
description: description: