Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TW-2124: Fixed wrong url when using logout #2126

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/presentation/mixins/connect_page_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ mixin ConnectPageMixin {
}
return html.window.location.href
.getBaseUrlBeforeHash()
.generateAuthPath(isDevMode: AppConfig.devMode);
.generateLogoutAuthPath(isDevMode: AppConfig.devMode);
}
return '${AppConfig.appOpenUrlScheme.toLowerCase()}://redirect';
}
Expand All @@ -235,7 +235,9 @@ mixin ConnectPageMixin {
if (AppConfig.issueId != null && AppConfig.issueId!.isNotEmpty) {
return '${html.window.location.href.getBaseUrlBeforeHash()}auth.html$homeserverParam';
}
return html.window.location.href.getBaseUrlBeforeHash().generateAuthPath(
return html.window.location.href
.getBaseUrlBeforeHash()
.generateLoginAuthPath(
homeserverParams: homeserverParam,
isDevMode: AppConfig.devMode,
);
Expand Down
14 changes: 11 additions & 3 deletions lib/utils/string_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,22 @@ extension StringCasingExtension on String {
return fragmentIndex != -1 ? substring(0, fragmentIndex) : this;
}

String generateAuthPath({
String generateLoginAuthPath({
String? homeserverParams,
bool isDevMode = false,
}) {
final newHomeserverParams = homeserverParams?.trim() ?? '';
final path = isDevMode ? 'web/auth.html' : 'auth.html';
return '$this$path$newHomeserverParams';
}

String generateLogoutAuthPath({
hoangdat marked this conversation as resolved.
Show resolved Hide resolved
bool isDevMode = false,
}) {
if (isDevMode) {
return '${this}web/auth.html$homeserverParams';
return '${this}web/auth.html';
} else {
return '${this}auth.html$homeserverParams';
return '${this}auth.html';
}
}
}