Skip to content

Commit

Permalink
Merge pull request #32 from NODO-UH/develop
Browse files Browse the repository at this point in the history
Release v1.0.2
  • Loading branch information
leynier authored Apr 25, 2021
2 parents bb1d8e5 + 1f36a1f commit 3441d92
Show file tree
Hide file tree
Showing 49 changed files with 2,443 additions and 723 deletions.
4 changes: 4 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,9 @@
<false/>
<key>UIStatusBarHidden</key>
<false/>
<key>CFBundleLocalizations</key>
<array>
<string>es</string>
</array>
</dict>
</plist>
9 changes: 9 additions & 0 deletions lib/src/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:gestionuh/src/presentation/theme/theme.dart';
import 'package:gestionuh/src/router.dart';
import 'package:gestionuh/src/utils/constants/constants.dart';
Expand All @@ -11,6 +12,14 @@ class GestionUhApp extends StatelessWidget {
theme: gestionuhLightTheme,
debugShowCheckedModeBanner: Constants.testMode,
onGenerateRoute: RouterNavigation.onGenerateRoute,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: const [
Locale('es', ''),
],
);
}
}
20 changes: 10 additions & 10 deletions lib/src/data/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class GestionApi {

Status response;

final credentials = PassReset(password, newPassw);
final credentials = PassReset(currentPassw, newPassw);

response = await apiRequest<Status, PassReset>(
Constants.resetPasswordUrld,
Expand Down Expand Up @@ -256,18 +256,18 @@ class GestionApi {
return target;
}

if (builder != null) {
try {
if (response.statusCode! >= 300) {
final Error error = Error.fromJson(
jsonDecode(response.data!) as Map<String, dynamic>);
target.error = error.code.toString();
} else {
try {
if (response.statusCode! >= 300) {
final Error error =
Error.fromJson(jsonDecode(response.data!) as Map<String, dynamic>);
target.error = error.code.toString();
} else {
if (builder != null) {
target = builder(jsonDecode(response.data!) as Map<String, dynamic>);
}
} catch (e) {
target.error = Errors.DefaultError;
}
} catch (e) {
target.error = Errors.DefaultError;
}

if (target.error != null) {
Expand Down
3 changes: 2 additions & 1 deletion lib/src/data/enums/home_item_enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ enum HomeItemEnum {
Quota,
MailQuota,
ResetPassword,
Logout,
AboutUs,
HelpfulLinks,
Logout,
}
2 changes: 1 addition & 1 deletion lib/src/data/repositories/auth_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AuthRepository {
String currentPassword, String newPassword) async {
try {
final status = await api.resetPassword(currentPassword, newPassword);
if (status.status == false) {
if (status.status != true) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/presentation/blocs/blocs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export 'profile_bloc/profile_bloc.dart';
export 'quota_bloc/quota_bloc.dart';
export 'recover_password_bloc/recover_password_bloc.dart';
export 'register_bloc/register_bloc.dart';
export 'reset_password_bloc/resetpassword_bloc.dart';
export 'reset_password_bloc/reset_password_bloc.dart';
21 changes: 17 additions & 4 deletions lib/src/presentation/blocs/home_bloc/home_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
yield const HomeState.loading();
final result = await profileRepository.getUserData();
if (result == null) {
yield const HomeState.error(Errors.DefaultError);
yield const HomeState.error(
Errors.DefaultError,
[HomeItemEnum.Logout],
);
} else if (result.error != null) {
yield HomeState.error(result.error!);
yield HomeState.error(
result.error!,
const [HomeItemEnum.Logout],
);
} else {
add(HomeEvent.goToProfile(result));
}
Expand Down Expand Up @@ -67,6 +73,12 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
_getItemsByProfile(profile),
);
},
goToHelpfulLinks: (profile) async* {
yield HomeState.helpfulLinks(
profile,
_getItemsByProfile(profile),
);
},
logout: () async* {
yield const HomeState.loading();
await authRepository.logout();
Expand All @@ -81,9 +93,10 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
if (profile.hasInternet ?? false) HomeItemEnum.Quota,
if (profile.hasEmail ?? false) HomeItemEnum.MailQuota,
HomeItemEnum.ResetPassword,
HomeItemEnum.Logout,
HomeItemEnum.Separator,
HomeItemEnum.HelpfulLinks,
HomeItemEnum.AboutUs,
HomeItemEnum.Separator,
HomeItemEnum.Logout,
];
}
}
Loading

0 comments on commit 3441d92

Please sign in to comment.