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

removed profile pic and added an horizontal line to some pages #1294

Open
wants to merge 20 commits into
base: ui/redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Binary file added codecov
Binary file not shown.
11 changes: 0 additions & 11 deletions packages/uni_app/lib/model/entities/login_exceptions.dart

This file was deleted.

1 change: 1 addition & 0 deletions packages/uni_app/lib/session/exception.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
enum AuthenticationExceptionType {
internetError,
wrongCredentials,
expiredCredentials,
other,
Expand Down
12 changes: 11 additions & 1 deletion packages/uni_app/lib/session/flows/credentials/request.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:uni/controller/fetchers/faculties_fetcher.dart';
import 'package:uni/session/exception.dart';
Expand Down Expand Up @@ -35,11 +36,20 @@ class CredentialsSessionRequest extends SessionRequest {
'Failed to authenticate user',
AuthenticationExceptionType.expiredCredentials,
);
} else {
} else if (failureReason == LoginFailureReason.internetError) {
throw const AuthenticationException(
'Failed to authenticate user',
AuthenticationExceptionType.internetError,
);
} else if (failureReason == LoginFailureReason.wrongCredentials) {
throw const AuthenticationException(
'Failed to authenticate user',
AuthenticationExceptionType.wrongCredentials,
);
} else {
throw const AuthenticationException(
'Failed to authenticate user',
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class LoginResponse extends SigarraResponse {

enum LoginFailureReason {
serverError,
internetError,
wrongCredentials,
expiredCredentials,
blockedAccount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:uni/model/providers/startup/profile_provider.dart';
import 'package:uni/model/providers/startup/session_provider.dart';
import 'package:uni/view/common_widgets/expanded_image_label.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/widgets/profile_button.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/widgets/refresh_state.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart';

Expand Down Expand Up @@ -136,7 +135,6 @@ abstract class GeneralPageViewState<T extends StatefulWidget> extends State<T> {
AppTopNavbar? getTopNavbar(BuildContext context) {
return AppTopNavbar(
title: this.getTitle(),
rightButton: const ProfileButton(),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,53 @@ class AppTopNavbar extends StatelessWidget implements PreferredSizeWidget {
final Widget? leftButton;

Widget _createTopWidgets(BuildContext context) {
return Padding(
padding: EdgeInsets.fromLTRB(leftButton == null ? 20 : 12, 0, 20, 0),
child: Row(
children: [
if (leftButton != null)
Padding(
padding: const EdgeInsets.only(right: 8),
child: leftButton,
),
Expanded(
child: PageTitle(
name: title ?? '',
pad: false,
center: false,
),
final shouldShowDivider = title == 'Faculty' || title == 'Restaurants';

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.fromLTRB(leftButton == null ? 20 : 12, 0, 20, 0),
child: Row(
children: [
if (leftButton != null)
Padding(
padding: const EdgeInsets.only(right: 8),
child: leftButton,
),
Expanded(
child: PageTitle(
name: title ?? '',
pad: false,
center: false,
),
),
if (rightButton != null)
Padding(
padding: const EdgeInsets.only(left: 8),
child: rightButton,
),
],
),
if (rightButton != null)
Padding(
padding: const EdgeInsets.only(left: 8),
child: rightButton,
),
if (shouldShowDivider)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
child: Container(
height: 1,
color:
const Color(0xFF7F7F7F).withOpacity(0.5), // Adjusted opacity
),
],
),
),
],
);
}

@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
Size get preferredSize => const Size.fromHeight(kToolbarHeight + 10);

@override
AppBar build(BuildContext context) {
Widget build(BuildContext context) {
return AppBar(
automaticallyImplyLeading: false,
elevation: 0,
Expand Down
2 changes: 0 additions & 2 deletions packages/uni_app/lib/view/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:uni/generated/l10n.dart';
import 'package:uni/utils/favorite_widget_type.dart';
import 'package:uni/view/common_widgets/page_title.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/general.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/widgets/profile_button.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart';
import 'package:uni/view/home/widgets/main_cards_list.dart';
import 'package:uni/view/home/widgets/tracking_banner.dart';
Expand Down Expand Up @@ -132,7 +131,6 @@ class HomePageViewState extends GeneralPageViewState {
padding: EdgeInsets.symmetric(horizontal: 8),
child: UniIcon(),
),
rightButton: ProfileButton(),
);
}
}
71 changes: 43 additions & 28 deletions packages/uni_app/lib/view/login/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:uni/app_links/uni_app_links.dart';
import 'package:uni/controller/networking/url_launcher.dart';
import 'package:uni/generated/l10n.dart';
import 'package:uni/model/entities/login_exceptions.dart';
import 'package:uni/model/providers/startup/session_provider.dart';
import 'package:uni/model/providers/state_providers.dart';
import 'package:uni/session/exception.dart';
import 'package:uni/session/flows/credentials/initiator.dart';
import 'package:uni/session/flows/federated/initiator.dart';
import 'package:uni/utils/constants.dart';
Expand Down Expand Up @@ -99,36 +99,51 @@ class LoginPageViewState extends State<LoginPageView>
_loggingIn = false;
});
}
} catch (err, st) {
} on AuthenticationException catch (err, st) {
setState(() {
_loggingIn = false;
});
if (err is ExpiredCredentialsException) {
_updatePasswordDialog();
} else if (err is InternetStatusException) {
if (mounted) {
unawaited(
ToastMessage.warning(
context,
S.of(context).internet_status_exception,
),
);
}
} else if (err is WrongCredentialsException) {
if (mounted) {
unawaited(
ToastMessage.error(
context,
S.of(context).wrong_credentials_exception,
),
);
}
} else {
Logger().e(err, stackTrace: st);
unawaited(Sentry.captureException(err, stackTrace: st));
if (mounted) {
unawaited(ToastMessage.error(context, S.of(context).failed_login));
}

switch (err.type) {
case AuthenticationExceptionType.expiredCredentials:
_updatePasswordDialog();
case AuthenticationExceptionType.internetError:
if (mounted) {
unawaited(
ToastMessage.warning(
context,
S.of(context).internet_status_exception,
),
);
}
case AuthenticationExceptionType.wrongCredentials:
if (mounted) {
unawaited(
ToastMessage.error(
context,
S.of(context).wrong_credentials_exception,
),
);
}
default:
Logger().e(err, stackTrace: st);
unawaited(Sentry.captureException(err, stackTrace: st));
if (mounted) {
unawaited(
ToastMessage.error(context, S.of(context).failed_login),
);
}
}
}
// Handles other unexpected exceptions
catch (err, st) {
setState(() {
_loggingIn = false;
});
Logger().e(err, stackTrace: st);
unawaited(Sentry.captureException(err, stackTrace: st));
if (mounted) {
unawaited(ToastMessage.error(context, S.of(context).failed_login));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/uni_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev
# To change it manually, override the value in app_version.txt.
# The app version code is automatically also bumped by CI.
# Do not change it manually.
version: 1.10.0-beta.35+338
version: 1.10.0-beta.36+339

environment:
sdk: ">=3.4.0 <4.0.0"
Expand Down