Skip to content

Commit

Permalink
feat: draft list
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanRns committed May 16, 2024
1 parent 32044b5 commit cd077b4
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 39 deletions.
3 changes: 2 additions & 1 deletion evently/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@
"something_wrong_while_uploading": "Beim Hochladen ist etwas schief gelaufen. Bitte versuche es erneut.",
"cookbook_not_found": "Cookbook nicht gefunden",
"loading": "Wird geladen ...",
"something_wrong": "Etwas ist schief gelaufen. Bitte versuchen Sie, die Anwendung neu zu starten."
"something_wrong": "Etwas ist schief gelaufen. Bitte versuchen Sie, die Anwendung neu zu starten.",
"get_error": "Entwurf konnte nicht abgerufen werden"
}
3 changes: 2 additions & 1 deletion evently/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@
"something_wrong_while_uploading": "Something went wrong while uploading. Please try again.",
"cookbook_not_found": "Cookbook not found",
"loading": "loading ...",
"something_wrong": "Something went wrong. Please try restarting the application."
"something_wrong": "Something went wrong. Please try restarting the application.",
"get_error": "Failed to get draft"
}
3 changes: 2 additions & 1 deletion evently/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@
"something_wrong_while_uploading": "Algo salió mal durante la carga. Inténtalo de nuevo.",
"cookbook_not_found": "Cookbook extraviado",
"loading": "cargando ...",
"something_wrong": "Algo salió mal. Intenta reiniciar la aplicación."
"something_wrong": "Algo salió mal. Intenta reiniciar la aplicación.",
"get_error": "No se pudo obtener el Plan Preliminar"
}
3 changes: 2 additions & 1 deletion evently/i18n/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@
"something_wrong_while_uploading": "Что-то пошло не так во время загрузки. Пожалуйста, попробуйте еще раз.",
"cookbook_not_found": "Cookbook не найден",
"loading": "cargando ...",
"something_wrong": "Что-то пошло не так. Попробуйте перезапустить приложение."
"something_wrong": "Что-то пошло не так. Попробуйте перезапустить приложение.",
"get_error": "Не удалось получить черновик"
}
1 change: 1 addition & 0 deletions evently/lib/generated/locale_keys.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ abstract class LocaleKeys {
static const cookbook_not_found = 'cookbook_not_found';
static const loading = 'loading';
static const something_wrong = 'something_wrong';
static const get_error = 'get_error';

}
13 changes: 7 additions & 6 deletions evently/lib/screens/event_hub/event_hub_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class EventHubViewModel extends ChangeNotifier {

List<Events> get eventPublishedList => _eventPublishedList;

List<Events> _eventForSaleList = [];
List<Events> _eventForDraftList = [];

List<Events> get eventForSaleList => _eventForSaleList;
List<Events> get eventForSaleList => _eventForDraftList;

set setEventForSaleList(List<Events> nftForSale) {
_eventForSaleList = nftForSale;
set setEventForDraftList(List<Events> nftForSale) {
_eventForDraftList = nftForSale;
notifyListeners();
}

Expand All @@ -36,7 +36,7 @@ class EventHubViewModel extends ChangeNotifier {

void updatePublishedEventList({required Events events}) {
_eventPublishedList.add(events);
_eventForSaleList.add(events);
_eventForDraftList.add(events);
notifyListeners();
}

Expand Down Expand Up @@ -105,7 +105,8 @@ class EventHubViewModel extends ChangeNotifier {
return;
}

// nftDraftList = getNftResponse.getOrElse(() => []);
List<Events> draftEvent = getEventResponse.getOrElse(() => []);
setEventForDraftList = draftEvent;

loading.dismiss();

Expand Down
19 changes: 15 additions & 4 deletions evently/lib/services/datasources/local_datasource.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:evently/generated/locale_keys.g.dart';
import 'package:evently/models/events.dart';
import 'package:evently/services/third_party_services/database.dart';
import 'package:evently/utils/constants.dart';
import 'package:evently/utils/date_utils.dart';
import 'package:evently/utils/failure/failure.dart';
import 'package:injectable/injectable.dart';
import 'package:shared_preferences/shared_preferences.dart';

Expand Down Expand Up @@ -42,9 +46,13 @@ abstract class LocalDataSource {

@LazySingleton(as: LocalDataSource)
class LocalDataSourceImpl extends LocalDataSource {
LocalDataSourceImpl({required this.sharedPreferences});
LocalDataSourceImpl({
required this.sharedPreferences,
required this.database,
});

final SharedPreferences sharedPreferences;
final AppDatabase database;

/// auto generates cookbookID string and saves into local storage
/// returns cookbookId
Expand Down Expand Up @@ -93,8 +101,11 @@ class LocalDataSourceImpl extends LocalDataSource {
}

@override
Future<List<Events>> getEvents() {
// TODO: implement getEvents
throw UnimplementedError();
Future<List<Events>> getEvents() async {
try {
return await database.eventsDao.findAllEvents();
} catch (e) {
throw CacheFailure(LocaleKeys.get_error.tr());
}
}
}
53 changes: 28 additions & 25 deletions evently/lib/utils/di/di.config.dart

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

0 comments on commit cd077b4

Please sign in to comment.