diff --git a/evently/i18n/de.json b/evently/i18n/de.json index f02d08ce0c..b140eac4eb 100644 --- a/evently/i18n/de.json +++ b/evently/i18n/de.json @@ -57,5 +57,6 @@ "free_shirt": "1 free t-shirt", "free_gift": "Free Gift", "free_drink": "1 free drink", - "publish" : "Publish" + "publish" : "Publish", + "recipe_created": "Recipe созданный" } \ No newline at end of file diff --git a/evently/i18n/en-US.json b/evently/i18n/en-US.json index 9c6a3d4733..53e3d3bd59 100644 --- a/evently/i18n/en-US.json +++ b/evently/i18n/en-US.json @@ -57,5 +57,6 @@ "free_shirt": "1 free t-shirt", "free_gift": "Free Gift", "free_drink": "1 free drink", - "publish" : "Publish" + "publish" : "Publish", + "recipe_created": "Recipe created" } \ No newline at end of file diff --git a/evently/i18n/es.json b/evently/i18n/es.json index 4a4084f507..a539f4f67c 100644 --- a/evently/i18n/es.json +++ b/evently/i18n/es.json @@ -57,5 +57,6 @@ "free_shirt": "1 free t-shirt", "free_gift": "Free Gift", "free_drink": "1 free drink", - "publish" : "Publish" + "publish" : "Publish", + "recipe_created": "Recipe creada" } \ No newline at end of file diff --git a/evently/i18n/ru-RU.json b/evently/i18n/ru-RU.json index e584dea16b..706db0ce31 100644 --- a/evently/i18n/ru-RU.json +++ b/evently/i18n/ru-RU.json @@ -57,5 +57,6 @@ "free_shirt": "1 free t-shirt", "free_gift": "Free Gift", "free_drink": "1 free drink", - "publish" : "Publish" + "publish" : "Publish", + "recipe_created": "Recipe созданный" } \ No newline at end of file diff --git a/evently/lib/evently_provider.dart b/evently/lib/evently_provider.dart index af05e9aea4..eae5102946 100644 --- a/evently/lib/evently_provider.dart +++ b/evently/lib/evently_provider.dart @@ -190,7 +190,7 @@ class EventlyProvider extends ChangeNotifier { String currentUserName = ""; bool stripeAccountExists = false; - late Event event; + String? _cookbookId; String _recipeId = ""; @@ -215,8 +215,8 @@ class EventlyProvider extends ChangeNotifier { return sdkResponse; } - Future createRecipe({required Event event}) async { - final scaffoldMessengerState = navigatorKey.getState(); + Future createRecipe() async { + // final scaffoldMessengerState = navigatorKey.getState(); _cookbookId = repository.getCookbookId(); @@ -235,16 +235,42 @@ class EventlyProvider extends ChangeNotifier { } _recipeId = repository.autoGenerateEventlyId(); - event.createRecipe( + + final event = Event( + eventName: eventName, + hostName: hostName, + thumbnail: thumbnail!.path, + startDate: startDate, + endDate: endDate, + startTime: startTime, + endTime: endTime, + location: location, + description: description, + isFreeDrop: isFreeDrop, + numberOfTickets: numberOfTickets, + price: price, + listOfPerks: perks.map((e) => e.toString()).toList()); + + final recipe = event.createRecipe( cookbookId: _cookbookId!, recipeId: _recipeId, isFreeDrop: isFreeDrop, symbol: selectedDenom.symbol, - hashtagsList: perks, + perksList: perks, price: price, ); - return Future.value(true); + final response = await PylonsWallet.instance.txCreateRecipe(recipe, requestResponse: false); + + if (!response.success) { + // scaffoldMessengerState?.show(message: "$kErrRecipe ${response.error}"); + return false; + } + // scaffoldMessengerState?.show(message: LocaleKeys.recipe_created.tr()); + // final nftFromRecipe = NFT.fromRecipe(recipe); + // GetIt.I.get<>().updatePublishedNFTList(nft: nftFromRecipe); + // deleteNft(nft.id); + return false; } /// send createCookBook tx message to the wallet app diff --git a/evently/lib/generated/locale_keys.g.dart b/evently/lib/generated/locale_keys.g.dart index 03d9acb19a..a79682b06a 100644 --- a/evently/lib/generated/locale_keys.g.dart +++ b/evently/lib/generated/locale_keys.g.dart @@ -58,5 +58,6 @@ abstract class LocaleKeys { static const start = 'start'; static const free_gift = 'free_gift'; static const free_drink = 'free_drink'; + static const recipe_created = 'recipe_created'; } diff --git a/evently/lib/models/events.dart b/evently/lib/models/events.dart index fc9e0290d7..c092c61c8b 100644 --- a/evently/lib/models/events.dart +++ b/evently/lib/models/events.dart @@ -54,7 +54,7 @@ extension CreateRecipe on Event { required String recipeId, required FreeDrop isFreeDrop, required String symbol, - required List hashtagsList, + required List perksList, required String price, }) { return Recipe( diff --git a/evently/lib/models/perks_model.dart b/evently/lib/models/perks_model.dart index ef148513e7..bc9d10c233 100644 --- a/evently/lib/models/perks_model.dart +++ b/evently/lib/models/perks_model.dart @@ -13,4 +13,9 @@ class PerksModel { name: perksModel.name, description: description, ); + + @override + String toString() { + return 'PerksModel{name: $name, description: $description}'; + } } diff --git a/evently/lib/screens/host_view_ticket_preview.dart b/evently/lib/screens/host_view_ticket_preview.dart index 348f15846b..8ac54606b0 100644 --- a/evently/lib/screens/host_view_ticket_preview.dart +++ b/evently/lib/screens/host_view_ticket_preview.dart @@ -270,7 +270,7 @@ class _HostTicketPreviewState extends State { return; } - final bool isRecipeCreated = await viewModel.createRecipe(event: viewModel.event); + final bool isRecipeCreated = await viewModel.createRecipe(); pylonsLoadingAnimation.hide(); if (!isRecipeCreated) { return; diff --git a/evently/lib/utils/constants.dart b/evently/lib/utils/constants.dart index 72a691d8c5..c30adf8dd3 100644 --- a/evently/lib/utils/constants.dart +++ b/evently/lib/utils/constants.dart @@ -72,6 +72,9 @@ const kPerks = "kPerks"; const kNumberOfTickets = "kNumberOfTickets"; const kPrice = "kPrice"; +const kErrRecipe = 'Recipe error :'; + + /// ```SVG assets class SVGUtils { static const kSvgSplash = 'assets/images/svg/splash.svg';