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

release: v1.9.2 #1336

Merged
merged 11 commits into from
Sep 25, 2024
9 changes: 2 additions & 7 deletions packages/uni_app/lib/app_links/uni_app_links.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import 'dart:async';

import 'package:app_links/app_links.dart';
import 'package:uni/utils/uri.dart';

final _authUri = Uri(scheme: 'pt.up.fe.ni.uni', host: 'auth');

extension _StripQueryParameters on Uri {
Uri stripQueryParameters() {
return Uri(scheme: scheme, host: host, path: path);
}
}

class UniAppLinks {
final login = _AuthenticationAppLink(
redirectUri: _authUri.replace(path: '/login'),
Expand All @@ -30,7 +25,7 @@ class _AuthenticationAppLink {
FutureOr<void> Function(Uri redirectUri) callback,
) async {
final interceptedUri = _appLinks.uriLinkStream
.firstWhere((uri) => redirectUri == uri.stripQueryParameters());
.firstWhere((uri) => redirectUri == uri.stripQueryComponent());

await callback(redirectUri);
final data = await interceptedUri;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:uni/http/client/authenticated.dart';
import 'package:uni/http/client/timeout.dart';
import 'package:uni/session/authentication_controller.dart';
import 'package:uni/session/flows/base/session.dart';
import 'package:uni/utils/uri.dart';

extension UriString on String {
/// Converts a [String] to an [Uri].
Expand Down Expand Up @@ -65,6 +66,10 @@ class NetworkRouter {
];
}

return client.get(parsedUrl.replace(queryParameters: allQueryParameters));
final requestUri = parsedUrl
.replace(queryParameters: allQueryParameters)
.normalizeQueryComponent();

return client.get(requestUri);
}
}
16 changes: 16 additions & 0 deletions packages/uni_app/lib/utils/uri.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extension UriUtils on Uri {
Uri stripQueryComponent() {
return Uri(
scheme: scheme,
userInfo: userInfo,
host: host,
port: port,
path: path,
fragment: fragment.isNotEmpty ? fragment : null,
);
}

Uri normalizeQueryComponent() => query.isNotEmpty
? replace(query: query.replaceAll('+', '%20'))
: stripQueryComponent();
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,9 @@ class NextArrivalsState extends State<NextArrivals> {
),
),
constraints: const BoxConstraints(maxHeight: 150),
child: Material(
child: TabBar(
isScrollable: true,
tabs: createTabs(queryData),
),
child: TabBar(
isScrollable: true,
tabs: createTabs(queryData),
),
),
Expanded(
Expand Down
4 changes: 1 addition & 3 deletions packages/uni_app/lib/view/exams/exams.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ class ExamsPageViewState extends SecondaryPageViewState<ExamsPageView> {
key: Key('$exam-exam'),
margin: const EdgeInsets.fromLTRB(12, 4, 12, 0),
child: RowContainer(
color: isHidden
? Theme.of(context).hintColor
: Theme.of(context).scaffoldBackgroundColor,
color: isHidden ? Theme.of(context).hintColor : null,
child: ExamRow(
exam: exam,
teacher: '',
Expand Down