Skip to content

Commit

Permalink
fixup! TW-1699: app does start on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Te-Z committed Apr 26, 2024
1 parent 0742534 commit 4d93694
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
13 changes: 7 additions & 6 deletions lib/presentation/mixins/connect_page_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ mixin ConnectPageMixin {

static const redirectPublicPlatformOnWeb = 'post_login_redirect_url';

static const linowsRedirectUrl = 'http://localhost:60665';

bool supportsFlow({
required BuildContext context,
required String flowType,
Expand All @@ -45,10 +47,8 @@ mixin ConnectPageMixin {
supportsFlow(context: context, flowType: 'm.login.password');

String _getRedirectUrlScheme(String redirectUrl) {
// Remove when package limitation will be fixed
// https://pub.dev/packages/flutter_web_auth_2#windows-and-linux
if (PlatformInfos.isLinux || PlatformInfos.isWindows) {
return "http://localhost:60665";
if (PlatformInfos.isLinows) {
return linowsRedirectUrl;
}
return Uri.parse(redirectUrl).scheme;
}
Expand Down Expand Up @@ -98,8 +98,8 @@ mixin ConnectPageMixin {
redirectUrl: redirectUrl,
);
final urlScheme = _getRedirectUrlScheme(redirectUrl);
print("tez: urlScheme = $urlScheme");
return await FlutterWebAuth2.authenticate(

return FlutterWebAuth2.authenticate(
url: url,
callbackUrlScheme: urlScheme,
options: const FlutterWebAuth2Options(
Expand Down Expand Up @@ -208,6 +208,7 @@ mixin ConnectPageMixin {
}

String _generateRedirectUrl(String homeserver) {
if (PlatformInfos.isLinows) return linowsRedirectUrl;
if (kIsWeb) {
String? homeserverParam = '';
if (homeserver.isNotEmpty) {
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/platform_infos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ abstract class PlatformInfos {

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

static bool get isLinows => isLinux || isWindows;

static bool get usesTouchscreen => !isMobile;

static bool get platformCanRecord => (isMobile || isMacOS);
Expand Down
6 changes: 3 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3065,13 +3065,13 @@ packages:
source: hosted
version: "1.1.0"
web:
dependency: "direct overridden"
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.3.0"
web_socket_channel:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ dependency_overrides:
git:
url: https://github.com/linagora/matrix_link_text.git
ref: twake-supported
web: ^0.5.0

cider:
link_template:
Expand Down

0 comments on commit 4d93694

Please sign in to comment.