Skip to content
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
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="receipe_app"
android:name="${applicationName}"
Expand Down
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class MessageLookup extends MessageLookupByLibrary {

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"account_created_successfully": MessageLookupByLibrary.simpleMessage(
"Account created successfully"),
"already_have_an_account":
MessageLookupByLibrary.simpleMessage("Already have an account?"),
"are_you_sure": MessageLookupByLibrary.simpleMessage(
Expand Down
10 changes: 10 additions & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
"logout": "LOGOUT ",
"no_dish_available": "There are no available dish to view currently",
"generate_recipe_contents": "Generating Recipe contents",
"connection_error": "Seems like we got a problem connecting to the server. Kindly try again when you have a stronger network"
"connection_error": "Seems like we got a problem connecting to the server. Kindly try again when you have a stronger network",
"account_created_successfully": "Account created successfully"
}
22 changes: 12 additions & 10 deletions lib/ui/views/new_dish/new_dish_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';

class NewDishViewModel extends FormViewModel {
final _navigationService = locator<NavigationService>();
final NavigationService _navigationService = locator<NavigationService>();
final DishService _dishService = locator<DishService>();
final _dialogService = locator<DialogService>();
final DialogService _dialogService = locator<DialogService>();

final _logger = getLogger('NewDishViewModel');

Expand All @@ -28,16 +28,18 @@ class NewDishViewModel extends FormViewModel {

final response = await _dishService.createDish(info);

if (response != null) {
DialogResponse<dynamic>? dialogResponse =
await _dialogService.showDialog(
description: response,
_logger.i('create dish response: $response');

// Null first Approach - cases API returns NULL
if (response == null) {
_dialogService.showDialog(
title: S.current.unknown_error,
);
if (dialogResponse?.confirmed == true) {
_navigationService.back();
}
}
} on RecipeException catch (e) {

await _dialogService.showDialog(title: response);
} on RecipeException catch (e, s) {
_logger.e('Network connection Error in creating dish', e, s);
_dialogService.showDialog(
description: e.message,
);
Expand Down
9 changes: 7 additions & 2 deletions lib/ui/views/signup/signup_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:receipe_app/services/authentication_service.dart';
import 'package:receipe_app/ui/views/signup/signup_view.form.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:receipe_app/generated/l10n.dart';

class SignupViewModel extends FormViewModel {
final _navigationService = locator<NavigationService>();
Expand Down Expand Up @@ -37,11 +38,15 @@ class SignupViewModel extends FormViewModel {
final User? response =
await _authenticationService.register(registerModel);

if (response != null) {
if (response == null) {
await _dialogService.showDialog(
description: "Account created successfully.",
description: S.current.unknown_error,
);
}

await _dialogService.showDialog(
description: S.current.account_created_successfully,
);
} on RecipeException catch (e) {
_dialogService.showDialog(
description: e.message,
Expand Down
26 changes: 13 additions & 13 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -513,10 +513,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -830,10 +830,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stacked:
dependency: "direct main"
description:
Expand Down Expand Up @@ -870,10 +870,10 @@ packages:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
stream_transform:
dependency: transitive
description:
Expand Down Expand Up @@ -910,10 +910,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -990,10 +990,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
web_socket_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -1035,5 +1035,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.1.0 <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.13.0"
23 changes: 23 additions & 0 deletions test/helpers/test_helpers.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,29 @@ class MockDishService extends _i1.Mock implements _i17.DishService {
),
)),
) as _i6.Future<_i2.RecipesResponseModel>);
@override
_i6.Future<_i2.RecipesResponseModel> getUserDishes() => (super.noSuchMethod(
Invocation.method(
#getUserDishes,
[],
),
returnValue: _i6.Future<_i2.RecipesResponseModel>.value(
_FakeRecipesResponseModel_0(
this,
Invocation.method(
#getUserDishes,
[],
),
)),
returnValueForMissingStub: _i6.Future<_i2.RecipesResponseModel>.value(
_FakeRecipesResponseModel_0(
this,
Invocation.method(
#getUserDishes,
[],
),
)),
) as _i6.Future<_i2.RecipesResponseModel>);
}

/// A class which mocks [DatabaseService].
Expand Down