Skip to content

Commit 8201383

Browse files
committed
fixup! TW-1699: app does start on linux
1 parent 8d10589 commit 8201383

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

lib/pages/connect/connect_page_mixin.dart

+7-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ mixin ConnectPageMixin {
2424

2525
static const redirectPublicPlatformOnWeb = 'post_login_redirect_url';
2626

27+
static const linowsRedirectUrl = 'http://localhost:60665';
28+
2729
bool supportsFlow({
2830
required BuildContext context,
2931
required String flowType,
@@ -45,10 +47,8 @@ mixin ConnectPageMixin {
4547
supportsFlow(context: context, flowType: 'm.login.password');
4648

4749
String _getRedirectUrlScheme(String redirectUrl) {
48-
// Remove when package limitation will be fixed
49-
// https://pub.dev/packages/flutter_web_auth_2#windows-and-linux
50-
if (PlatformInfos.isLinux || PlatformInfos.isWindows) {
51-
return "http://localhost:60665";
50+
if (PlatformInfos.isLinows) {
51+
return linowsRedirectUrl;
5252
}
5353
return Uri.parse(redirectUrl).scheme;
5454
}
@@ -98,8 +98,8 @@ mixin ConnectPageMixin {
9898
redirectUrl: redirectUrl,
9999
);
100100
final urlScheme = _getRedirectUrlScheme(redirectUrl);
101-
print("tez: urlScheme = $urlScheme");
102-
return await FlutterWebAuth2.authenticate(
101+
102+
return FlutterWebAuth2.authenticate(
103103
url: url,
104104
callbackUrlScheme: urlScheme,
105105
options: const FlutterWebAuth2Options(
@@ -214,6 +214,7 @@ mixin ConnectPageMixin {
214214
}
215215

216216
String _generateRedirectUrl(String homeserver) {
217+
if (PlatformInfos.isLinows) return linowsRedirectUrl;
217218
if (kIsWeb) {
218219
String? homeserverParam = '';
219220
if (homeserver.isNotEmpty) {

lib/utils/platform_infos.dart

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ abstract class PlatformInfos {
3232

3333
static bool get isDesktop => isLinux || isWindows || isMacOS;
3434

35+
static bool get isLinows => isLinux || isWindows;
36+
3537
static bool get usesTouchscreen => !isMobile;
3638

3739
static bool get platformCanRecord => (isMobile || isMacOS);

pubspec.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -3065,13 +3065,13 @@ packages:
30653065
source: hosted
30663066
version: "1.1.0"
30673067
web:
3068-
dependency: "direct overridden"
3068+
dependency: transitive
30693069
description:
30703070
name: web
3071-
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
3071+
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
30723072
url: "https://pub.dev"
30733073
source: hosted
3074-
version: "0.5.1"
3074+
version: "0.3.0"
30753075
web_socket_channel:
30763076
dependency: transitive
30773077
description:

pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ dependency_overrides:
275275
git:
276276
url: https://github.com/linagora/matrix_link_text.git
277277
ref: twake-supported
278-
web: ^0.5.0
279278

280279
cider:
281280
link_template:

0 commit comments

Comments
 (0)